summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/icon.cpp8
-rw-r--r--ui/icon.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/ui/icon.cpp b/ui/icon.cpp
index c3b5078..847b117 100644
--- a/ui/icon.cpp
+++ b/ui/icon.cpp
@@ -28,3 +28,11 @@ Icon::Bind() const
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_texture);
}
+
+ImTextureID
+Icon::operator*() const
+{
+ static_assert(sizeof(m_texture) <= sizeof(ImTextureID));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast,performance-no-int-to-ptr) This is how ImGui works
+ return reinterpret_cast<ImTextureID>(*m_texture);
+}
diff --git a/ui/icon.h b/ui/icon.h
index 76cd3ae..5f3a812 100644
--- a/ui/icon.h
+++ b/ui/icon.h
@@ -1,5 +1,6 @@
#pragma once
+#include "imgui_wrap.h"
#include <filesystem>
#include <glArrays.h>
#include <glm/glm.hpp>
@@ -13,6 +14,7 @@ public:
void Bind() const;
const glm::vec2 size;
+ ImTextureID operator*() const;
private:
glTexture m_texture;