GameJs is a JavaScript library for writing 2D games or other interactive graphic applications for the HTML Canvas.
See the examples directory for working examples.
HTML File loads GameJs and sets the main module:
<script src="./public/gamejs.min.js"></script>
<script>
require.setModuleRoot('./javascript/');
require.run('main')
</script>
The main module javascript/main.js
starts the application:
var gamejs = require('gamejs');
gamejs.ready(function() {
var display = gamejs.display.getSurface();
...
});
GameJs as a CommonJs package with browserify
GameJs is a CommonJs package published on NPM. To use it with browserify install the GameJs package in your game's directory:
And install browserify, if you don't already have it.
$ npm install -g browserify
You can then bundle your application ("main.js") with all its dependencies - including GameJs - like so:
$ browserify ./main.js --out bundled.js
See the GameJs Website for more help or drop us an email in the Mailing List.
Example application can be found in the examples/
directory.
GameJs consists of CommonJs modules in ./src/
which we build and jshint with grunt. If you don't already have node and npm, install those. You will also need java
on your path for building the distribution file.
Install grunt:
$ npm install -g grunt-cli
In the GameJs folder you cloned, install the dependencies to build using npm:
Build GameJs:
This will create the gamejs-VERSION.js
file and a minified gamejs-VERSION.min.js
which you can use standalone in the browser, as demonstrated in the examples.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4