[Scummvm-git-logs] scummvm master -> a9a3f0860f62abd82b94e309ffb7d310ad6636a8
sev-
noreply at scummvm.org
Thu Sep 26 05:06:54 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a9a3f0860f BACKENDS: Add ImGui support to SurfaceSdlGraphicsManager
Commit: a9a3f0860f62abd82b94e309ffb7d310ad6636a8
https://github.com/scummvm/scummvm/commit/a9a3f0860f62abd82b94e309ffb7d310ad6636a8
Author: Sebastien Ronsse (sronsse at gmail.com)
Date: 2024-09-26T07:06:50+02:00
Commit Message:
BACKENDS: Add ImGui support to SurfaceSdlGraphicsManager
Changed paths:
backends/graphics/sdl/sdl-graphics.cpp
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 2d23b7f9138..72adec5fa88 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -513,10 +513,6 @@ void SdlGraphicsManager::initImGui(void *glContext) {
assert(!_imGuiReady);
_imGuiInited = false;
- if (!glContext) {
- return;
- }
-
IMGUI_CHECKVERSION();
if (!ImGui::CreateContext()) {
return;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 823688cb7b8..aacb0641692 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -923,6 +923,11 @@ void SurfaceSdlGraphicsManager::initGraphicsSurface() {
_isDoubleBuf = flags & SDL_DOUBLEBUF;
_isHwPalette = flags & SDL_HWPALETTE;
#endif
+
+#if defined(USE_IMGUI) && SDL_VERSION_ATLEAST(2, 0, 0)
+ // Setup Dear ImGui
+ initImGui(nullptr);
+#endif
}
bool SurfaceSdlGraphicsManager::loadGFXMode() {
@@ -1526,6 +1531,11 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
_numDirtyRects = 0;
_forceRedraw = false;
_cursorNeedsRedraw = false;
+
+#if defined(USE_IMGUI) && SDL_VERSION_ATLEAST(2, 0, 0)
+ renderImGui();
+#endif
+
#if !SDL_VERSION_ATLEAST(2, 0, 0)
if (_isDoubleBuf)
SDL_Flip(_hwScreen);
@@ -2801,6 +2811,10 @@ void SurfaceSdlGraphicsManager::notifyResize(const int width, const int height)
#if SDL_VERSION_ATLEAST(2, 0, 0)
void SurfaceSdlGraphicsManager::deinitializeRenderer() {
+#ifdef USE_IMGUI
+ destroyImGui();
+#endif
+
if (_screenTexture)
SDL_DestroyTexture(_screenTexture);
_screenTexture = nullptr;
More information about the Scummvm-git-logs
mailing list