Basic functions for handling the gamvas environment: http://gamvas.com
Gamvas is a HTML5 game development framework/engine that simplifies the task of developing games. It keeps the developer away from the boring tasks and allows you to concentrate on the gameplay instead of spending weeks coding just to get you a useful base framework for your game.
The framework uses upper case words for classes, lowercase words for static functions. For example, see gamvas.State vs gamvas.state
While the use of static functions won’t win Gamvas a award in object oriented software design, it will in certain situations improve performance and reduce necessary amount of source code and therfor further speed up your development process.
At the moment Gamvas is more like a framework for developing games with the HTML5 canvas element and you’ll need quite a bit of JavaScript knowledge to use it, although i hope that the documentation and examples make it even possible for JavaScript beginners to get their dream game to life.
Gamvas is planned to evolve into a full game engine though with native graphical editors on Linux, Mac OSX and Windows. I want to make this system as useful as it can get for the developers, so future features depend on the requirements. Feel free to contact me with feature requests at h@93-intera ctive.com i
gamvas | Basic functions for handling the gamvas environment: http://gamvas.com |
Variables | |
baseURL | The place there the gamvas scripts live Will be filled on startup |
Functions | |
start | Starts the gamvas system |
getCanvasPosition | Get the position in DOM of the current canvas |
getCanvasDimension | Get the width and height of the canvas |
getCanvas | Get the canvas element |
getContext2D | Get the 2D context object of the canvas |
isSet | Tests if a variable is set |
hasMultiTouch | Test if device supports multi touch operations |
hasFullScreen | Test if real fullscreen more is supported |
isFullScreen | Test if we are currently running in real fullscreen mode |
setFullScreen | Set real fullscreen mode, if available |
start: function( canvasid, usePhysics, doSleep )
Starts the gamvas system
canvasID | The id of the canvas element to start gamvas on |
usePhysics | Use physics (requires box2dweb JavaScript) |
doSleep | If using physics, allow objects to ‘fall asleep’ when not active anymore |
A typical gamvas start, add a onload handler that adds your main game state and starts gamvas on the canvas with id “myCanvas” and enables physics support
gamvas.event.addOnLoad(function() { gamvas.state.addState(myState); gamvas.start('myCanvas', true); });
setFullScreen: function( yesno )
Set real fullscreen mode, if available
Real fullscreen mode as of early 2012 is not yet supported by many browsers, you should ensure to only show fullscreen switches on browsers that support it. See gamvas.hasFullScreen
yesno | A boolean, true to enter real full screen mode, false to leave |
The place there the gamvas scripts live Will be filled on startup
baseURL: ''
Starts the gamvas system
start: function( canvasid, usePhysics, doSleep )
Get the position in DOM of the current canvas
getCanvasPosition: function()
Get the width and height of the canvas
getCanvasDimension: function()
Get the canvas element
getCanvas: function()
Get the 2D context object of the canvas
getContext2D: function()
Tests if a variable is set
isSet: function( v )
Test if device supports multi touch operations
hasMultiTouch: function()
Test if real fullscreen more is supported
hasFullScreen: function()
Test if we are currently running in real fullscreen mode
isFullScreen: function()
Set real fullscreen mode, if available
setFullScreen: function( yesno )
Gets the position of a DOM element
getPosition: function( el )