• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ondras/rot.js: ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, inte ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ondras/rot.js

开源软件地址(OpenSource Url):

https://github.com/ondras/rot.js

开源编程语言(OpenSource Language):

JavaScript 38.8%

开源软件介绍(OpenSource Introduction):

rot.js

ROguelike Toolkit in JavaScript. For more info, see https://ondras.github.io/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://roguebasin.com/index.php/Rot.js




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Swift-AI/Swift-AI: The Swift machine learning library.发布时间:2022-08-15
下一篇:
ATrappmann/PN5180-Library: PN5180 library for Arduino发布时间:2022-08-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap