From 651b5b6fb53084874c83fe6513de6b4c37e6c3dc Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Tue, 23 Sep 2014 15:34:05 +0200 Subject: [PATCH] Reordering imgui functions. --- examples/common/imgui/imgui.cpp | 87 ++++++++++++++++----------------- examples/common/imgui/imgui.h | 14 +++--- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 397a2345..49671f2b 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -2796,6 +2796,16 @@ ImguiFontHandle imguiCreate(const void* _data, float _fontSize) return s_imgui.create(_data, _fontSize); } +void imguiDestroy() +{ + s_imgui.destroy(); +} + +ImguiFontHandle imguiCreateFont(const void* _data, float _fontSize) +{ + return s_imgui.createFont(_data, _fontSize); +} + void imguiSetFont(ImguiFontHandle _handle) { s_imgui.setFont(_handle); @@ -2807,16 +2817,6 @@ ImguiFontHandle imguiGetCurrentFont() return handle; } -ImguiFontHandle imguiCreateFont(const void* _data, float _fontSize) -{ - return s_imgui.createFont(_data, _fontSize); -} - -void imguiDestroy() -{ - s_imgui.destroy(); -} - void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, uint8_t _view) { s_imgui.beginFrame(_mx, _my, _button, _scroll, _width, _height, _inputChar, _view); @@ -2827,6 +2827,26 @@ void imguiEndFrame() s_imgui.endFrame(); } +void imguiDrawText(int32_t _x, int32_t _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb) +{ + s_imgui.drawText(_x, _y, _align, _text, _argb); +} + +void imguiDrawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _argb) +{ + s_imgui.drawLine(_x0, _y0, _x1, _y1, _r, _argb); +} + +void imguiDrawRoundedRect(float _x, float _y, float _width, float _height, float _r, uint32_t _argb) +{ + s_imgui.drawRoundedRect(_x, _y, _width, _height, _r, _argb); +} + +void imguiDrawRect(float _x, float _y, float _width, float _height, uint32_t _argb) +{ + s_imgui.drawRect(_x, _y, _width, _height, _argb); +} + bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled) { return s_imgui.borderButton(_border, _checked, _enabled); @@ -2867,7 +2887,6 @@ void imguiEndScrollArea(int32_t _r) s_imgui.endArea(); } - void imguiIndent(uint16_t _width) { s_imgui.indent(_width); @@ -2913,6 +2932,14 @@ bool imguiCheck(const char* _text, bool _checked, bool _enabled) return s_imgui.check(_text, _checked, _enabled); } +void imguiBool(const char* _text, bool& _flag, bool _enabled) +{ + if (imguiCheck(_text, _flag, _enabled) ) + { + _flag = !_flag; + } +} + bool imguiCollapse(const char* _text, const char* _subtext, bool _checked, bool _enabled) { return s_imgui.collapse(_text, _subtext, _checked, _enabled); @@ -3016,34 +3043,6 @@ uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...) return _selected; } -void imguiDrawText(int32_t _x, int32_t _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb) -{ - s_imgui.drawText(_x, _y, _align, _text, _argb); -} - -void imguiDrawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _argb) -{ - s_imgui.drawLine(_x0, _y0, _x1, _y1, _r, _argb); -} - -void imguiDrawRoundedRect(float _x, float _y, float _width, float _height, float _r, uint32_t _argb) -{ - s_imgui.drawRoundedRect(_x, _y, _width, _height, _r, _argb); -} - -void imguiDrawRect(float _x, float _y, float _width, float _height, uint32_t _argb) -{ - s_imgui.drawRect(_x, _y, _width, _height, _argb); -} - -void imguiBool(const char* _text, bool& _flag, bool _enabled) -{ - if (imguiCheck(_text, _flag, _enabled) ) - { - _flag = !_flag; - } -} - void imguiColorWheel(float _rgb[3], bool _respectIndentation, bool _enabled) { s_imgui.colorWheelWidget(_rgb, _respectIndentation, _enabled); @@ -3089,11 +3088,6 @@ void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align); } -bool imguiMouseOverArea() -{ - return s_imgui.m_insideArea; -} - float imguiGetTextLength(const char* _text, ImguiFontHandle _handle) { #if !USE_NANOVG_FONT @@ -3103,3 +3097,8 @@ float imguiGetTextLength(const char* _text, ImguiFontHandle _handle) return 0.0f; #endif } + +bool imguiMouseOverArea() +{ + return s_imgui.m_insideArea; +} diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index 5b4421d2..e55a139c 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -126,6 +126,11 @@ void imguiDestroy(); void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar = 0, uint8_t _view = 31); void imguiEndFrame(); +void imguiDrawText(int _x, int _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb); +void imguiDrawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _argb); +void imguiDrawRoundedRect(float _x, float _y, float _w, float _h, float _r, uint32_t _argb); +void imguiDrawRect(float _x, float _y, float _w, float _h, uint32_t _argb); + /// Notice: this function is not to be called between imguiBeginArea() and imguiEndArea(). bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled = true); @@ -148,6 +153,7 @@ int32_t imguiGetWidgetY(); 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); bool imguiItem(const char* _text, bool _enabled = true); bool imguiCheck(const char* _text, bool _checked, bool _enabled = true); +void imguiBool(const char* _text, bool& _flag, bool _enabled = true); bool imguiCollapse(const char* _text, const char* _subtext, bool _checked, bool _enabled = true); void imguiLabel(const char* _format, ...); void imguiLabel(uint32_t _rgba, const char* _format, ...); @@ -165,12 +171,6 @@ uint8_t imguiTabsUseMacroInstead(uint8_t _selected, bool _enabled, ImguiAlign::E uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...); #define imguiChoose(...) imguiChooseUseMacroInstead(__VA_ARGS__, NULL) -void imguiDrawText(int _x, int _y, ImguiTextAlign::Enum _align, const char* _text, uint32_t _argb); -void imguiDrawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _argb); -void imguiDrawRoundedRect(float _x, float _y, float _w, float _h, float _r, uint32_t _argb); -void imguiDrawRect(float _x, float _y, float _w, float _h, uint32_t _argb); - -void imguiBool(const char* _text, bool& _flag, bool _enabled = true); void imguiColorWheel(float _rgb[3], bool _respectIndentation = false, bool _enabled = true); void imguiColorWheel(const char* _str, float _rgb[3], bool& _activated, bool _enabled = true); @@ -179,7 +179,7 @@ void imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _asp void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented); void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented); -bool imguiMouseOverArea(); float imguiGetTextLength(const char* _text, ImguiFontHandle _handle); +bool imguiMouseOverArea(); #endif // IMGUI_H_HEADER_GUARD