ftsf / nico

a Game Framework in Nim inspired by Pico-8.
MIT License
630 stars 36 forks source link

Taking screenshot crashes #61

Open jorisbontje opened 3 years ago

jorisbontje commented 3 years ago

With nico 0.3.2 on OSX, when taking a screenshot with F10 the nico apps crashes. This happens for nico examples (paintout, gui, vertex, etc) as well for my own games.

Traceback (most recent call last)
/Users/username/Projects/nico/nico/examples/paintout.nim(161) paintout
/Users/username/Projects/nico/nico/nico.nim(2942) run
/Users/username/Projects/nico/nico/nico/backends/sdl2.nim(1662) run
/Users/username/Projects/nico/nico/nico/backends/sdl2.nim(1209) step
/Users/username/Projects/nico/nico/nico/backends/sdl2.nim(1197) checkInput
/Users/username/Projects/nico/nico/nico/backends/sdl2.nim(1104) appHandleEvent
/Users/username/Projects/nico/nico/nico/backends/sdl2.nim(742) saveScreenshot
/Users/username/Projects/nico/nico/nico/ringbuffer.nim(42) []
/Users/username/Projects/nico/nico/nico/ringbuffer.nim(37) idx
SIGFPE: Arithmetic error.
jorisbontje commented 3 years ago

recordFrames seems to depend on gif to be defined... but when doing that, the saveScreenshot function seems to be missing an actual implementation: https://github.com/ftsf/nico/blob/master/nico/backends/sdl2.nim#L740-L747

ftsf commented 3 years ago

ahh, if you compile with -d:gif it will be included, but yes, will need to fix this from crashing, thanks for the report