Lightweight js game/animation engine
npm install gamegine
To use library in your project, you have to include gamegine.js in your html file
<script src="node_modules/gamegine/gamegine.min.js"></script>
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 ;))
-
start
- starts theGamegine
-
stop
- stops theGamegine
-
config
-Object
element 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 withid
as this property) -
width
- width (in pixels) which should be set on canvas -
height
- height (in pixels) which should be set on canvas -
fps
(defaults to60
) - how many FPS you'd like to run -
ops
(defaults tofps
) - how many OPS you'd like to run -
context
(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 whenGamegine
object gets initialized
-
If you have any suggestions for the library, write me an email (ajakubo1@gmail.com) or open new issue on github!