1.1.1 • Published 10 years ago
gamegine v1.1.1
Gamegine
Lightweight js game/animation engine
Installation
npm install gamegineTo use library in your project, you have to include gamegine.js in your html file
<script src="node_modules/gamegine/gamegine.min.js"></script>Demo
For demo go here.
You can also check it on jsFiddle - there is a possibility that you need to click 'Run' button to make it work (I had to fiddle with jsFiddle a little bit to make it work ;))
API
start- starts theGameginestop- stops theGamegine
Configuration parameters
config-Objectelement which has the following elements:canvas- id of DOM canvas element you want to work on (or DOM element itself, or if it does not exist - canvas DOM element will be created withidas this property)width- width (in pixels) which should be set on canvasheight- height (in pixels) which should be set on canvasfps(defaults to60) - how many FPS you'd like to runops(defaults tofps) - how many OPS you'd like to runcontext(defaults to2d) - what canvas context to use
callback- an object/function which should have 3 functions available:render- which is called when rendering frame should occur (called with one argument, which is canvas 2d context)logic- which is called when operation occurs (logic for the frame)init- which is called whenGamegineobject gets initialized
From the author
If you have any suggestions for the library, write me an email (ajakubo1@gmail.com) or open new issue on github!