本文整理匯總了TypeScript中rot-js.Display類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Display類的具體用法?TypeScript Display怎麽用?TypeScript Display使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Display類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: SHOW
SHOW(clone.getUniform());
// RNG / Picking a weighted value
const monsters = {
orc: 3,
ogre: 1,
rat: 5
};
for (let i = 0; i < 20; i++) {
SHOW(ROT.RNG.getWeightedValue(monsters));
}
// Console Display / Creating a display
display = new ROT.Display({ width: 20, height: 5 });
SHOW(display.getContainer()); /* do not forget to append to page! */
// 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 });
示例2:
tileSet.onload = () => {
display.draw(1, 1, "@");
display.draw(0, 0, "#");
display.draw(0, 1, "#");
display.draw(1, 0, "#");
display.draw(0, 2, "#");
display.draw(2, 2, "a");
display.draw(2, 0, "!");
display.draw(2, 1, "!");
};
示例3:
fov.compute(50, 22, 10, (x, y, r, visibility) => {
let ch = (r ? "" : "@");
let color = (data_uniform[x + "," + y] ? "#aa0" : "#660");
display.draw(x, y, ch, "#fff", color);
});
示例4:
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);
};