Giter VIP home page Giter VIP logo

GameJs

GameJs is a JavaScript library for writing 2D games or other interactive graphic applications for the HTML Canvas.

Topics

Drawing on the screen

  • image loading image files
  • graphics image transformation (rotate, transform,...) and drawing with geometric shapes
  • font rendering text

Mouse and keyboard

  • event Recieve events for user input

Audio

  • audio Playback with multiple channels

Game logic

Advanced

Math

Usage

See the examples directory for working examples.

Standalone

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:

$ npm install gamejs

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

More Help

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.

Development - How to build

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:

$ npm install

Build GameJs:

$ grunt

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.

GameJs.org's Projects

gamejs icon gamejs

GameJs is a thin library on top of the HTML canvas element. In addition to the drawing functions it has a set of generally helpful modules for game development.

yabble icon yabble

Yet Another (CommonJS) Browser Loader

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.