Skip to content
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

Live ingame full-screen switching #149

Open
davidjoffe opened this issue Nov 20, 2022 · 2 comments
Open

Live ingame full-screen switching #149

davidjoffe opened this issue Nov 20, 2022 · 2 comments

Comments

@davidjoffe
Copy link
Owner

I started adding possible ability to do live in-game fullscreen switching and did some refactoring to that end - try enable new config option to try it out:
djEXPERIMENTAL_FULLSCREEN_TOGGLE
Then either press Ctrl+Shift+F in-game (or Esc and use ingame menu) - later we can extend these and make it everywhere. And/or make the shortcut configurable (not sure I like it).

But it's still crashy, I think some issues relating to window cleanup .. hopefully can be sorted soon

NB this is closely related to issue #123 where I have other detailed thoughts

I suspect in some (say) console ports, port maintainers might want to e.g. do things like 'force fullscreen always' and stuff like that - so I may add a few more config options (some to possibly be passed in to the compiler and/or via Makefile e.g. maybe could have something like "-DdjFORCE_FULLSCREEN_ALWAYS" or stuff like that in future - I don't know, I'm thinking something like that - to allow e.g. a port maintainer to configure their Makefiles etc. to do things like that.

(Related: Same e.g. some consoles might not have a mouse, but if you have a mouse it might be nice to be able to use it in menus - but not ingame of course)

(Small Question to self: On fullscreen toggle I'm cleaning and recreating the 'hardware surfaces' as this is necessary or used to be necessary on some platforms when you switch between fullscreen and windowed as hardware surfaces could get lost but I'm not sujre whether that's an issue here or not in SDL2 as we're using it, so for now I'm doing it just in case (i.e. the hardware surfaces or "texture cache" one might one call it that get created corresponding to in-system-memory djImage instances of image data for sprites etc.) ... so doing it just in case on fullscreen toggle but not 100% sure if necessary but we can work that out later - it shouldn't cause any harm to do it just in case, for now I think better an unnecessary recreate of hardware surfaces than crashing or missing textures on some platforms if they may be getting lost in GPU memory or something on switching)

@davidjoffe
Copy link
Owner Author

Hm the sdl_createwindow probably just needs a corresponding call to sdl_destroywindow in the right place (and maybe the associated renderer etc. for main window), plus testing.

@davidjoffe
Copy link
Owner Author

I committed what I think is a fix for ingame fullscreen toggle:
It stores a pointer now to the created main window and calls SDL_DestroyWindow and that seems to fix it for me (tested briefly on Mac, Windows, and Linux)

and I started adding a djDEV_STRESSTESTS development-only config option to enable a stress-tester for the ingame fullscreen toggle to help automate testing this that when enabled (a bit crude/gross for now) just toggles fullscreen every few seconds (obviously this config option NOT for live production release builds - dev only)

Please test more if you can

@davidjoffe davidjoffe removed the bug label Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant