diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-15 13:50:51 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-15 13:50:51 +0000 |
commit | 9d200bc8f749f8d64e4f1e630ddf3a797b9b8fe1 (patch) | |
tree | c29773685b65c20fdbf475708d2dccca4344b008 /ui/icon.cpp | |
parent | Tidy glArrays, fixes warnings (diff) | |
download | ilt-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.cpp | 8 |
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); +} |