Initial commit.

This commit is contained in:
Mahlon E. Smith 2025-08-19 13:21:43 -07:00
commit eb25270d34
Signed by: mahlon
SSH key fingerprint: SHA256:dP84sRGKZRpOOiPD/+GuOq+SHSxEw9qi5BWLQobaHm0
6 changed files with 180 additions and 0 deletions

34
src/nim_wasm_test.nim Normal file
View file

@ -0,0 +1,34 @@
# vim: set et sta sw=4 ts=4 :
import std/os
import raylib
# Emscripten specific imports
proc emscripten_set_main_loop(f: proc() {.cdecl.}, a: cint, b: bool) {.importc.}
proc emscripten_sleep(a: cuint) {.importc.}
proc main() =
defer: closeWindow()
initWindow( 600, 400, "raylib nim playground" )
while not windowShouldClose():
if defined(emscripten):
emscripten_sleep 10
else:
sleep 10
main()
# when defined(emscripten):
# # Emscripten can't block so it will call this callback instead.
# emscripten_set_main_loop(main_loop, 0, true);
# else:
# # When running native code we can block in an infinite loop.
# while windowShouldClose(window) == 0:
# mainLoop()
# # If you get ESC key quit.
# if window.getKey(KEY_ESCAPE) == 1:
# window.setWindowShouldClose(1)