diff options
| author | LLLL Colonq <llll@colonq> | 2026-05-28 20:16:38 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-05-28 20:16:38 -0400 |
| commit | fa4d63110a3e12d0242b6e6ddcded74d04480f28 (patch) | |
| tree | 330e6ccfe650f1fd9143f9db67b481d4c74a2e05 /2026/examples/raylib/main.c | |
Initial commit
Diffstat (limited to '2026/examples/raylib/main.c')
| -rw-r--r-- | 2026/examples/raylib/main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/2026/examples/raylib/main.c b/2026/examples/raylib/main.c new file mode 100644 index 0000000..64091b5 --- /dev/null +++ b/2026/examples/raylib/main.c @@ -0,0 +1,33 @@ +#include <raylib.h> +#include <emscripten.h> +#include <stdio.h> +#include <stdbool.h> + +int main(int argc, char **argv) { + InitWindow(240, 160, "test game raylib mode"); + SetTargetFPS(60); + emscripten_run_script("window.parent.postMessage({op: \"ready\"});"); + bool started = false; + while (!WindowShouldClose()) { + if (!started) { + double difficulty = EM_ASM_DOUBLE({return window.lcolonqJamStart || -1.0;}); + printf("difficulty: %f\n", difficulty); + if (difficulty > 0.0) { + started = true; + emscripten_run_script("window.parent.postMessage({op: \"started\"});"); + printf("started at difficulty: %f\n", difficulty); + } + } else { + if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { + printf("clicked\n"); + emscripten_run_script("window.parent.postMessage({op: \"done\", win: true});"); + return 0; + } + BeginDrawing(); + ClearBackground(RED); + DrawText("hello gamer", 0, 0, 20, WHITE); + EndDrawing(); + } + } + return 0; +} |
