Closed darltrash closed 3 years ago
I suspect that the fromPNGPath()
function (and thus sg.makeImage()) is called before sokol-gfx has been initialized via sg.setup()
(at least that's what I gather from the assert message, and looking at this code: https://github.com/darltrash/scrumptious/blob/ffa1228dd4dd11311a6bce7dc6d9dcef35ecce33/src/game.zig#L10-L26
This call is missing basically:
No need to apologize btw ;)
...I guess this is the culprit:
setState()
is called before the sokol-app init() callback (which is called from inside sapp.run()
), and setState()
calls game.init()
.
If you move that setState() call somewhere around here:
(after the sg.setup() call), it should work.
(after the sg.setup() call), it should work.
It works! Thanks for the time you took to inspect the code! I guess this "issue" is now closed, It was a pleasure to work with Sokol and your Sokol-zig bindings, I hope this project grows a lot because it really seems very promising :)
Hello! My name is Neil and it's my first time using Sokol, Zig and "low level"-ish stuff in general.
I was working on my game/engine and I realized something, while sg.makeImage() worked inside the sokol callbacks (src/main.zig), it didnt work on other files (src/game.zig) that were accessing functions/methods/whatever (Texture.fromPNGPath) from where the callbacks were stored (src/main.zig).
OS: Void Linux + Musl libc Arch: x86_64 Zig version: 0.7.1
Full error message:
If this is my fault, please let me know. I apologize beforehand.