175 Commits

Author SHA1 Message Date
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
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
Lothar Serra Mari
ceca0b5ae8 GUI: Add support for GUI window sizing based on screen resolution 2021-04-18 14:41:29 +02:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
rsn8887
fca3abd9ef SWITCH: Fix wrong zoom on SDL to GL transition again 2021-04-13 16:17:22 -05:00
SupSuper
8fba77eefa BACKENDS: OPENGLSDL: Always use drawable size when resizing window
This corrects situations in SDL2 where the window size is not
the same as the drawable size, leading to incorrect rendering.
2021-04-12 18:38:45 +02:00
Cameron Cawley
24b59ecb4c Revert "OPENGL: Implement high DPI support on Android (#1895)"
This reverts commit 177d709909808313eee720ce76465cf99f909c5e.
2021-04-12 00:54:12 +01:00
Eugene Sandulenko
fda5847789 BACKENDS: OPENGLSDL: Fix compilation with SDL1 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
c06d47e397 COMMON: Added kFeatureHiDPI and return it from the backend 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
bb15133a0a BACKENDS: OPENGLSDL: Fix switching to full screen with Alt+Enter 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
Thierry Crozat
7408dee5df Revert "GRAPHICS: Tentative fix saveScreenshot() warning for OpenGL"
This reverts commit 0f118d0210d1dc1d4e4174fd72179de82b263ed8.
2021-04-07 00:09:50 +01:00
antoniou79
0f118d0210 GRAPHICS: Tentative fix saveScreenshot() warning for OpenGL
Building for Android (OpenGL) had noisy warning for hiding overloaded virtual function

Added a dummy implementation in OpenGLGraphics manager, and also for OpenGLSdlGraphicsManager it now explicitly calls the SdlGraphicsManager implementation for the void argument signature.
2021-04-03 14:03:36 +03:00
rsn8887
397ea454ba SWITCH: Fix wrong zoom on SDL to GL transition 2021-02-17 22:58:09 -06:00
SupSuper
0128d5e3b5 OPENGLSDL: Fix SDL asserting when getting fullscreen state
This fixes a null pointer being passed to SDL_GetWindowFlags
when there is no window yet, since the condition was incomplete
2020-11-01 20:10:15 +00: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
Thierry Crozat
c5ede297ea JANITORIAL: Simplify some code that use U32String::format 2020-09-08 21:24:27 +01:00
aryanrawlani28
d48453693c GUI: U32: Use translated strings as arguments for formatting function usage. 2020-08-30 14:43:41 +02:00
aryanrawlani28
bd19eaa5bf GUI: U32: More code improvements in engines and misc fixes
- Xeen's GUIError now takes in U32String
- Scumm's ValueDisplayDialog takes in U32
- Mohawk's InfoDialog & PauseDialog takes in U32
- Mohawk - in riven.cpp, Some assignment fixes
- Backends -in sdl.cpp, Remove incorrect conversion from iso8859 when setting text in clipboard
- Graphics - Add u32 strings instead of decoding each piece in format
2020-08-30 14:43:41 +02:00
aryanrawlani28
e22b32abfe GUI: U32: Use Common::U32String::format where necessary and GUIError to u32
- Where necessary as in, where translated messages are used.
- GUIErrorMessage now takes in U32String
- error messages across some engines use U32Strings. they are changed because they show a message dialog.
2020-08-30 14:43:41 +02:00
aryanrawlani28
b9a449480b GUI: U32: Remove u32::format references
- Removed because implicit conversion can simply handle this usecase
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
Cameron Cawley
2f6d219dce SDL: Move detection of the desktop resolution into the SdlWindow class 2020-05-10 21:53:07 +02:00
Cameron Cawley
f8a883f2b1 SDL: Unify implementations of activateManager and deactivateManager 2020-05-10 12:02:44 +01:00
Bastien Bouclet
13fbdb935a KEYMAPPER: Use custom backend actions for the SDL graphics keymap 2020-01-29 08:51:29 +01:00
Cameron Cawley
177d709909 OPENGL: Implement high DPI support on Android (#1895)
* OPENGL: Implement high DPI support on Android

* PSP2: Fix build
2019-11-01 13:39:46 +02:00
Cameron Cawley
16f8c024d1 OPENGLSDL: Move stretch mode handling into OpenGLGraphicsManager 2019-06-24 02:19:28 +03:00
Cameron Cawley
0ddfe927ce OPENGLSDL: Move getSupportedFormats into OpenGLGraphicsManager 2019-06-22 01:15:39 +03:00
Cameron Cawley
f426ba6c36 SDL: Move fullscreen and screenshot event handling to SdlGraphicsManager (#1522) 2019-03-10 18:25:25 +02:00
Thierry Crozat
89f1b1c96e GUI: Add Stretch Mode selection in Options dialog 2018-07-08 16:54:51 +01:00
Thierry Crozat
812ce59ee4 SDL: Implement stretch mode API
Four modes are supported:
 - Use original size with no scaling
 - Scale by an integral amount as much as possible but not bigger
   than the window.
 - Scale to fit the window while respecting the aspect ratio. There
   may be black bars on the left and right, or on the top and bottom,
   but not both. This is the default, and the old behaviour.
 - Scale and stretch to fit the window. In this mode the aspecy ratio
   is not respected and there is no black bars.
The mode is controled by the "scaling_mode" value (between 0 and 3) in
the config file.

Also add Crtl-Alt-s hotkey to cycle through scaling modes
2018-07-08 16:54:51 +01:00
Bastien Bouclet
ae634388e9 SDL: Enable the startup fullscreen hack for X11 only
It causes problems on AmigaOS and Linux/SDL2/Vivante
2017-12-10 15:23:16 +01:00
Colin Snover
de2bbe3b97 BACKENDS: Refactor OpenGL & SDL graphics backends
This patch refactors the OpenGL and SDL graphics backends,
primarily to unify window scaling and mouse handling, and to
fix coordinate mapping between the ScummVM window and the
virtual game screen when they have different aspect ratios.

Unified code for these two backends has been moved to a new
header-only WindowedGraphicsManager class, so named because it
contains code for managing graphics managers that interact with
a windowing system and render virtual screens within a larger
physical content window.

The biggest behavioral change here is with the coordinate
system mapping:

Previously, mouse offsets were converted by mapping the whole
space within the window as input to the virtual game screen
without maintaining aspect ratio. This was done to prevent
'stickiness' when the mouse cursor was within the window but
outside of the virtual game screen, but it caused noticeable
distortion of mouse movement speed on the axis with blank
space.

Instead of introducing mouse speed distortion to prevent
stickiness, this patch changes coordinate transformation to
show the system cursor when the mouse moves outside of the virtual
game screen when mouse grab is off, or by holding the mouse inside
the virtual game screen (instead of the entire window) when mouse
grab is on.

This patch also improves some other properties of the
GraphicsManager/PaletteManager interfaces:

* Nullipotent operations (getWidth, getHeight, etc.) of the
  PaletteManager/GraphicsManager interfaces are now const
* Methods marked `virtual` but not inherited by any subclass have
  been de-virtualized
* Extra unnecessary calculations of hardware height in
  SurfaceSdlGraphicsManager have been removed
* Methods have been renamed where appropriate for clarity
  (setWindowSize -> handleResize, etc.)
* C++11 support improved with `override` specifier added on
  overridden virtual methods in subclasses (primarily to avoid
  myself accidentally creating new methods in the subclasses
  by changing types/names during refactoring)

Additional refactoring can and should be done at some point to
continue to deduplicate code between the OpenGL and SDL backends.
Since the primary goal here was to improve the coordinate mapping,
full refactoring of these backends was not completed here.
2017-10-15 13:24:20 -05:00
Colin Snover
b53020f704 BACKENDS: Fix some comment typos 2017-10-15 13:24:20 -05:00
Colin Snover
6e157429b7 BACKENDS: Fix window sizing of games that switch between multiple resolutions 2017-10-07 12:30:29 -05:00
Colin Snover
ebe6c40a6a SDL: Do not reset window size when engines update rendering surface
This change allows:

* Engines to update their target rendering surface/size and pixel
  format with the backend multiple times during gameplay;
* Users to resize the ScummVM window without having it reset
  size/position every time an engine updates its target surface
  format;
* Conversions/scaling to continue to run efficiently in hardware,
  instead of requiring engines to pick their maximum possible
  output format once and upscale inefficiently in software;
* The window to reset size once when an engine calls to set its
  initial output size, and to reset again once ScummVM returns to
  the launcher.

This is relevant for at least SCI32 and DreamWeb engines, which
perform graphics mode switches during games.
2017-10-07 12:30:29 -05:00