GithubHelp home page GithubHelp logo

el-sonny / gamejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gamejs/gamejs

1.0 2.0 0.0 8.2 MB

A thin library on top of the HTML canvas element. The API is modeled after PyGame.

Home Page: http://gamejs.org

gamejs's Introduction

GameJs

GameJs is a JavaScript library for writing 2D games or other interactive graphic applications for the HTML Canvas http://gamejs.org.

Its API is modeled after the successful PyGame library http://pygame.org.

Usage

If you downloaded the git version, you will have to build the GameJs JavaScript file. Go to the GameJs directory and execute this in a unix shell or in git bash:

$ ./wrap-gamejs.sh

See the examples/skeleton/ directory for a minimal GameJs app. We recommend you also use this as the scaffolding if you want to create a new game yourself.

Note that you need to run the examples via http:// (not file://) unless you use Firefox or Safari. One trivial, cross-plattform solution to serve a directory via http is this executable: http://code.google.com/p/mongoose/.

Bundle your application for production

To wrap your own game's JavaScript files into one single file, use ./wrap-directory ./path-to-your-app/javascript/. You can also add a second argument compress to optionally minify the resulting JS file.

This will produce one file gjs-app-wrapped.js holding all GameJs modules as well as your application code. You can then remove the <script> lines loading yabble & gamejs-wrapped and should instead only load the gjs-app-wrapped.js file.

More Help

See the GameJs Website for more help or drop us an email in the Mailing List.

Check the docs folder of your GameJs installation.

Example application can be found in the examples/ directory.

GameJs Development

In production, an application uses a bundled JavaScript file which contains all GameJs modules (usually called gamejs-wrapped.js). This is what all the examples do.

Thus if you modify the files below ./lib your changes won't show up in the examples. You have two options to hack on GameJs:

  • rebundle the files with the ./wrap-gamejs.sh command
  • directly use the unbundled library files

To use the unbundled JavaScript files directly, remove the <script> line including gamejs-wrapped.js from your index.html and instead create symbolic links of everything below ./lib into your applications javascript/ directory:

$ cd path-to-your-app/javascript/
$ ln -s ~/gamejs/lib/*

Your application should now transparently load the single modules instead of the bundle.

Unit Tests

We use QUnit https://github.com/jquery/qunit for the GameJs unit tests. Execute them by opening tests/index.html.

JsDoc

For the JavaScript documentation system, RingoJs must be installed on your system. This bash file will take care of rewriting the documentation into docs/api/:

$ ./create-jsdoc.sh

gamejs's People

Contributors

danielgtaylor avatar domasx2 avatar jlfwong avatar oberhamsi avatar robi42 avatar sorki avatar tnajdek avatar

Stargazers

 avatar

Watchers

 avatar  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.