Commit graph

135 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
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
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
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
Thierry Crozat
abf782c670 COMMON: Remove kFeatureHiDPI from OSystem and use getHiDPIScreenFactor instead 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
Cameron Cawley
d33487f641 SDL: Refactor OpenGLSdlGraphics3dManager to inherit from SdlGraphicsManager 2021-04-17 20:32:27 +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
5e395d166a BACKENDS: HiDPI support in OpenGL backend 2021-04-11 21:21:44 +02:00
Cameron Cawley
21c1f0d007 SDL: Restore keyboard shortcuts for switching scalers 2021-03-15 16:48:40 +02:00
Thierry Crozat
5412533dec SDL: Fix trying to set unsupported pixel format when changing gfx mode
When switching between the SDL and OpenGL graphics managers, trying
to restore the state could fail as the two managers do not have the
same list of supported formats, so we may not be able to transfer
the pixel format from one to the other. This then resulted in an
assert.

This fixes bug #12079
2021-02-08 12:59:52 +00:00
Cameron Cawley
d968d22eb1
SDL: Refactor grabbing and locking the mouse (#2522) 2020-10-14 08:03:31 +02:00
Cameron Cawley
26cd7d44e2
SDL: Implement lockMouse() in the 2D graphics managers (#2517) 2020-10-13 21:31:10 +02:00
Paweł Kołodziejski
59ba9cb715
SDL: Do not allow toggle fullscreen for backends which can lose opengl context used for 3d games. (#2514) 2020-10-13 20:27:58 +02:00
Cameron Cawley
5cb84a437d SDL: Clip the coordinates sent by mouse events 2020-09-27 00:32:01 +01:00
aryanrawlani28
a9bfe35216 GUI: U32: More issue fixes and general improvements
- Use the fake constructor for message dialog less often
- solve errors regarding comparision between string and u32string in midi
- solve errors in testbed/speech related to ttsMan->say
- fix unsigned comparision warning in tab.cpp
- fix issue with static strings and translations in sdl-graphics
2020-08-30 14:43:41 +02:00
aryanrawlani28
f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
SupSuper
fa615bc52f BACKENDS: Fix inconsistent usage of const modifier
Fixes warnings from mismatching method signatures between parent and child managers
2020-05-30 06:49:09 +01:00
Cameron Cawley
f8a883f2b1 SDL: Unify implementations of activateManager and deactivateManager 2020-05-10 12:02:44 +01:00
Cameron Cawley
205175c4e5 SDL: Don't allow switching to and from fullscreen if it isn't supported 2020-03-27 22:50:41 +01:00
Bastien Bouclet
d94c7c3bcc SDL: Move the keyboard mouse to a subclass of SdlEventSource
And deprecate it. The new Virtual Mouse system is expected to replace
it.
2020-03-09 20:00:31 +01:00
Bastien Bouclet
7daf2a4f5b SDL: Add back Alt+KP_ENTER as a shortcut for toggle fullscreen
Fixes #11341.
2020-02-04 08:22:02 +01:00
Bastien Bouclet
426867f4bc KEYMAPPER: Give human readable descriptions to the keymaps 2020-01-29 08:51:29 +01:00
Bastien Bouclet
13fbdb935a KEYMAPPER: Use custom backend actions for the SDL graphics keymap 2020-01-29 08:51:29 +01:00