Using WebGL2 and Typescript. Work in progress!
-
2D Renderer:
src/engine/renderer.tsProvides functions to draw shapes, textures and switch shaders to apply custom effects (black and white, etc.). Batches draw calls for efficiency. No OpenGL knowledge needed, just call functions likedrawCircle(0, 0, 20)ordrawTex(texture). -
Audio:
src/engine/audio.tsModeled after the Monkey-X/Blitz-Basic API to allow playing sounds and stream music. Supports 32 fixed channels for sounds and 1 music-stream. For simple playback you can simply call:Audio.playSound("/sounds/my_sound.wav")&Audio.playMusic("/music/my_music.ogg"). See thetest.tsfor more detailed usage. -
Other features:
- Scenes
- Tilemap loading
- Simple input system to get mouse and keyboard state
- Render Metrics: cpuFrameTime, gpuFrameTime, drawCalls, triangleCount
src/game/scenes/test.ts: Test Scene that shows basic rendering, audio playback & fading and the polling input system.src/game/scenes/tilemap.ts: Uses a custom light shader that uses normal mapping to simulate light that interacts with the enironment (see gif below). Doesn't look right yet, as the normal-map itself isn't correct.
- Install dependencies:
yarn - Run example:
yarn dev(this will run a local dev server with vite) - Open
http://localhost:3003/
