From 0f60db25d5d826021939951073113ed741a7741f Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Thu, 9 Apr 2015 01:02:05 +0200 Subject: [PATCH] finish all methods of ImGUI-namespace --- cimgui/cimgui.cpp | 51 ++++++++++++++++++++++++++++++++++++++--------- cimgui/cimgui.h | 18 ++++++++--------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/cimgui/cimgui.cpp b/cimgui/cimgui.cpp index 045aa64..64a4798 100644 --- a/cimgui/cimgui.cpp +++ b/cimgui/cimgui.cpp @@ -405,7 +405,11 @@ CIMGUI_API int ig_GetColumnsCount() return ImGui::GetColumnsCount(); } -//CIMGUI_API struct ImVec2 ig_GetCursorPos(); +CIMGUI_API void ig_GetCursorPos(ImVec2* pOut) +{ + *pOut = ImGui::GetCursorPos(); +} + CIMGUI_API float ig_GetCursorPosX() { return ImGui::GetCursorPosX(); @@ -431,7 +435,11 @@ CIMGUI_API void ig_SetCursorPosY(float y) return ImGui::SetCursorPosY(y); } -//CIMGUI_API struct ImVec2 ig_GetCursorScreenPos(); +CIMGUI_API void ig_GetCursorScreenPos(ImVec2* pOut) +{ + *pOut = ImGui::GetCursorScreenPos(); +} + CIMGUI_API void ig_SetCursorScreenPos(const ImVec2 pos) { return ImGui::SetCursorScreenPos(pos); @@ -962,9 +970,20 @@ CIMGUI_API bool ig_IsAnyItemActive() return ImGui::IsAnyItemActive(); } -//CIMGUI_API struct ImVec2 ig_GetItemRectMin(); -//CIMGUI_API struct ImVec2 ig_GetItemRectMax(); -//CIMGUI_API struct ImVec2 ig_GetItemRectSize(); +CIMGUI_API void ig_GetItemRectMin(ImVec2* pOut) +{ + *pOut = ImGui::GetItemRectMin(); +} + +CIMGUI_API void ig_GetItemRectMax(ImVec2* pOut) +{ + *pOut = ImGui::GetItemRectMax(); +} + +CIMGUI_API void ig_GetItemRectSize(ImVec2* pOut) +{ + *pOut = ImGui::GetItemRectSize(); +} CIMGUI_API bool ig_IsWindowFocused() { @@ -1025,8 +1044,15 @@ CIMGUI_API bool ig_IsPosHoveringAnyWindow(const ImVec2 pos) return ImGui::IsPosHoveringAnyWindow(pos); } -//CIMGUI_API struct ImVec2 ig_GetMousePos(){} -//CIMGUI_API struct ImVec2 ig_GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f){} +CIMGUI_API void ig_GetMousePos(ImVec2* pOut) +{ + *pOut = ImGui::GetMousePos(); +} + +CIMGUI_API void ig_GetMouseDragDelta(ImVec2* pOut, int button, float lock_threshold) +{ + *pOut = ImGui::GetMouseDragDelta(button,lock_threshold); +} CIMGUI_API ImGuiMouseCursor ig_GetMouseCursor() { @@ -1053,8 +1079,15 @@ CIMGUI_API const char* ig_GetStyleColName(ImGuiCol idx) return ImGui::GetStyleColName(idx); } -//CIMGUI_API struct ImVec2 ig_CalcItemRectClosestPoint(const ImVec2 pos, bool on_edge = false, float outward = +0.0f); -//CIMGUI_API struct ImVec2 ig_CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f) +CIMGUI_API void ig_CalcItemRectClosestPoint(ImVec2* pOut, const ImVec2 pos, bool on_edge, float outward) +{ + *pOut = ImGui::CalcItemRectClosestPoint(pos,on_edge,outward); +} + +CIMGUI_API void ig_CalcTextSize(ImVec2* pOut, const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) +{ + *pOut = ImGui::CalcTextSize(text, text_end, hide_text_after_double_hash, wrap_width); +} CIMGUI_API void ig_CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end) { diff --git a/cimgui/cimgui.h b/cimgui/cimgui.h index a5d0a0a..6040390 100644 --- a/cimgui/cimgui.h +++ b/cimgui/cimgui.h @@ -100,13 +100,13 @@ CIMGUI_API float ig_GetColumnOffset(int column_index = -1); CIMGUI_API void ig_SetColumnOffset(int column_index, float offset_x); CIMGUI_API float ig_GetColumnWidth(int column_index = -1); CIMGUI_API int ig_GetColumnsCount(); -//CIMGUI_API struct ImVec2 ig_GetCursorPos(); +CIMGUI_API void ig_GetCursorPos(ImVec2* pOut); CIMGUI_API float ig_GetCursorPosX(); CIMGUI_API float ig_GetCursorPosY(); CIMGUI_API void ig_SetCursorPos(const ImVec2 pos); CIMGUI_API void ig_SetCursorPosX(float x); CIMGUI_API void ig_SetCursorPosY(float y); -//CIMGUI_API struct ImVec2 ig_GetCursorScreenPos(); +CIMGUI_API void ig_GetCursorScreenPos(ImVec2* pOut); CIMGUI_API void ig_SetCursorScreenPos(const ImVec2 pos); CIMGUI_API void ig_AlignFirstTextHeightToWidgets(); CIMGUI_API float ig_GetTextLineHeight(); @@ -227,9 +227,9 @@ CIMGUI_API bool ig_IsItemHovered(); CIMGUI_API bool ig_IsItemHoveredRect(); CIMGUI_API bool ig_IsItemActive(); CIMGUI_API bool ig_IsAnyItemActive(); -//CIMGUI_API struct ImVec2 ig_GetItemRectMin(); -//CIMGUI_API struct ImVec2 ig_GetItemRectMax(); -//CIMGUI_API struct ImVec2 ig_GetItemRectSize(); +CIMGUI_API void ig_GetItemRectMin(ImVec2* pOut); +CIMGUI_API void ig_GetItemRectMax(ImVec2* pOut); +CIMGUI_API void ig_GetItemRectSize(ImVec2* pOut); CIMGUI_API bool ig_IsWindowFocused(); CIMGUI_API bool ig_IsRootWindowFocused(); CIMGUI_API bool ig_IsRootWindowOrAnyChildFocused(); @@ -242,15 +242,15 @@ CIMGUI_API bool ig_IsMouseHoveringAnyWindow(); CIMGUI_API bool ig_IsMouseHoveringRect(const ImVec2 rect_min, const ImVec2 rect_max); CIMGUI_API bool ig_IsMouseDragging(int button = 0, float lock_threshold = -1.0f); CIMGUI_API bool ig_IsPosHoveringAnyWindow(const ImVec2 pos); -//CIMGUI_API struct ImVec2 ig_GetMousePos(); -//CIMGUI_API struct ImVec2 ig_GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); +CIMGUI_API void ig_GetMousePos(ImVec2* pOut); +CIMGUI_API void ig_GetMouseDragDelta(ImVec2* pOut, int button = 0, float lock_threshold = -1.0f); CIMGUI_API ImGuiMouseCursor ig_GetMouseCursor(); CIMGUI_API void ig_SetMouseCursor(ImGuiMouseCursor type); CIMGUI_API float ig_GetTime(); CIMGUI_API int ig_GetFrameCount(); CIMGUI_API const char* ig_GetStyleColName(ImGuiCol idx); -//CIMGUI_API struct ImVec2 ig_CalcItemRectClosestPoint(const ImVec2 pos, bool on_edge = false, float outward = +0.0f); -//CIMGUI_API struct ImVec2 ig_CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f) +CIMGUI_API void ig_CalcItemRectClosestPoint(ImVec2* pOut, const ImVec2 pos, bool on_edge = false, float outward = +0.0f); +CIMGUI_API void ig_CalcTextSize(ImVec2* pOut, const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); CIMGUI_API void ig_CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); CIMGUI_API void ig_BeginChildFrame(ImGuiID id, const ImVec2 size);