laamaa / m8c

Cross-platform M8 tracker headless client
Other
420 stars 87 forks source link

Resizing window / toggling fullscreen results in a blank window in Win64 #14

Closed laamaa closed 2 years ago

laamaa commented 3 years ago

image

SDL seems to forget what was on the screen when window is resized in Windows

laamaa commented 3 years ago

Currently a workaround exists by manually reseting display with "r" key. There should be some kind of automatic resize detection system though that would send a reset packet

JeffAlyanak commented 3 years ago

@laamaa I could probably put together a quick fix for this by handling the SDL_ResizeEvent and just triggering a reset.

laamaa commented 3 years ago

If something as simple as that could work, please go ahead!

On Wed 13. Oct 2021 at 21.07, Jeff Alyanak @.***> wrote:

@laamaa https://github.com/laamaa I could probably put together a quick fix for this by handling the SDL_ResizeEvent and just triggering a reset.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/laamaa/m8c/issues/14#issuecomment-942581039, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNUYFQRVG262MUZLWTYNCDUGXDEPANCNFSM465FTM2Q .

laamaa commented 2 years ago

possible fix https://github.com/laamaa/m8c/tree/win64_window_resize_fix, would need testing

thulard commented 2 years ago

Hi @laamaa , I was able to build the win64_window_resize_fix branch on my Windows 10 64 machine and I'm afraid is issue is still there. The issue occur only when you go fullscreen. Resizing the windows (and even maximizing it) doesn't cause any problem with both version.

thulard commented 2 years ago

I got it working by updating the toogle_screen function in render.c. I'm using "Fake fullscreen" flag on SDL_SetWindowFullscreen, this will avoid the screen resolution to change and just change the window size and remove windows decoration.

I new to Github but I created a fork with the fix with the fix: https://github.com/thulard/m8c/commit/356b7704076cebeda832afd3337a0899d59c7726

Hope this is helpful.