rot.js

ROguelike Toolkit

Github星跟蹤圖

rot.js

ROguelike Toolkit in JavaScript. For more info, see http://ondras.github.com/rot.js.

Library

There are multiple ways of including rot.js in your project.

Downloading

You can get rot.js using either of these methods:

Usage

Rot.js is written in TypeScript, but its code is available in multiple formats. You can pick the one that best suits your development needs.

  1. The lib/ directory contains the code in ES2015 modules. These can be used in modern browsers directly, without any transpilation/bundling step. An example shows how to do that.

  2. For practical reasons, individual modules should be bundled to make your application more compact. You are free to use any bundler that understands ES2015 modules. If you want tu support older browsers, you should also transpile your code -- there is an example using babel and rollup that shows how to do that. This is the recommended way of using rot.js.

  3. If you do not fancy modern modules and/or transpilation, you can grab a pre-built bundle and include it in your page using traditional <script> tag. This bundle puts rot.js into a global ROT namespace and uses ES5 (supported even by older browsers). See an example of this approach.

  4. Finally, the pre-built budle also comes with a minified version that works the same, but its size has been reduced. The usage is the same as in the previous example.

Node.js

Most parts of rot.js are usable from within node.js (server-side JavaScript). The Display class needs to use the "term" layout backend:

let display = new ROT.Display({width:40, height:9, layout:"term"});
display.draw(5,  4, "@");
display.draw(15, 4, "%", "#0f0");          // foreground color
display.draw(25, 4, "#", "#f00", "#009");  // and background color

Usage

The pre-bundled rot.js package can be loaded as a CommonJS module. There is an example that shows basic usage.

Misc

RogueBasin page (with links to some rot.js-based games): http://www.roguebasin.roguelikedevelopment.org/index.php?title=Rot.js

主要指標

概覽
名稱與所有者ondras/rot.js
主編程語言JavaScript
編程語言Makefile (語言數: 6)
平台
許可證BSD 3-Clause "New" or "Revised" License
所有者活动
創建於2012-05-21 07:58:45
推送於2024-11-13 07:22:29
最后一次提交2024-11-13 08:21:57
發布數11
最新版本名稱v2.2.1 (發布於 2024-11-13 08:22:09)
第一版名稱v0.5.0 (發布於 )
用户参与
星數2.6k
關注者數92
派生數263
提交數525
已啟用問題?
問題數134
打開的問題數46
拉請求數63
打開的拉請求數8
關閉的拉請求數19
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?