本文整理汇总了TypeScript中rot-js.Display.drawText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Display.drawText方法的具体用法?TypeScript Display.drawText怎么用?TypeScript Display.drawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rot-js.Display
的用法示例。
在下文中一共展示了Display.drawText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: SHOW
// Console Display / Drawing individual characters
display = new ROT.Display({ width: 40, height: 9 });
SHOW(display.getContainer());
display.draw(5, 4, "@");
display.draw(15, 4, "%", "#0f0"); /* foreground color */
display.draw(25, 4, "#", "#f00", "#009"); /* and background color */
// Console Display / Drawing strings
display = new ROT.Display({ width: 40, height: 20 });
SHOW(display.getContainer());
display.drawText(5, 2, "Hello world");
/* last argument specifies maximum length */
display.drawText(20, 5, "This line of text is very long.", 16);
/* lines are broken at word boundaries; lines are trimmed */
const words = ["lorem", "ipsum", "dolor", "sit", "amet"];
const long: string[] = [];
for (let i = 0; i < 30; i++) { long.push(words.random()); }
const longer = long.join(" ");
display.drawText(1, 10, longer, 38);
// Console Display / Specifying foreground/background color in strings
display = new ROT.Display({ width: 40, height: 5 });