Initial commit.
This commit is contained in:
commit
eb25270d34
6 changed files with 180 additions and 0 deletions
34
src/nim_wasm_test.nim
Normal file
34
src/nim_wasm_test.nim
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue