#HOW TO BUILD box2d-jquery
##BUILD
box2d-jquery is written mostly in coffee-script, with some dependencies in javascript.
the build system is based on grunt@0.4.0rc8. grunt v4 is cutting edge, please follow these install instructions carefully (otherwise you will get really really confused, gront@0.3 != grunt@0.4)
npm install -g grunt-cli
this install a command line grunt wrapper, please see https://github.com/gruntjs/grunt-cli
now, in your box2d-jquery folder do
npm install
this installs a lot of stuff. after it finished successfully, do
npm grunt --version
if something like this shows up
grunt-cli v0.1.6
grunt v0.4.0rc8
you are ready to go.
grunt -v
will
- build a new version of box2d-jquery
- watch
- for changes
- if one of these files changes, a new version of
- will be build
- yes, i'm not very subtil in my build process
- please see Gruntfile.js
for debugging reasons, in between build steps can be found in the js/temp/ folder.
if you want to add files to the build process, please add the files to the
- buildfiles
- coffeesrc
section of package.json
##VIEW
to view your local version of box2d-jquery do something like this
python -m SimpleHTTPServer 3000
then visit
##CODE
the important files are
jquery plugin that replaces elements with absolute positioned clones of themselves, while hiding & silencing the originals.
basically some box2d-jquery shared variables, whenever you encounter a variable you do not recogice, look there
mouse and touch handling stuff (needs a major rewrite, by the way)
creates the box2d objects (based on the DOM)
the startWorld, draw and update cycle
the jquery wrapper and some default options
the box2d physics engine via http://code.google.com/p/box2dweb/
if it can be prevented, don't touch it, it's a direct 1:1 untouched version of box2dweb, i don't want to get into the business of mantaining my own for of box2dweb fork. but if it can't prevented, just do it.