kmamal / node-sdl

🎮 SDL bindings for Node.js
https://www.npmjs.com/package/@kmamal/sdl
MIT License
121 stars 11 forks source link

is there a way can create window at thread other than the main thread? #18

Closed LmanTW closed 1 year ago

kmamal commented 1 year ago

@LmanTW Not at the moment, and sadly I have no plans to fix this. In the beginning I was hoping to make this lib support worker threads but there are some obstacles to this. The biggest one is that the SDL event loop itself does not play well with threads.

It would be best if you only ever require() and use this lib from the main thread. If you need to interact with sdl from a worker therad you should post a message to the main thread and handle it there. I will add code in future versions to enforce this.