Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Porting an asteroids game from C to WebAssembly

License

Notifications You must be signed in to change notification settings

robertaboukhalil/wasm-asteroids

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Asteroids

This is a WebAssembly port of an Asteroids game written in C:

Live Demo | WebAssembly Tutorial

Screenshot of asteroids game

If you're looking for a practical guide to learning WebAssembly, check out my book Level up with WebAssembly.

Build

Fetch Emscripten from DockerHub:

docker pull robertaboukhalil/emsdk:1.38.26

Create a container from that image:

# Create container from that image
docker run -dt --name wasm robertaboukhalil/emsdk:1.38.26

# Enter the container
docker exec -it wasm bash

Within the container, fetch the code:

git clone "https://github.com/robertaboukhalil/wasm-asteroids.git"
cd wasm-asteroids

And compile it to WebAssembly:

emcc \
    -o app.html asteroids/*.c \
    -Wall -g -lm \
    -s USE_SDL=2

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%