From 67c69d3ba2b0de24711a578cdde23613dadb43f2 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Wed, 24 Dec 2014 02:33:29 +0100 Subject: [PATCH 1/2] Fixing scissor for nvg elements. --- examples/common/imgui/imgui.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 20b847dc..be6b6ca7 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -1031,7 +1031,12 @@ struct Imgui } } - nvgResetScissor(m_nvg); + nvgScissor(m_nvg + , float(parentArea.m_scissorX) + , float(parentArea.m_scissorY-1) + , float(parentArea.m_scissorWidth) + , float(parentArea.m_scissorHeight+1) + ); } bool beginArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, bool _enabled, int32_t _r) From 528756610b68d46404b93ecdaa0cc21afe026783 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Wed, 24 Dec 2014 02:33:47 +0100 Subject: [PATCH 2/2] Added imguiGetWidgetW(). --- examples/common/imgui/imgui.cpp | 5 +++++ examples/common/imgui/imgui.h | 1 + 2 files changed, 6 insertions(+) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index be6b6ca7..7bf88c86 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -3160,6 +3160,11 @@ int32_t imguiGetWidgetY() return s_imgui.getCurrentArea().m_widgetY; } +int32_t imguiGetWidgetW() +{ + return s_imgui.getCurrentArea().m_widgetW; +} + void imguiSetCurrentScissor() { return s_imgui.setCurrentScissor(); diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index c356a934..12d4e01b 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -149,6 +149,7 @@ void imguiSeparatorLine(uint16_t _height = IMGUI_SEPARATOR_VALUE); int32_t imguiGetWidgetX(); int32_t imguiGetWidgetY(); +int32_t imguiGetWidgetW(); void imguiSetCurrentScissor(); // Call before drawing custom widgets over imgui area. bool imguiButton(const char* _text, bool _enabled = true, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, uint32_t _rgb0 = IMGUI_BUTTON_RGB0, int32_t _r = IMGUI_BUTTON_R);