diff --git a/playdate.nimble b/playdate.nimble index 5564bef..42215b6 100644 --- a/playdate.nimble +++ b/playdate.nimble @@ -1,6 +1,6 @@ # Package -version = "0.11.0" +version = "0.11.2" author = "Samuele Zolfanelli" description = "Playdate Nim bindings with extra features." license = "MIT" diff --git a/src/playdate/bindings/lua.nim b/src/playdate/bindings/lua.nim index 4355421..2deefd2 100644 --- a/src/playdate/bindings/lua.nim +++ b/src/playdate/bindings/lua.nim @@ -4,7 +4,7 @@ import sprite {.all.} import types type - LuaStatePtr* = pointer + LuaStatePtr* {.importc: "lua_State*".} = object LuaNimFunction* = proc (L: LuaStatePtr): cint {.cdecl, raises: [].} LuaUDObject* {.importc: "LuaUDObject", header: "pd_api.h", bycopy.} = object diff --git a/src/playdate/build/config.nim b/src/playdate/build/config.nim index 679056b..865513a 100644 --- a/src/playdate/build/config.nim +++ b/src/playdate/build/config.nim @@ -17,7 +17,6 @@ if not testing: switch("noMain", "on") switch("backend", "c") switch("mm", "arc") -switch("os", "any") switch("parallelBuild", "0") # Auto-detect switch("hint", "CC:on") @@ -36,6 +35,7 @@ switch("passC", "-Wdouble-promotion") switch("passC", "-I" & sdkPath() / "C_API") when defined(device): + switch("os", "any") switch("gcc.options.always", "") switch("nimcache", nimcacheDir() / "device") @@ -47,6 +47,7 @@ when defined(device): switch("assertions", "off") switch("hotCodeReloading", "off") switch("define", "useMalloc") + switch("define", "standalone") let heapSize = 8388208 let stackSize = 61800 diff --git a/src/playdate/lua.nim b/src/playdate/lua.nim index 332cb3f..e3ec831 100644 --- a/src/playdate/lua.nim +++ b/src/playdate/lua.nim @@ -119,5 +119,4 @@ proc callFunction*(this: ptr PlaydateLua, name: string, argsCount: int = 0) {.ra var err: ConstChar = nil var success = this.callFunction(name.cstring, argsCount.cint, addr(err)) if success == 0: - playdate.system.logToConsole(err) raise newException(LuaError, $err) \ No newline at end of file diff --git a/src/playdate/system.nim b/src/playdate/system.nim index a4789e9..8eb3ecb 100644 --- a/src/playdate/system.nim +++ b/src/playdate/system.nim @@ -189,4 +189,10 @@ proc removeAllMenuItems*(this: ptr PlaydateSys) = proc getReduceFlashing* (this: ptr PlaydateSys): bool = privateAccess(PlaydateSys) - return this.getReduceFlashing() == 1 \ No newline at end of file + return this.getReduceFlashing() == 1 + + +import std/random + +proc randomize*(this: ptr PlaydateSys) = + randomize(this.getSecondsSinceEpoch().milliseconds.int64) \ No newline at end of file