Obscen, A simple scene manager
Overview
Obscen is intended to be an easy-to-use scene manager for the smaller projects.
There are two classes: SceneManager and Scene.
class SceneManager
Your gameloop only need to know about a scene manager, because it will handle all your scenes.
Your gameloop calls update
and draw
on the scene manager and it will pass it down to the current scene.
Obscen is agnostic against the arguments to the update
and draw
calls, so it doesn't matter if you pass down deltaTime or tick multiplier or renderingContext or whatever, the scene manager will just pass it on down to its scenes.
class Scene
The scenes consist of just one property and a few methods.
const myScene = Ob
Code
Written in ES5.
Only exports to CommonJS (as of now, AMD is planned).
Usage
const Ob = // import obscen (as Ob, because that was its intended name, which was taken) localStoragedebug = 'obscen:*' // enable debug output const splash = // create new scene - 'splash' name: 'splash' { console thissharedObjectplayerName = 'lolbert' } { console } { console } { console } const game = name: 'game' { // will print: 'game create, playerName: lolbert' console } { console } { console } { console } const sceneManager = // the setScenes call will add a wrapped changeScene method to all scenes, before this .changeScene does not worksceneManager sceneManager // of course update and draw will be done in your gameloopsceneManagersceneManagersceneManagersceneManager splash // of course update and draw will be done in your gameloopsceneManagersceneManagersceneManagersceneManager game
Debugging
Obscen uses debug and follows its conventions.
localStoragedebug = 'obscen:*'
Dependencies
Contributing
Please feel free to put up PR's, this is very infant and hobbyish still so don't be mad if it might take a while to get a reply.
To do
- Add tests (prolly mocha-chai)
- Add AMD export