From 35e4160e642f91dfb6a1b46b812dbead6380ea55 Mon Sep 17 00:00:00 2001 From: Lam Wei Lun Date: Sun, 18 Jan 2026 09:35:22 +0800 Subject: Added a minimal raylib game example to demonstrate compilation with emscripten. Update README.md --- examples/games/raylib_emscripten.zc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/games/raylib_emscripten.zc (limited to 'examples/games') 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); + } +} -- cgit v1.2.3