Age | Commit message (Collapse) | Author |
|
|
|
|
|
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
|
|
It causes problems on AmigaOS and Linux/SDL2/Vivante
|
|
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.
|
|
|
|
|
|
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.
|
|
Destroying and recreating the SDL window whenever the video mode
changes in SDL2 is not necessary and causes several problems:
1. In windowed mode, the game window shifts position;
2. In fullscreen mode in macOS, every time the window is
recreated, it causes the OS to play its switch-to-fullscreen
animation again and emit system alert noises;
3. The window content flickers; and
4. The engine loses events from the old destroyed window.
This patch changes the SDL backend code to avoid destroying and
recreating the SDL window when using SDL2, except when switching
OpenGL modes, since there is no way to change the OpenGL feature
of a window.
There are still some outstanding issues with OpenGL where window
size ends up getting reset even though the user has resized it;
this will probably need to be addressed at some point in another
patch.
Thanks to @bgK and @criezy for their feedback which made this
patch much better.
Co-Authored-By: Bastien Bouclet <bastien.bouclet@gmail.com>
|
|
Closes gh-948.
|
|
In particular this adds a warning when failing to save a screenshot
in OpenGL mode (there was already one in SurfaceSDL mode).
|
|
|
|
This fixes bug #9701: WINDOWS: Flow of taking screenshots
on Windows is broken
|
|
|
|
|
|
Crtl-Alt-f now enables/disables filtering instead of changing the
graphics mode. Since there is only one graphics mode now, a hotkey
to change it is a bit useless.
|
|
Also change some OSD messages to be the same or similar to
messages used by the Surface SDL code.
|
|
Those outdated resize events are sent from SDL_DestroyWindow when the
window is fullscreen and doesn't have the SDL_WINDOW_FULLSCREEN_DESKTOP
flag (thus Surface SDL is not affected). Switching resolutions in fullscreen, or
switching from fullscreen to windowed will therefore cause a resize event to
be received with the former fullscreen resolution after we have already setup
the window to use the new resolution. If we don't ignore this event we end up
with a texture size and a window size that are not consistent and for example
see only a part of the texture (if the old resolution is bigger than the new one.
|
|
Compatibility profiles only exist in modern OpenGL and we request an ancient
version.
|
|
|
|
|
|
|
|
|
|
|
|
This mode should *not* be used by any new engines/code. If someone is going
to use it and says it works with the OpenGL output, please make them wear a
red uniform and beam them onto a remote planet.
|
|
Formerly, we required that the OpenGL mode was fixed at compile time. Now we
allow the code to work with whatever it is given at runtime.
It is still possible to force a context type on compile time.
|
|
This used to be used by Sword25. Since it is not supported by GLES and no
engine code uses it we drop support. Hopefully, this helps people to realize
they should not use that format in their engine.
|
|
This can and will be used for future extension usage support.
Tizen changes have been untested.
|
|
Formerly we did not initialize the mouse emulation from SdlEventSource
properly. Now hopefully joysticks etc. should work fine with the SDL OpenGL
output too.
|
|
Subclasses of OpenGLGraphicsManager are now supposed to supply a refreshScreen
function which handles actual screen updating (for example, buffer swapping).
|
|
|
|
|
|
It can be returned when there are no dimensions available for the currently selected pixel format
|
|
|
|
This is based upon skristiansson's change set to make ScummVM work with SDL2.
|
|
|
|
|
|
|
|
|
|
Thanks to fuzzie for noticing this.
|
|
Otherwise we can end up with the wrong resolution when we make
multiple resizes in quick succession.
|
|
This makes sure the default mode also works for OpenGL ES contexts.
|
|
|
|
|
|
|
|
We can do this now that we can use virtual inheritance and dynamic_cast
because we enabled RTTI.
|
|
|
|
Sadly this also requires us to extend GraphicsManager for this SDL specific
feature. However, since that's only used in the SDL backend and Tizen it
should be fine for now...
|
|
|
|
|