Commit Graph
1369 Commits
Author SHA1 Message Date
Miro Kropacek 5680536655 BACKENDS: ATARI: Additional fixes for cursor background
- leftovers after highlighted dirty rectangle

- not updating _surface if moving to fast left/right from screen borders
  (_width == _srcRect.width())

- not drawing cursor if repeatedly intersecting with a refreshing dirty
  rect

- leftover rectangle when leaving game overlay to the launcher

- massive simplification
2025-04-20 21:33:15 +02:00
Miro Kropacek 4afb49840e BACKENDS: ATARI: Initialize overlay cursor properly
showOverlay() and therefore _screen[kOverlayBuffer]->reset() isn't
called explicitly on init.
2025-04-20 21:33:15 +02:00
Miro Kropacek 3eb17e58e3 BACKENDS: ATARI: Don't attempt direct rendering with unsupported engines
If sprites with implicit pitch % 16 == 0 are corrupted in single/triple
buffering, it doesn't make sense to try them unaligned in direct
rendering.
2025-04-20 21:33:15 +02:00
Miro Kropacek 564c503c3d BACKENDS: ATARI: Allow width non-divisible by 16 if not direct rendering
This fixes Phantasmagoria demo which uses 630x450.
2025-04-20 21:33:15 +02:00
Miro Kropacek cca60feaca BACKENDS: ATARI: Fix isOverlayDirectRendering()
When leaving the overlay, ConfMan.getActiveDomain() is already set. Use
OSystem::engineInit and OSystem::engineDone in your favour.
2025-04-20 21:33:15 +02:00
Miro Kropacek 3ab84a2cf9 BACKENDS: ATARI: Fix incorrectly restored cursor background 2025-04-20 21:33:15 +02:00
Miro Kropacek 6a919c04ab BACKENDS: ATARI: Cleanup usage of bitsPerPixel 2025-04-20 21:33:15 +02:00
Miro Kropacek e53fc61ceb BACKENDS: ATARI: Move g_unalignedPitch check into OSystem::engineInit() 2025-04-20 21:33:15 +02:00
Miro Kropacek bbc922a870 BACKENDS: ATARI: Fix invisible cursor in themed launcher
Follow your own advice from atari-cursor.h:

// Global state consists of:
// - palette (used for the overlay only atm)
// - shape (surface, dimensions, hotspot, keycolor)
// - visibility
// These always get updates by ScummVM, no need to differentiate between
engines and the overlay.
2025-04-20 21:33:15 +02:00
Matthew Jimenez 77ee5a9007 IMAGE: Get palette class by reference on image decoders 2025-04-12 15:47:17 +03:00
Filippos Karapetis 379f6aae47 BACKENDS: Use C++ 11 range-based for loops 2025-04-06 02:01:28 +03:00
Filippos Karapetis ce51fd937f BACKENDS: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
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
Le Philousophe 2d1b05bf17 BACKENDS: SDL: Fix sdlGetAttribute shim on SDL2
sdlGetAttribute returns true on success (like SDL_GL_GetAttribute on
SDL3), but SDL_GL_GetAttribute on SDL2 return 0 on success.
2025-02-22 10:57:49 +01:00
Le Philousophe 19f735adf7 BACKENDS: SURFACESDL: Fix memory leak
There was a copy paste error.
Also use the new shim instead of an ifdef to destroy the mouse surface.
2025-02-19 22:30:17 +01: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
Miro Kropacek a4ed12b04d BACKENDS: ATARI: Cleanup overlay code
Pretending that the manager starts in the overlay mode was really
confusing.

Also, the concept of _workScreen seemed great in theory but lead to
various subtle errors which were very hard to debug (related to cursor
handling, resolution changing etc).
2024-12-30 18:37:55 +01:00
Miro Kropacek b779b2038f JANITORIAL: ATARI: Unify enum names 2024-12-30 18:37:54 +01:00
Eric Fry a716d981aa GRAPHICS: Changed text to clarify EGA video mode. 2024-12-18 00:09:38 +02:00
Eric Fry 292d66e95f GRAPHICS: Apply aspect ratio correction to 16 color VGA 640x350 video mode. 2024-12-18 00:09:38 +02: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
Cameron Cawley 26a2e738fd ANDROID: Fix build after FrameBuffer class changes 2024-11-30 23:36:34 +01:00
Cameron Cawley 20b41fc8d9 GRAPHICS: OPENGL: Separate the GLTexture class from the graphics manager 2024-11-30 18:21:47 +02: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
Miro Kropacek feef4e1bf1 BACKENDS: ATARI: Final screen resolution changes
- seamless resolution/palette switching (at least in theory, it still
  isn't artifact-free, no clue why)

- bugfixes (shake offset, some s_screenSurf corner cases)

- simplification the triple-buffering code
2024-11-21 11:31:25 +01:00
Miro Kropacek 10665fb723 BACKENDS: ATARI: Use DISABLE_TEXT_CONSOLE for release builds
This shaves off a good 800 KB from all the engines. However, do keep
local atari debug messages for diagnostic purposes.

Also, use natfeats for debug output when possible else the classic
stdout/stderr (not both as before).
2024-11-21 11:31:25 +01: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
Miro Kropacek 8bbc31aa6d BACKENDS: ATARI: Bugfixes
- optimize fillScreen(): Eco Quest calls it way too often with 1x1 rects

- don't disable Cursor::isChanged() flags on !isVisible(), that leads to
  skipping of _surface creation in some cases

- handle properly any number of parameters between beginGFXTransaction
  and endGFXTransaction

- clear the work buffer when exiting a game to avoid showing it when
  next game shows an error upon startup
2024-11-13 21:41:01 +01:00
Miro Kropacek b39fa830e9 BACKENDS: ATARI: Optimize 4bpp C2P routine
The AND'ing is not needed, as the pixels are guaranteed to be in range
0 - 15.
2024-11-13 21:41:01 +01:00
Miro Kropacek 16dcfb7a69 BACKENDS: ATARI: Fix _checkUnalignedPitch
It wasn't set / checked properly after the refactor.
2024-11-13 21:41:01 +01:00
Le Philousophe 107b60ad06 BACKENDS: OPENGL: Fix segfault when compiled without RGB color
The cursor is not impacted by this option, only the game screen.
This fixes bug 15251.
2024-11-09 23:56:16 +01:00
Le Philousophe c79abfcd12 ANDROID: In GUI don't move mouse cursor when displaying the keyboard
When displaying the soft keyboard, only the game surface is moved.
So, that's the only surface which should move the mouse.
2024-11-09 13:10:57 +01:00
Le Philousophe e3a13c7d63 ANDROID: Move mouse cursor while displaying keyboard
This is only for 2D for now.
2024-11-02 21:42:43 +01:00
Eugene Sandulenko 60d2b72fb1 BACKENDS: OPENGLSDL: Fix potential division by zero. CID 1452787 2024-10-25 15:59:57 +02:00
Eugene Sandulenko ca4b64beeb BACKENDS: SURFACESDL: Fix image generation for ImGui. Courtesy of lephilosouphe 2024-09-29 17:26:34 +02:00
Le Philousophe 7a69ccc4b8 JANITORIAL: Cleanup whitespaces problems 2024-09-29 17:08:13 +02:00
Le Philousophe 2813582f6b BACKENDS: SDL: Remove superfluous version checks
The code is already guarded by outer checks.
2024-09-29 17:04:03 +02:00
Le Philousophe f04f248f20 BACKENDS: SDL: Implement ImGui API to load images 2024-09-29 17:04:03 +02:00
Le Philousophe 27c7a64683 COMMON: Add ImGui API to create images 2024-09-29 17:04:03 +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
Hubert Maier 4533e12280 JANITORIAL: BACKENDS: Fix typos 2024-09-16 02:13:34 +03:00
Le Philousophe c8c3a316d6 ANDROID: Properly apply touch settings when starting a game
The 2D graphics backend is recycled from the GUI when starting a game.
As a consequence, touch settings were never applied.
2024-09-14 16:51:19 +02:00
Filippos Karapetis 928f5bbcff BACKENDS: Minimal render rate support (force-frame-update)
Originally authored by @magicmyth in PR #1039

ScummVM is optimised to render frames when something changes on screen.
As some host environments can perform poorly if the app does not
reliably refresh its output regularly (notably Steam overlay) this new
option ensures that Scummvm outputs a minimal amount of frames even if
nothing is changing in the game renderer.

Currently this is only implemented in the SDL OpenGL renderer.

The new config option is called force-frame-update and it takes a
integer value representing the desired minimum milliseconds Scummvm
should wait before forcing a screen update/refresh. E.g: 50.

Note that the rendering system will not force a re-draw of a frame if
the app has rendered a changed frame within the desired minimum refresh.

Thus if the app is outputting 30fps and force-frame-update is set to
100ms (~10fps) then no duplicate frame will be shown (in theory).

As this is implemented in OpenGLSdlGraphicsManager::updateScreen()
OpenGLGraphicsManager::_forceRedraw has had its access changed to
*protected* so that it can be access by it's descendant. The reason this
has been done in OpenGLSdlGraphicsManager::updateScreen() is so
SDL_GetTicks() can be used to track the elapsed time. If it is useful
for other platforms using OpenGL to have this feature it could be
implemented within OpenGLGraphicsManager::updateScreen() provided a
suitable platform independent replacement for SDL_GetTicks() is used.
This would potentially be better as OpenGLSdlGraphicsManager checks
various other states when deciding if the screen should update.
2024-09-03 10:58:56 +02:00
Le Philousophe a98df4e445 ANDROID: Rework the virtual gamepad controller
- Use a SVG asset to allow for better scalability
- Make the controller visible when touching the screen
- Allow for oblique moving by placing finger between two directions
- Add more buttons on the center area of the screen (GUIDE, START, LEFT
  STICK, RIGHT STICK) and simplify right area (only four buttons)
- Don't track all fingers, only the ones needed
- Cleanup now unused code
2024-08-31 16:45:32 +02:00
Le Philousophe caf7901cb4 BACKENDS: OPENGL: Update blending color when it's dirty
This makes sure the color is updated before drawing the texture and
avoids extraneous calls when the color was already set.
2024-08-31 16:41:40 +02:00
Donovan Watteau 11b25f3fcf SURFACESDL: Fix -Wcalloc-transposed-args warning from GCC 14.1.0 2024-08-11 18:39:11 +02:00
Simon Delamarre 3454d4988c GRAPHICS: Disable colorKey when applying a mask to a RGB cursor in SurfaceSdl
To apply a mask to a RGB (non-paletted) cursor in SurfaceSdl, we use an
intermediary masked_image, where the pixels made transparent by the mask
are replaced by an ARGB color with alpha = 0 (ARGB 0x00000000 in practice).

However the cursor surface still has a key color attached to it by
SDL_SetColorKey (set to 0 currently), which is not sensitive to the alpha
channel, wrongly making opaque black ARGB 0xFF000000 transparent as well.

So we provide an option to disable the key color in such a case.
2024-07-17 10:57:41 +03:00