Simplify index wrapper, namespacing.
Experiment with function exports. Not quite working.
This commit is contained in:
parent
740211ed4c
commit
b891520ff9
5 changed files with 71 additions and 95 deletions
|
|
@ -1,6 +1,8 @@
|
|||
# vim: set et sta sw=4 ts=4 :
|
||||
|
||||
import std/os
|
||||
import
|
||||
std/os,
|
||||
std/strformat
|
||||
import raylib
|
||||
|
||||
# Emscripten specific imports
|
||||
|
|
@ -15,23 +17,37 @@ var camera = Camera(
|
|||
projection: Perspective # Defines projection type, see CameraProjection
|
||||
)
|
||||
|
||||
# This only works with:
|
||||
# --passL:"-s EXPORT_FUNCTIONS=_nativeGreet", but it breaks raylib loading.
|
||||
# hmmmmm. EXPORT_ALL=1 is also a no go.
|
||||
# Maybe it won't be necessary with raylib/opengl input
|
||||
#
|
||||
#[ proc nativeGreet*(): int {.exportc.} =
|
||||
echo "Oh jeez, hello from native nim!"
|
||||
return 0 ]#
|
||||
|
||||
|
||||
proc mainLoop() {.cdecl.} =
|
||||
defer: closeWindow()
|
||||
|
||||
initWindow( 800, 600, "raylib nim playground" )
|
||||
|
||||
var count = 0
|
||||
|
||||
while not windowShouldClose():
|
||||
|
||||
beginDrawing();
|
||||
clearBackground( RAYWHITE );
|
||||
clearBackground( WHITE );
|
||||
beginMode3D( camera );
|
||||
drawGrid( 10, 1.0f );
|
||||
endMode3D();
|
||||
|
||||
var col = if isCursorOnScreen(): BLUE else: GRAY
|
||||
drawText( "OH SNAP IT'S WORKING", 10, 10, 20, col );
|
||||
drawText( "OH SNAP IT'S WORKING\n{count}".fmt, 10, 10, 20, col );
|
||||
endDrawing();
|
||||
|
||||
count = count + 1
|
||||
|
||||
if defined( emscripten ):
|
||||
emscripten_sleep 10
|
||||
echo "wasm: hi"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue