Commit graph

211 commits

Author SHA1 Message Date
Le Philousophe
93d9504798 BACKENDS: SDL: Let the user prevent resizing of the window
This adds a new shortcut (Ctrl+R) which toggles the resizable state of
the window and allows the user to lock the window size and prevents
resizing.

Closes bug:15124.
2025-02-23 01:10:03 +02:00
scemino
8afb2c1f62 BACKENDS: Add SDL3 backend + update imgui 2025-02-18 22:13:56 +01:00
Le Philousophe
37305ba22c SDL: Allow to use ImGui with a GLES2 context
Init ImGui after our GLContext object has been initialized and check the
context type to specify the proper GLSL version.
Also make sure we are not in GLES mode before setuping ImGui.
2025-02-16 18:43:41 +01:00
Le Philousophe
6fbe181428 BACKENDS: SDL: Call ImGui callback functions when changing them
This ensures a good cleanup and init when switching.
2024-12-11 21:39:45 +01:00
Thierry Crozat
b44c2d6322 BACKENDS: SDL: Fix default scale factor used in initSizeHint
The "scale_factor" setting can be -1, which means the default. But
instead it was hardcoded to 1, which is wrong for the SurfaceSDL
graphics mode where the default is 2.
2024-11-21 23:01:50 +00:00
Thierry Crozat
58c9005ef2 BACKENDS: SDL: Never make window smaller in OpenGL mode when starting game
Normally when using the OpenGL mode the window is not resized when
starting a game, unless the game requires a window bigger than the
current window size. However this was not the case if the engine
called initSizeHint() with sizes smaller than the current window
size, as in this case the window was forcibly resized to the bigger
of those provided sizes.

The initSizeHint() function was added for engines that use multiple
resolutions to indicate when starting the engine that it may use
multiple resolutions and thus may need a bigger window later than
when the game starts. This allows getting the bigger size from the
start and prevent window resize during gameplay. But this function
was not meant to make the window smaller if the graphics backend
request an even bigger size, which may be the case of the OpenGLSDL
graphics backend as it tries to preserve the current window size.
2024-11-21 03:17:56 +02:00
Le Philousophe
2eebb5db02 BACKENDS: SDL: Add SDL2 Renderer support for ImGui
Some adaptations will be needed for the the engines.
2024-09-29 17:04:03 +02:00
Vladimir Serbinenko
488353480f SDL, COMMON: Support screen rotation 2024-09-29 02:10:39 +03:00
Sebastien Ronsse
a9a3f0860f BACKENDS: Add ImGui support to SurfaceSdlGraphicsManager 2024-09-26 07:06:50 +02:00
Le Philousophe
17a1b37dda BACKENDS: SDL: Refactor ImGui processing
This unifies the ImGui processing for both 2D and 3D engine.
This also make sure we don't destroy ImGui if init failed (like on older
OpenGL).
The destroy callback is also called whenever we destroy the context.
2024-06-30 15:57:03 +02:00
scemino
936109fe4f BACKENDS: Update ImGui callbacks in OSystem and fix engines 2024-05-03 20:25:01 +02:00
scemino
8e07681356 BACKENDS: Update setImGuiRenderCallback in OSystem 2024-05-03 20:04:30 +02:00
Le Philousophe
3822d9d644 BACKENDS: Move setImGuiRenderCallback in OSystem and hide implementation
This avoids dynamic casts and having a variable defined in
backends not supporting ImGui
2024-04-28 21:48:10 +02:00
Christian Kündig
7bdadaefae EMSCRIPTEN: GRAPHICS: Fix screenshots 2024-02-27 17:07:13 +01:00
Le Philousophe
e689166a2c BACKENDS: Make screenshots use the Path class 2023-12-24 13:19:25 +01:00
Eugene Sandulenko
fad630323a
SDL: Added config key disable_saved_screenshot_osd for disabling the OSD message 2023-07-15 11:23:29 +02:00
antoniou79
8cef7b8b69 JANITORIAL: Fix code indentation 2023-06-17 22:14:37 +03:00
antoniou79
38e88cde66 BACKENDS: GRAPHICS: Implement scaler scrolling for OpenGL
Using the Ctrl+Alt+0 or 9 keymap

Also added a guard check for kFeatureScalers to allow the actions (kActionNextScaleFilter, kActionPreviousScaleFilter) to change scaler (but not scaler factor) in sdl/sdl-graphics.cpp
2023-06-17 20:21:29 +02:00
Cameron Cawley
138a983d80 COMMON: Refactor VSync handling to match the other options 2023-01-16 18:09:53 +01:00
Cameron Cawley
350e21ba58 SDL: Better workaround for enabling the system cursor 2022-08-26 21:47:49 +01:00
Thierry Crozat
55dccdf787 SDL: Do not adjust window size when creating maximized window 2022-06-05 17:21:18 +01:00
Eugene Sandulenko
5e05f93f36
ALL: Remove Symbian port 2022-05-28 12:32:29 +02:00
D G Turner
6368cf8b72 SDL: Allow Override of ShowMouse Method for SDL Graphics
This will be required to fix the OpenPandora hack for libSDL issues
with screen limits needing to avoid calls to SDL_ShowCursor(SDL_DISABLE).
2022-04-21 19:39:05 +01:00
Le Philousophe
06bc7a25fa OPENGL: Indicate support of OpenGL even in 2D mode
This allows to check for OpenGL support in backend without having to
call initGraphics3d
2022-04-03 22:17:19 +02:00
Kalle Kietavainen
ca2405ed05 SDL: Fix mouse clip to game area in HiDPI mode
The mouse position is set in window coordinates, but it's clipped to the
game area in drawable area coordinates. Previously, the scaling between
these two was not taken into account when calculating the right/bottom
edges of the game area. When the clipped mouse position was converted
back to window coordinates and rounded to the nearest integer, it could
end up on the edge of the game area, not inside of it. This leads to a
loop in which the clipped mouse position is outside of the game area and
needs to be clipped again.

This fixes bug #12646.
2022-02-16 22:15:43 +00: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
Cameron Cawley
c6836c9b77 SDL: Use SDL_SetWindowMouseRect to confine the mouse area 2021-11-19 19:52:58 +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
Filippos Karapetis
8f49df6aca SDL: Fix full screen toggling for 3D games
The previous SdlGraphics3dManager::toggleFullScreen() was not using
beginGFXTransaction / endGFXTransaction in toggleFullScreen().
Restore this logic for 3D games, as using transactions in such games
results in a black screen for 3D games when switching to full screen

A regression from d33487f64
2021-09-29 20:24:03 +02:00
Thierry Crozat
feac996b50 SDL: Move code to handle cursor coordinate HiDPI scale to SdlWindow
SDL handles HiDPI scaling differently depending on the system. On
macOS for example the SDL window size and SDL drawable area have a
different size (factor 2 usually) while on Windows they are the
same. When HiDPI is disabled (for the SDL Surface mode for example)
they are always the same.

We need to appl this scaling when converting cursor position between
the drawable area and the SDL window.
2021-08-20 00:12:51 +01:00
Eugene Sandulenko
df1341ae6a
BACKENDS: Display OSD message on saved screenshots 2021-08-16 14:19:07 +02:00
Thierry Crozat
6fcfdb0514 SDL: Fix handling of cursor position on Windows HiDPI 2021-08-14 19:11:11 +01:00
Cameron Cawley
c4699cb280 SDL: Move getDisplayDpiFromSdl and getDpiScalingFactor into the SdlWindow class 2021-08-14 19:09:33 +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
4ad54446f8 SDL: Get accurate HiDPI scaling on macOS
This fixes incorrect scaling on some non-retina screens that were
detected as HiDPI.
2021-08-13 21:41:33 +01:00
Thierry Crozat
63dd44a81d SDL: Implement getHiDPIScreenFactor 2021-08-13 21:41:33 +01:00
Thierry Crozat
23ca3604b8 SDL: Fix crash when switching to a 3D graphics manager
The OpenGLSdlGraphics3dManager::getSupportedFormats() implementation
returns an empty list. This caused a crash when trying to get the
first element of the list in SdlGraphicsManager::setState().

This fixes bug #12762: The longest Journey crashes
2021-07-26 23:18:17 +01:00
Cameron Cawley
ac9980a9dd SDL: Fix the default scale factor for high resolution games 2021-06-23 23:31:49 +01:00
SupSuper
60f1fd98aa SDL: Use the window display index when querying display modes 2021-05-01 11:22:22 +03:00
Cameron Cawley
d33487f641 SDL: Refactor OpenGLSdlGraphics3dManager to inherit from SdlGraphicsManager 2021-04-17 20:32:27 +02:00
SupSuper
3eba076fa0 SDL: Fix null check in getDisplayDpiFromSdl 2021-04-13 19:27:31 +01:00
Cameron Cawley
125fe7162d SDL: Fix compilation with SDL 2.0.3 2021-04-13 17:18:29 +01:00
SupSuper
d6ba073055 BACKENDS: OPENGLSDL: Only scale mouse cursor on high-DPI platforms
Some platforms send raw coordinates, others send scaled coordinates.
We try to determine this by comparing the window size and drawable size.
2021-04-12 18:38:45 +02:00
Cameron Cawley
24b59ecb4c Revert "OPENGL: Implement high DPI support on Android (#1895)"
This reverts commit 177d709909.
2021-04-12 00:54:12 +01:00
Eugene Sandulenko
708caaa8fa BACKENDS: SDL: Do not scale mouse position for LoDPI modes 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
7a23d859a5 BACKENDS: Lower hidpi scaling to factor of 1.5 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
5e395d166a BACKENDS: HiDPI support in OpenGL backend 2021-04-11 21:21:44 +02:00