A TypeScript engine for 2D browser games with zero runtime dependencies. It provides scenes, physics, sprite animation and Tiled map import.
Beta preview. APIs and workflows may change.
npm install dino-ge@beta
In a browser project with a bundler, add a container to your HTML:
<div id="game" style="width: 100%; height: 240px"></div>
Load this code from your project's JavaScript or TypeScript entry point:
import { Circle, Engine, Scene, Vector2 } from 'dino-ge';
class Clearing extends Scene {
onLoad() {
this.add(new Circle({
position: new Vector2(80, 80),
radius: 16,
colour: '#ffc46f',
}));
}
}
new Engine({
onLoad() {
Engine.currentScene = new Clearing();
},
}, { containerId: 'game', width: '100%', height: '100%' });
game.setPostProcessShader({ fragmentSource, uniforms }) adds a GLSL ES 3.00
fragment pass to the Canvas-rendered world. The shader can sample the scene
through u_scene and read the backing resolution and game time from
u_resolution and u_time. Use setPostProcessUniforms() to update custom
float or vector uniforms and setPostProcessShader(null) to disable the pass.
The Canvas world remains visible when WebGL2 cannot apply the shader. See the
HUD and effects guide for a shader
and a local demo.
MIT licence.