本文整理匯總了TypeScript中rot-js.Display.draw方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Display.draw方法的具體用法?TypeScript Display.draw怎麽用?TypeScript Display.draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rot-js.Display
的用法示例。
在下文中一共展示了Display.draw方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
dijkstra.compute(8, 45, (x: number, y: number) => {
display.draw(x, y, "", "", "#800");
});
示例2: SHOW
// Console Display / Configuring the display
display = new ROT.Display({ width: 20, height: 5 });
SHOW(display.getContainer());
display.setOptions({
width: 30,
fontSize: 8,
fontStyle: "bold",
bg: "#a00"
});
// 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"];
示例3:
tileSet.onload = () => {
const ch = ["#", "@"];
const fg = ["rgba(255, 0, 0, 0.5)", "rgba(0, 0, 255, 0.5)"];
const bg = ["transparent", "transparent"];
display.draw(0, 0, ch, fg, bg);
};