summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLam Wei Lun <weilun.lam@gmail.com>2026-01-18 09:35:22 +0800
committerLam Wei Lun <weilun.lam@gmail.com>2026-01-18 09:35:22 +0800
commit35e4160e642f91dfb6a1b46b812dbead6380ea55 (patch)
tree2f400c8685beaad23bde7ff7de8f837f54128a11 /examples
parentefb6cda22ec9ca124c22b40d1b0049c3992bbf32 (diff)
Added a minimal raylib game example to demonstrate compilation with emscripten. Update README.md
Diffstat (limited to 'examples')
-rw-r--r--examples/games/raylib_emscripten.zc32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/games/raylib_emscripten.zc b/examples/games/raylib_emscripten.zc
new file mode 100644
index 0000000..bbdf907
--- /dev/null
+++ b/examples/games/raylib_emscripten.zc
@@ -0,0 +1,32 @@
+// This example demonstrates a minimal raylib example that is compilable with Emscripten.
+
+// Pre-requisites:
+// Setup emscripten from here: https://emscripten.org/docs/getting_started/downloads.html
+// Compile raylib for web following this guide: https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)
+
+// Build instructions:
+// zc build raylib_emscripten.zc --cc emcc -o game.html
+
+// NOTE: Modify these lines as you see fit, pointing to where your web build of raylib is installed
+//> include: ./raylib/include
+//> libs: ./raylib
+//> link: ./raylib/libraylib.a
+
+// DO NOT modify this line
+//> link: -s ASYNCIFY -s ASSERTIONS -s USE_GLFW=3 -s WASM=1 -s GL_ENABLE_GET_PROC_ADDRESS=1
+
+import "raylib.h"
+
+fn main() {
+ InitWindow(1280, 720, "Hello Zen-C");
+ defer CloseWindow();
+
+ while (!WindowShouldClose()) {
+ BeginDrawing();
+ defer EndDrawing();
+
+ ClearBackground(BLACK);
+
+ DrawText("Hello Zen-C", 10, 10, 20, WHITE);
+ }
+}