Replies: 4 comments 2 replies
-
To note, I am aware that there are several PRs that have been submitted in the past with changes to these APIs. I feel that they have not been accepted simply because we have not agreed upon the expected operation of these functions, and got hung up on breaking behavior. |
Beta Was this translation helpful? Give feedback.
-
Agree with every point. I would also add monitor refresh rate to SetMonitorResolution and some way to get all supported monitor modes. |
Beta Was this translation helpful? Give feedback.
-
One thing that it maybe consider is what some other engine are doing and is just dropping exclusive full-screen to be only borderless. For example, ebiten an OpenGL golang engine, that as well runs in all desktops, mobile & web, only have borderless when switching to full-screen: https://pkg.go.dev/github.com/hajimehoshi/ebiten/v2#SetFullscreen Bgfx does not support exclusive full-screen is only borderless: Beby a rust game engine consider exclusive full-screen as legacy: https://docs.rs/bevy/latest/bevy/window/enum.WindowMode.html#variant.BorderlessFullscreen And the reason why is mainly because modern graphics API are just well optimize in Windowed. https://devblogs.microsoft.com/directx/demystifying-full-screen-optimizations/ For that reason, some games such World of Warcraft they don't have any more and exclusive mode. And to be 100 honest, gamers nowadays is not that they want to check discord while playing, is just they have Spotify or YouTube in another window, or some twitch stream or so on, in fact the amount of people that have more than one screen right now is increasing large. But we, programmers, believe that exclusive full-screen is the way to go because performance, when really is not like that any more, and all arguments in the top topic in the discussion show how modern games play the games in the same reolution and refresh rate that they desktop. |
Beta Was this translation helpful? Give feedback.
-
One important aspect is that when Fullscreen mode is on, then the OS keys should be disabled. As for example if you press Win+E (or Ctrl+Shift+Esc) there should not be any background action happening. When you press Ctrl+Alt+Delete then is good idea to interrupt the TOPMOST state so the task manager pops up. There should be a dozen of use cases in other OS's as well about how this new fullscreen mode should behave as expected based from the classic fullscreen mode. |
Beta Was this translation helpful? Give feedback.
-
Currently there is a big problem/confusion with the fullscreen API in raylib. The current API is not functional in an useable way and leads to frustrations. Much of what the current fullscreen API is rooted in older systems that were designed to work with CRT displays. This functionality is outdated on current displays and causes much more harm than any real benefit.
I feel that we should redo this API so that it is simple and easy to understand for current users. This may break some small functionality that I don’t feel is really ever used and that also has other (better) ways to implement.
This post is intended to start the discussion about how we can clean up this API to make it not confusing and easy to use like the rest of the raylib API. The goal of this post is to have an agreed upon design before any code or PRs are submited.
I would like to start by defining our terms and agreeing on what the behavior for each thing is. After that I would like to define a series of use cases for fullscreen modes, and then finally propose an API that would implement this. After that is all agreed upon, we can focus on getting the code to work with the design.
Terms
Fullscreen
A window that has no decoration and takes up the full pixel resolution of the desired display. The window runs at the display's current resolution. By default this should be the display’s native pixel resolution. If the system has multiple displays, clicking outside the display will not loose focus on the window. Alt+tab out of the application will minimize the window and return to the rest of the OS windows. Refocusing the application will restore the full screen window.
Borderless Window
A windows that has no decoration and takes up the full pixel resolution of the desired display. . The window runs at the display's current resolution. By default this should be the display’s native pixel resolution. This window differs from a fullscreen window in that it is not mutually exclusive with other displays. Other displays will continue to display content, and clicking on windows in them will change focus to the other application. The borderless window will not minimize when it loses focus. The window will cover any taskbar elements in the OS.
Maximized
A window that is decorated and expanded to fit the full usable area of its monitor. This window will not cover the taskbar elements in the OS and will behave like a normal window in all other respects
Topmost
An additional property that can be applied to a window that forces it to be on top of all other OS windows.
Change Resolution
The act of changing the physical display resolution of a monitor. This used to be a common thing to do in order to increase performance by reducing the number of pixels to render. This was acceptable because CRT monitors could adapt to wide ranges of resolutions. WIth the advent of fixed pixel displays (flat panel/lcd/oled/etc..) this is no longer a good idea. While systems can change the resolution of the data that is sent to the display, this requires the display hardware to upscale the signal to fit the display's physical pixels, and has serious quality implications. For this reason resolution changes are not common anymore, and other methods of reducing render size are available.
Use Cases
These are some use cases that people commonly have
I want a fullscreen game
The user wants to toggle to a fullscreen mode where the game is the only thing shown, filling the display. This is very traditional for many games. They want to toggle back and forth between this mode and a windowed mode, keeping the last windowed size when restored back to a windowed mode.
I want a fullscreen game, but I want to check discord
The user wants to toggle to a fullscreen borderless window mode where the game fills the display, but the user can still see and interact with applications on other displays. This is very common for modern games. They want to toggle back and forth between this mode and a windowed mode, keeping the last windowed size when restored back to a windowed mode.
I want to reduce my render resolution for speed
My game runs on a potato and I need to render less for speed.
API
This is proposed changes to existing APIs as well as new APIs.
ToggleFullscreen
This function would be changed to no change resolutions as it does now.
If the current window is not fullscreen it would simply expand the window size to fit the current display and toggle the fullscreen mode. The previous windowed size/position would be saved into raylib state data.
If the current window is full screen it would be resized to the previously saved size and the fullscreen mode in the platform canceled. This will be a breaking change in that the function will not change resolutions. This is minimized by the fact that this current behavior is NOT desired by most people and nearly everyone resizes the window to the display size before calling this in existing code, thus the behavior for those games will stay the same. If a user wishes to truly change resolution for performance, they would call SetMonitorResolution(see below), or user a render texture at a lower resolution. The main cause of confusion with this function right now is that it changes resolution and that is not an expected behavior, so it should be removed.
ToggleBorderlessWindow
Currently this function does not cover the taskbar. It needs to be changed to do so on all platforms. This function should have the same save/restore of window size/position that fullscreen does.
MaximizeWindow
Grows the window to fit the display, showing the taskbar.
MinimizeWindow
Iconify the window
SetMonitorResolution(int monitor, int width, int height) [NEW API]
Changes the specified monitor resolution to the nearest supported resolution that is specified. Should be combined with
ToggleFullscreen
but that would be up to the user.Use Case Solutions using API
These are how this new API would handle the various use cases above.
I want a fullscreen game
Call ToggleFullscreen(), that’s it. Simple API just works as expected.
I want a fullscreen game, but I want to check discord
Call ToggleBorderlessWIndow(), that’s it. Simple API just works as expected.
I want to reduce my render resolution for speed
Load a render texture at the resolution you want to draw at, draw that texture to your screen. This is how modern games handle this case, as it allows the GPU to do the scaling, not the monitor’s display hardware.
Beta Was this translation helpful? Give feedback.
All reactions