Commit Graph
212 Commits
Author SHA1 Message Date
Cameron Cawley 40f797fdef SDL: Support VSync with OpenGL in SDL1 builds 2023-01-16 18:09:53 +01:00
Cameron Cawley 138a983d80 COMMON: Refactor VSync handling to match the other options 2023-01-16 18:09:53 +01:00
Le Philousophe 06c38bbf3f OPENGLSDL: Redraw screen when receiving an expose event
Without this, the window is not refreshed when it is recovered or
minimized and restored.
2022-10-30 12:34:23 +01:00
Cameron Cawley 347870e6ea OPENGLSDL: Remove _ignoreLoadVideoMode
It doesn't work properly with shaders.
2022-10-08 23:39:18 +02:00
Le Philousophe cecd5b3385 SDL: OPENGL: Remove useless #if guard
The code was already guarded by the same condition
2022-08-25 17:57:38 +02:00
Carlo Bramini bdd2fb61d1 BACKENDS: OPENGLSDL: Fix corrupted graphics.
Size of the alpha channel is not set to its default value and this caused totally corrupted graphics on my PC.
See:
https://bugs.scummvm.org/ticket/13712
2022-08-12 00:30:05 +03:00
Le Philousophe 4ab044a254 OPENGL: Merge both OpenGL contexts 2022-06-26 18:32:10 +02:00
Cameron Cawley a14c5a4a53 SDL: Replace gfx_mode with scale_factor in initSizeHint() 2022-01-16 13:22:37 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh 44219dfa1a BACKENDS: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Orgad Shaneh b11c5ace90 BACKENDS: JANITORIAL: Remove 'virtual' when override is specified 2021-11-14 14:31:41 +02:00
Vanfanel 5873dfad7c SDL: Add missing getFeatureState() case for VSYNC. 2021-10-23 20:53:22 +01:00
Vanfanel 046b48f90d SDL: Add OSystem::kFeatureVSync to SDL surface and OpenGL graphics. 2021-10-23 20:53:22 +01:00
Vanfanel 3a59c28179 SDL: Generalize VSYNC option so it works for 2D games too, in both SDL surface and opengl graphic modes. 2021-10-23 20:53:22 +01:00
Thierry Crozat 594a81f93c OPENGLSDL: Fix restoring window size when exiting fullscreen
When entering fullscreen it was storing the default window size
in the config, which was overwriting the current window size. As
a result when exiting window size, instead of restoring to the
previous window size it was restoring to the default window size.
2021-10-11 02:59:01 +03:00
Thierry Crozat 45a803c71c OPENGLSDL: Fix always restoring window to maximized size when exiting fullscreen
When loadVideoMode gets called to exit fullscreen, the window is
still fullscreen, which means that the SDL_WINDOW_MAXIMIZED is set
(at least on macOS). As a result the window was resized to the
stored maximized window size instead of the size it had before
entering fullscreen.
2021-10-11 02:59:01 +03:00
Thierry Crozat 1962e543fd JANITORIAL: Rename variable to follow code formatting conventions 2021-10-02 21:50:28 +01:00
Thierry Crozat 8d972b338d OPENGLSDL: Properly check for fullscreen state
The OpenGLSDLGraphicsManager was changed in bb15133a0a to use
SDL_WINDOW_FULLSCREEN_DESKTOP instead of SDL_WINDOW_FULLSCREEN.
But getFeatureState(kFeatureFullscreenMode) was still checking
the SDL_WINDOW_FULLSCREEN flag. This worked because in current
SDL2 versions SDL_WINDOW_FULLSCREEN_DESKTOP is defined as
SDL_WINDOW_FULLSCREEN | 0x00001000, but this is not documented
and could change in future SDL versions.
2021-10-02 18:59:44 +01:00
Lothar Serra Mari d6f105e906 BACKENDS: OPENGLSDL: Only relocate the window to the center of the screen if truly necessary 2021-08-28 10:43:04 +02:00
Lothar Serra Mari 1b42675e52 BACKENDS: OPENGLSDL: Limit window positioning workaround to Win32
It looks like other platforms are not affected by this, at least I
wasn't able to reproduce the issue on Linux in any way.

Since branching off to the next release is very soon and we are running
out of time, I'm limiting this to Win32 in order to avoid unneccessary
breakage by only fixing _really_ affected platforms.
2021-08-28 10:43:04 +02:00
Lothar Serra Mari 4c7bc5effb BACKENDS: OPENGLSDL: Do not try to center window in fullscreen or maximized mode 2021-08-28 10:43:04 +02:00
Lothar Serra Mari 1b6c4f48aa BACKENDS: OPENGLSDL: Forcefully center the window to prevent off-screen rendering 2021-08-28 10:43:04 +02:00
Lothar Serra Mari cedd57a4ac BACKENDS: OPENGLSDL: Fix wrong check for maximized windows 2021-08-28 10:43:04 +02:00
Lothar Serra Mari 3da65d47cb BACKENDS: OPENGLSDL: Prevent window resizing events in fullscreen mode 2021-08-28 10:43:04 +02:00
Lothar Serra Mari d07c97f3cd BACKENDS: OPENGLSDL: Remember maximized window state 2021-08-28 10:43:04 +02:00
Thierry Crozat dc7a09fdd1 SDL: Cleanup HiDPI macOS hacks
The SDL library handles HiDPI differently depending on the system.
On some systems, such as macOS, the drawable area and the SDL window
have a different size (the window is on low-dpi size) while on
other systems such as Windows they have the same size. Because of
that we sometimes need to scale sizes or coordinates between the
two, and sometimes we don't.

This was handled in two different ways. This commit change the code
to handle it consistently everywhere, and also should be more future
proof should SDL change the way it handles HiDPI in the future (as
we now query the size from SDL itself to find out if the scaling is
needed).
2021-08-20 22:10:26 +02:00
athrxx 95f1b010f8 SDL: avoid assert with SDL debug builds 2021-08-15 16:18:16 +02:00
Lothar Serra Mari 900d763264 BACKENDS: OPENGLSDL: Enlarge window if stored dimensions are not sufficient 2021-08-15 13:58:48 +01:00
Lothar Serra Mari 1aaab76b44 BACKENDS: OPENGLSDL: Fix aspect ratio on auto-calculated window sizes 2021-08-15 13:58:48 +01:00
Lothar Serra Mari 51cff582b5 BACKENDS: OPENGLSDL: Disable storing and restoring window sizes for SDL1
The previous implementation was already broken, since the values were never stored in the config file
since that part was already guarded by SDL_VERSION_ATLEAST.

Since we have no way to properly determine if a window is maximized or not for
SDL1, I recommend skipping this part in the compilation.

Now, the function at least works properly for SDL2 - it was broken on _both_ versions before.
2021-08-15 13:58:48 +01:00
Lothar Serra Mari 8a8557e94d BACKENDS: OPENGLSDL: Fix logic errors in window size management 2021-08-15 13:58:48 +01:00
Cameron Cawley c4699cb280 SDL: Move getDisplayDpiFromSdl and getDpiScalingFactor into the SdlWindow class 2021-08-14 19:09:33 +01:00
Thierry Crozat 4d59d40f32 OPENGLSDL: Fix compilation with SDL1 2021-08-14 03:25:43 +01:00
Thierry Crozat c9682dfbcf OPENGLSDL: Fix changing scaler with hotkey in games
Also improve decreasing the scaler when using a custom window size.
2021-08-13 23:58:34 +01:00
Thierry Crozat 5caacb763b SDL: Change signature of getDpiScalingFactor to return the result 2021-08-13 21:41:33 +01:00
Thierry Crozat abf782c670 COMMON: Remove kFeatureHiDPI from OSystem and use getHiDPIScreenFactor instead 2021-08-13 21:41:33 +01:00
Thierry Crozat 63dd44a81d SDL: Implement getHiDPIScreenFactor 2021-08-13 21:41:33 +01:00
Lothar Serra Mari aae99da842 BACKENDS: OPENGLSDL: Save detected window dimensions to the config file
This prevents undefined behavior if no window dimensions are present in
the ScummVM config file from previous runs.
2021-07-30 20:47:53 +02:00
Thierry Crozat 2a410768ad OPENGLSDL: Fix increasing/decreasing the window size on macOS 2021-07-16 13:20:38 +01:00
Thierry Crozat c1a2d5ba1b OPENGLSDL: Remove getting the supported screen resolutions for SDL2
Since we use the SDL_WINDOW_FULLSCREEN_DESKTOP with SDL2, we always
use the desktop resolution in fullscreen mode anyway. Cycling
through other resolutions did nothing and was confusing.
2021-07-16 13:20:38 +01:00
Lothar Serra Mari f4eb3a63b8 BACKENDS: OPENGLSDL: Improve auto-handling of window sizes 2021-06-13 07:50:43 +02:00
Lothar Serra Mari e2d417e785 BACKENDS: OPENGLSDL: Fix division by zero when no previous resizing events occured 2021-05-29 19:47:37 +02:00
Eugene Sandulenko e2d65a4ba8 BACKENDS: OPENGL: Comment out noisy warning 2021-05-02 17:47:41 +02:00
SupSuper 60f1fd98aa SDL: Use the window display index when querying display modes 2021-05-01 11:22:22 +03:00
Lothar Serra Mari db52dde75d BACKENDS: OPENGLSDL: Fix typo while initializing _windowIsMaximized state 2021-04-28 14:36:46 +02:00
Lothar Serra Mari 1b68301540 BACKENDS: OPENGLSDL: Properly handle maximized windows 2021-04-27 07:25:22 +02:00
Eugene Sandulenko 50e6460fe2 BACKENDS: OPENGL: Add workaround for macOS window size memorizing 2021-04-19 13:10:25 +02:00
Lothar Serra Mari f288ab7e20 BACKENDS: OPENGLSDL: Flush config file after resize events 2021-04-18 15:16:52 +02:00
Eugene Sandulenko 0cba225a96 BACKENDS: OPENGL: Hiding noisy window size debug output deeper 2021-04-18 14:56:06 +02:00
Lothar Serra Mari ceca0b5ae8 GUI: Add support for GUI window sizing based on screen resolution 2021-04-18 14:41:29 +02:00