Giter VIP home page Giter VIP logo

zhong-yiyu / rot.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ondras/rot.js

0.0 0.0 0.0 3.7 MB

ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!

Home Page: https://ondras.github.io/rot.js/hp/

License: BSD 3-Clause "New" or "Revised" License

JavaScript 38.70% CoffeeScript 23.01% TypeScript 24.93% CSS 0.84% Makefile 0.58% HTML 11.94%

rot.js's 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 to 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.

Contributing

ROguelike Toolkit is largely considered "feature-complete", but bugfixes, documentation, and some new features are welcomed. Development should happen in the /src folder, and then the build process creates the /lib, /dist, and /doc folders before serving the project.

Visual layout of the build process

The command to rebuild everything:

npm install
make all

Misc

RogueBasin page (with links to some rot.js-based games): http://roguebasin.com/index.php/Rot.js

rot.js's People

Contributors

ondras avatar thesnarky1 avatar blinkdog avatar zhong-yiyu avatar katerberg avatar erikyuzwa avatar zlester avatar uzudil avatar bbugh avatar kodiologist avatar syntacticlosure avatar mikespook avatar kosinaz avatar norgg avatar jakofranko avatar statico avatar celticminstrel avatar lychees avatar tps12 avatar myevan avatar eruonna avatar zorgatone avatar troygilbert avatar theonlywayup avatar owenmpierce avatar hyakugei avatar jwlash-read-bot avatar john-bronson avatar nluqo avatar guykroizman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.