Skip to content
CShift0.32

Games in the browser

These are the demos of the repository, unchanged: CShift programs that open a window with GLFW and draw with OpenGL, written for the desktop. The compiler’s own WebAssembly backend (--backend wasm) translates them, and a small JavaScript runtime gives them GLFW and OpenGL in the browser (WebGL 2). Their game loop stays a plain loop: the program is suspended in glfwPollEvents until the browser shows the next frame.

Loading…

Arrow keys or WASD steer, Space starts again, Esc ends the game. Source

To run your own program like this: cshiftc build mygame --backend wasm -o program.wasm, then put it next to web/cshift.js and web/index.html of the repository and open the page through a web server. More in WebAssembly.