-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about window resize in SDL #43
Comments
It looks like this is a problem with Windows itself: libsdl-org/SDL#1059 There are two solutions proposed in that thread. One (main callbacks) is only available in SDL3 which I'm not ready to switch to yet. The other (event watchers) would involve synchronizing threads, so the implementation could get non-trivial. I will try to add this but it could take some time. |
@kmamal TY for the reply! I'm currently on a Macbook M2 Pro. The default behavior is that the render is stretched, I can re-render on the resize event and that cleans things up, but it's a bit jarring. I looked a bit at some related issues, this thread seems to have varying opinions about a resolution: |
Ah, I will have to do some more digging then. |
I just confirmed that the thread gets blocked on resize on mac, I did a setInterval with a counter and it stopped on resize. The problem may be harder to solve :X |
The reply here claims that But then a following reply says: ` To workaround this, you can setup a callback in your event watcher: |
Getting the event on another thread won't help if the main thread is stuck. I was looking more into the callback approach of SDL3: libsdl-org/SDL#8247 but I don't think this will play well with nodejs since we lose control of the main thread. |
I see there is a patch on the thread, does that mean that SDL binary could be switched out with the one with the patch? |
Yeah we could patch sdl, but there are problems with that patch discussed later in the thread. I need to do some experimenting to see what is possible. |
I think the SDL_AddEventWatch approach can work. It will require a major rewrite of the C++ code but I've been meaning to do that for some time now. Please bear with me :D |
@kmamal Thank you so much, I'll be patient :) Let me know if I can help in anyway with parts of this project. |
This is a bug in SDL, not Windows. Every other program on Windows can render during resize, it's only SDL that has a problem with this. |
@clseibold Yeah I assumed it was SDL specific because I get the same thing on macos. |
Hey @kmamal! Let me know if I can attempt to contribute somehow! I've worked a bit with nodeapi bindings but probably need some direction / but would love to help get some small issues taken care of! |
Thanks for offering! The code itself is done, but I'm also trying to write as many tests as I can to make sure I didn't break anything during the rewrite. Shouldn't be much longer now :) |
@notchris check version |
You're the best! @kmamal Going to check this out shortly |
Nicely done, it's working on my end! Screen.Recording.2024-02-07.at.6.05.01.PM.mov |
Perfect! Closing the issue then :) |
Awesome library! I was wondering if there is a way to get the event of a window resize during the resize. Currently I notice it only emits on resize complete.
Thanks!
The text was updated successfully, but these errors were encountered: