samdze / playdate-nim

Nim bindings with extra features for the Playdate SDK
66 stars 3 forks source link

Implement Std/random #22

Closed ninovanhooff closed 1 year ago

ninovanhooff commented 1 year ago

importing std/random or std/re fails. There may be more, but these are the ones I encountered so far

I'd say random is quite essential for game dev, would be great if it could be added.

nim-1.6.16/lib/pure/os.nim(63, 10) Error: OS module not ported to your operating system!

I wouldn't give the regex module any priority at the moment.

I wonder how many Std modules are OS dependent?

samdze commented 1 year ago

On it. There may be a few other modules that depend on OS implementations. In the case of std/random I believe it's the way Nim resolves its starting "random" state.

samdze commented 1 year ago

Should be fixed in v0.11.2! Use playdate.system.randomize() to set the starting seed and then use std/random as you wish!

As for std/re, that depends on a library (PCRE) that is not available on the Playdate. You can use this library instead!

ninovanhooff commented 1 year ago

Confirmed workin, thanks!