wasm-game-sdl-canvas-arkanoid
v2.0.0
Published
A simple implementation of using Emscripten to compile C ++ in WASM with canvas animation using the arkanoid example
Maintainers
Readme
wasm-game-sdl-canvas-arkanoid
Introduction
A simple implementation of using Emscripten to compile C ++ in WASM with canvas animation using the arkanoid example.
Read more: https://rdevelab.ru/blog/web-assembly/post/wasm-game-sdl-canvas-arkanoid.
Demo: https://pages.rdevelab.ru/wasm-game-sdl-canvas-arkanoid/index.html.
Installation
Install the latest version with
$ npm i wasm-game-sdl-canvas-arkanoidVersions
The 1.x releases use SDL2 compiled through Emscripten.
The 2.x releases keep the game logic in WebAssembly and render directly with the browser Canvas API. This removes the SDL2 runtime from the browser bundle.
Install the SDL2 version with:
$ npm i wasm-game-sdl-canvas-arkanoid@1Install the Canvas renderer version with:
$ npm i wasm-game-sdl-canvas-arkanoid@2Build with Docker
Install Docker Desktop, then build the WebAssembly bundle with:
$ docker compose run --rm --build builderThe command writes build output to distr/ and copies game_arkanoid.wasm.* to public/.
Serve the demo over HTTP with:
$ docker compose up webThen open http://localhost:8080.
You can also build the reusable builder image explicitly:
$ npm run docker:imageCredits
License
The MIT License (MIT). Please see License File for more information.
