-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[core] Support BORDERLESS_WINDOWED_MODE
for non-exclusive fullscreen
#3207
Comments
@raysan5 Lets say the monitor size is
Also, lets say the monitor has an aspect ratio of
|
@ubkp Those are the key questions! No simple answer:
I think the best approach for now is the first one. |
@raysan5 Would it be acceptable that, instead of a I can see scenarios where all four combinations could be necessary depending on the program/game being made and/or user preference. |
@ubkp But in those cases we are moving to the complex solution and users would expect raylib to manage internally the scaling and aspect ratio properly. I prefer to just scale the current framebuffer to current monitor resolution + borderless + topmost window and leave the scaling and aspect ratio management to user, similar to the |
@raysan5 Okay. I should have a PR ready during the weekend. |
@raysan5 Sorry the delay. I finished implementing |
@raysan5 Regarding scaling mechanisms, is there any specific reason to use
|
@ubkp Several reasons, mostly design reasons:
|
@raysan5 Got it! Thank you very much for the explanation. |
Following conversation from closed issue #3198
Fullscreen mechanism does not work as expected in some cases.
raylib provides several mechanisms to toggle a fullscreen exclusive mode:
SetWindowState(FLAG_FULLSCREEN_MODE)
to be called afterInitWindow()
, it actually setups the flag and calls the following function.ToggleFullscreen()
to be called afterInitWindow()
, it also setups the flag internally.In both cases an exclusive fullscreen mode is requested, it means that the program tries to request the display to switch display-resolution to fit screen required resolution (the one provided to
InitWindow()
or the current screen/framebuffer resolution).That resolution switch could be successful or not, depending on the display capabilities. raylib tries to obtain from display the closer resolution fitting the curren screen resolution, unfortunately, that's not always possible becaude depending on the monitor capabilities (like aspect ratio) only some resolutions are valid. For example, using a 800x450 screen resolution (16:9), when switching to exclusive fullscreen, some displays will accept it an others will switch to 800x600, giving unexpected results.
Nowadays, many games support what is called a borderless windowed fullscreen non-exclusive mode. It means, a window is created with the same size as the monitor current resolution and then the window-border is removed, giving the impression it's a fullscreen mode but actually just being another window over the other windows of the OS. The problem with that approach is that managing it adds an extra level of complexity that, maybe, should be managed by the user (instead of raylib).
When switching to borderless window mode, the display does not change resolution, it's the application that change screen size (framebuffer size) to match current monitor resolution, it has many implications: aspect-ratio, drawing, inputs, gameplay logic, physics... Consequently, the best approach is keeping a "logic/game resolution" (the resolution used for the game logic and render) and then scale that "screen" into the resolution of the full monitor ("output? resolution"). An example of that approach (but inside a window) is provided in raylib example core_window_letterbox. Note that screen-dependant inputs
(mouse/touch) must be scaled from the "output resolution" to the "game resolution".
Some possible references:
SDL_RenderSetLogicalSize()
SDL_SetWindowFullscreen()
Still, thinking that maybe a
BORDERLESS_WINDOWED_MODE
should be managed from user side... but an example could be provided.The text was updated successfully, but these errors were encountered: