diff options
| author | LLLL Colonq <llll@colonq> | 2026-06-18 16:15:46 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-06-18 16:15:46 -0400 |
| commit | c9fc2ca532c5219a087924ece1e38be19c25f006 (patch) | |
| tree | 7c9d8e32617fab6e6179fe70893a3027714ea4e7 /2026/examples/example_raylib/main.c | |
| parent | 068f3b9dc0522b03af534479cfa300a720ae86fa (diff) | |
Update
Diffstat (limited to '2026/examples/example_raylib/main.c')
| -rw-r--r-- | 2026/examples/example_raylib/main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/2026/examples/example_raylib/main.c b/2026/examples/example_raylib/main.c new file mode 100644 index 0000000..da9383a --- /dev/null +++ b/2026/examples/example_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: false});"); + started = false; + } + BeginDrawing(); + ClearBackground(RED); + DrawText("hello gamer", 0, 0, 20, WHITE); + EndDrawing(); + } + } + return 0; +} |
