Skip to content

Commit 8452564

Browse files
committed
ImTextureID is not a void* anymore starting from imgui 1.91.4
1 parent 4328d6d commit 8452564

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

include/gf2/imgui/ImguiManager.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ namespace gf {
1818
class GF_IMGUI_API ImguiManager {
1919
public:
2020
ImguiManager(Window* window, RenderManager* render_manager);
21+
ImguiManager(const ImguiManager&) = delete;
22+
ImguiManager(ImguiManager&&) = default;
23+
~ImguiManager();
24+
25+
ImguiManager& operator=(const ImguiManager&) = delete;
26+
ImguiManager& operator=(ImguiManager&&) = default;
2127

2228
bool process_event(const Event& event);
2329
void update(Time time);

library/imgui/ImguiEntity.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace gf {
9696

9797
// texture
9898

99-
object.texture = static_cast<Texture*>(command->TextureId);
99+
object.texture = reinterpret_cast<Texture*>(static_cast<uintptr_t>(command->TextureId)); // NOLINT
100100

101101
m_objects.push_back(object);
102102
}

library/imgui/ImguiManager.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,18 @@ namespace gf {
7777
const Image font_image(size, pixels, PixelFormat::Rgba32);
7878
m_font_texture = Texture(font_image, render_manager);
7979
m_font_texture.set_debug_name("[gf2] Imgui Font Texture");
80-
io.Fonts->TexID = static_cast<void*>(&m_font_texture);
80+
io.Fonts->TexID = reinterpret_cast<uintptr_t>(&m_font_texture); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
8181

8282
io.BackendRendererUserData = static_cast<void*>(render_manager);
8383
}
8484

85+
ImguiManager::~ImguiManager()
86+
{
87+
ImGuiIO& io = ImGui::GetIO();
88+
io.BackendRendererUserData = nullptr;
89+
io.BackendPlatformUserData = nullptr;
90+
}
91+
8592
bool ImguiManager::process_event(const Event& event)
8693
{
8794
ImGuiIO& io = ImGui::GetIO();

xmake.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set_project("gf2")
22
set_version("0.1.0")
33

4-
add_requires("libsdl", "freetype", "harfbuzz", "imgui", "pugixml", "zlib")
4+
add_requires("libsdl", "freetype", "harfbuzz", "imgui >= 1.91.4", "pugixml", "zlib")
55
add_requires("chipmunk2d")
66
add_requires("fmt")
77
add_requires("gtest", { configs = { gmock = false }})

0 commit comments

Comments
 (0)