summaryrefslogtreecommitdiff
path: root/ui/icon.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-03-15 13:50:51 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-03-15 13:50:51 +0000
commit9d200bc8f749f8d64e4f1e630ddf3a797b9b8fe1 (patch)
treec29773685b65c20fdbf475708d2dccca4344b008 /ui/icon.cpp
parentTidy glArrays, fixes warnings (diff)
downloadilt-9d200bc8f749f8d64e4f1e630ddf3a797b9b8fe1.tar.bz2
ilt-9d200bc8f749f8d64e4f1e630ddf3a797b9b8fe1.tar.xz
ilt-9d200bc8f749f8d64e4f1e630ddf3a797b9b8fe1.zip
Add operator to get ImTextureID from an Icon
Diffstat (limited to 'ui/icon.cpp')
-rw-r--r--ui/icon.cpp8
1 files changed, 8 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);
+}