From d152b4193c261fc5d0bc98d04dd63f7f878db7af Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 21 Apr 2018 21:40:05 +0100 Subject: [PATCH] Added to ImGuiImplementation GetCursorData function allowing to access data associated with ImGui cursors (UVs and size). --- Source/ImGui/Private/ImGuiImplementation.cpp | 21 ++++++++++++++++++++ Source/ImGui/Private/ImGuiImplementation.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/Source/ImGui/Private/ImGuiImplementation.cpp b/Source/ImGui/Private/ImGuiImplementation.cpp index 7bac665..3aa791c 100644 --- a/Source/ImGui/Private/ImGuiImplementation.cpp +++ b/Source/ImGui/Private/ImGuiImplementation.cpp @@ -28,6 +28,8 @@ #endif // PLATFORM_WINDOWS +#include "ImGuiInteroperability.h" + namespace ImGuiImplementation { // This is exposing ImGui default context for the whole module. @@ -41,4 +43,23 @@ namespace ImGuiImplementation { SaveIniSettingsToDisk(Filename); } + + bool GetCursorData(int CursorType, FVector2D& OutSize, FVector2D& OutUVMin, FVector2D& OutUVMax, FVector2D& OutOutlineUVMin, FVector2D& OutOutlineUVMax) + { + if (static_cast(CursorType) < static_cast(ImGuiMouseCursor_Count_)) + { + using namespace ImGuiInterops; + ImGuiMouseCursorData& CursorData = GImGui->MouseCursorData[CursorType]; + OutSize = ToVector2D(CursorData.Size); + OutUVMin = ToVector2D(CursorData.TexUvMin[0]); + OutUVMax = ToVector2D(CursorData.TexUvMax[0]); + OutOutlineUVMin = ToVector2D(CursorData.TexUvMin[1]); + OutOutlineUVMax = ToVector2D(CursorData.TexUvMax[1]); + return true; + } + else + { + return false; + } + } } \ No newline at end of file diff --git a/Source/ImGui/Private/ImGuiImplementation.h b/Source/ImGui/Private/ImGuiImplementation.h index 31aa441..7cc5084 100644 --- a/Source/ImGui/Private/ImGuiImplementation.h +++ b/Source/ImGui/Private/ImGuiImplementation.h @@ -13,4 +13,7 @@ namespace ImGuiImplementation // Save current context settings. void SaveCurrentContextIniSettings(const char* Filename); + + // Get specific cursor data. + bool GetCursorData(int CursorType, FVector2D& OutSize, FVector2D& OutUVMin, FVector2D& OutUVMax, FVector2D& OutOutlineUVMin, FVector2D& OutOutlineUVMax); }