Finality Engine
Loading...
Searching...
No Matches
ImGUIPanel.h
Go to the documentation of this file.
1
6#pragma once
7#include <Core/Core.h>
8#include <string>
9
10#include <glm/glm.hpp>
11
12namespace FINALITY
13{
16 {
76 };
77
79 using PanelColor = int;
80
97
98 using PanelFlags = int;
99
100
109
110 using PanelCondition = int;
111
127
128 using PanelPopupFlags = int;
129
132 {
133 public:
134 ImGUIPanel(const std::string& name, bool* p_open = (bool*)0, PanelFlags flags = 0);
136
137 void Text(std::string_view text);
138 void Text(std::string_view fmt, float value);
139 void Text(std::string_view fmt, unsigned int value);
140 void Text(std::string_view fmt, unsigned int val1, float val2);
141
142 void Separator();
143
144 void TextColored(const glm::vec4& col, std::string_view text);
145 bool Checkbox(std::string_view label, bool* v);
146 bool RadioButton(std::string_view label, int* v, int v_button);
147 void SameLine(float offset_from_start_x = 0.0f, float spacing = -1.0f);
148 bool SliderFloat(std::string_view label, float* v, float v_min, float v_max, std::string_view format = "%.3f");
149 bool DragInt(std::string_view label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0);
150 bool Combo(std::string_view label, int* current_item, const char* const items[], int items_count);
151 bool ColorEdit4(std::string_view label, float col[4]);
152 bool Button(std::string_view label, const glm::vec2& size = glm::vec2(0, 0));
153
154 bool BeginTabBar(std::string_view str_id);
155 void EndTabBar();
156
157 bool BeginTabItem(std::string_view label, bool* p_open = (bool*)0);
159
160 bool TreeNode(std::string_view label);
161 void TreePop();
162
164 std::string_view label,
165 const float* values,
166 int values_count,
167 int values_offset = 0,
168 std::string_view overlay_text = "",
169 float scale_min = FLT_MAX,
170 float scale_max = FLT_MAX,
171 glm::vec2 graph_size = glm::vec2(0.0f, 0.0f)
172 );
173
174 static void SetNextWindowPos(const glm::vec2& pos, PanelCondition cond = PanelCondition_Always, const glm::vec2& pivot = glm::vec2(0.0f, 0.0f));
175 static void SetNextWindowBgAlpha(float alpha);
176
177 void Image(void* textureHandle, const glm::vec2& size, const glm::vec2& uv0 = glm::vec2(0.0f, 0.0f), const glm::vec2& uv1 = glm::vec2(1.0f, 1.0f));
179
180 bool IsFocused();
181 bool IsHovered();
182
183 static bool BeginMainMenuBar();
184 static void EndMainMenuBar();
185 static bool BeginMenu(std::string_view label);
186 static void EndMenu();
187 static bool MenuItem(std::string_view label, std::string_view shortcut = "");
188
189 bool BeginChild(std::string_view str_id, const glm::vec2& size = glm::vec2(0.0f, 0.0f), bool border = false, PanelFlags flags = 0);
190 void EndChild();
191 bool Selectable(std::string_view label, bool selected = false);
192 void PushStyleColor(int idx, const glm::vec4& col);
193 void PopStyleColor(int count = 1);
195
196 void SetScrollHereY(float center_y_ratio = 0.5f);
197 bool InputText(std::string_view label, std::string* str, PanelFlags flags = 0);
198
199 float GetFontSize();
201 void PushItemWidth(float item_width);
204
205 void PushID(int int_id);
206 void PushID(std::string_view str_id);
207 void PopID();
208
211
212 void SetCursorPosX(float x);
213 float CalcTextWidth(const std::string& text);
214 bool TreeNode(std::string_view label, bool selected);
215 bool IsItemClicked(int mouseButton = 0);
216
217 void Indent(float width = 0.0f);
218 void Unindent(float width = 0.0f);
219 void Spacing();
220
221 glm::vec2 GetWindowPadding();
222
223 void OpenPopup(std::string_view str_id, PanelPopupFlags popup_flags = 0);
224 bool BeginPopup(std::string_view str_id, PanelFlags flags = 0);
225 void EndPopup();
226
229 bool IsMouseClicked(int a);
230
232 private:
233 };
234}
#define FAPI
Definition Core.h:22
bool TreeNode(std::string_view label)
static bool BeginMainMenuBar()
bool RadioButton(std::string_view label, int *v, int v_button)
bool IsItemClicked(int mouseButton=0)
void Indent(float width=0.0f)
bool BeginPopup(std::string_view str_id, PanelFlags flags=0)
bool BeginChild(std::string_view str_id, const glm::vec2 &size=glm::vec2(0.0f, 0.0f), bool border=false, PanelFlags flags=0)
bool Checkbox(std::string_view label, bool *v)
void PopStyleColor(int count=1)
void Image(void *textureHandle, const glm::vec2 &size, const glm::vec2 &uv0=glm::vec2(0.0f, 0.0f), const glm::vec2 &uv1=glm::vec2(1.0f, 1.0f))
bool InputText(std::string_view label, std::string *str, PanelFlags flags=0)
bool BeginTabItem(std::string_view label, bool *p_open=(bool *) 0)
bool BeginTabBar(std::string_view str_id)
void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
void Unindent(float width=0.0f)
bool ColorEdit4(std::string_view label, float col[4])
void SetScrollHereY(float center_y_ratio=0.5f)
void PushID(std::string_view str_id)
ImGUIPanel(const std::string &name, bool *p_open=(bool *) 0, PanelFlags flags=0)
void Text(std::string_view fmt, unsigned int val1, float val2)
static bool MenuItem(std::string_view label, std::string_view shortcut="")
void Text(std::string_view text)
static void EndMainMenuBar()
glm::vec2 GetStyleItemSpacing()
bool Combo(std::string_view label, int *current_item, const char *const items[], int items_count)
static void SetNextWindowBgAlpha(float alpha)
bool SliderFloat(std::string_view label, float *v, float v_min, float v_max, std::string_view format="%.3f")
void Text(std::string_view fmt, unsigned int value)
bool Button(std::string_view label, const glm::vec2 &size=glm::vec2(0, 0))
bool DragInt(std::string_view label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0)
void PushItemWidth(float item_width)
void PushID(int int_id)
bool TreeNode(std::string_view label, bool selected)
void PlotLines(std::string_view label, const float *values, int values_count, int values_offset=0, std::string_view overlay_text="", float scale_min=FLT_MAX, float scale_max=FLT_MAX, glm::vec2 graph_size=glm::vec2(0.0f, 0.0f))
glm::vec2 GetWindowPadding()
static bool BeginMenu(std::string_view label)
bool IsMouseClicked(int a)
static void SetNextWindowPos(const glm::vec2 &pos, PanelCondition cond=PanelCondition_Always, const glm::vec2 &pivot=glm::vec2(0.0f, 0.0f))
float CalcTextWidth(const std::string &text)
void OpenPopup(std::string_view str_id, PanelPopupFlags popup_flags=0)
void TextColored(const glm::vec4 &col, std::string_view text)
glm::vec2 GetContentRegionAvail()
float GetTextLineHeightWithSpacing()
static void EndMenu()
void SetCursorPosX(float x)
void Text(std::string_view fmt, float value)
bool Selectable(std::string_view label, bool selected=false)
void PushStyleColor(int idx, const glm::vec4 &col)
@ PanelPopupFlags_NoOpenOverExistingPopup
Definition ImGUIPanel.h:121
@ PanelPopupFlags_MouseButtonMask_
Definition ImGUIPanel.h:119
@ PanelPopupFlags_MouseButtonRight
Definition ImGUIPanel.h:117
@ PanelPopupFlags_AnyPopup
Definition ImGUIPanel.h:125
@ PanelPopupFlags_MouseButtonMiddle
Definition ImGUIPanel.h:118
@ PanelPopupFlags_None
Definition ImGUIPanel.h:115
@ PanelPopupFlags_MouseButtonDefault_
Definition ImGUIPanel.h:120
@ PanelPopupFlags_NoOpenOverItems
Definition ImGUIPanel.h:122
@ PanelPopupFlags_AnyPopupLevel
Definition ImGUIPanel.h:124
@ PanelPopupFlags_AnyPopupId
Definition ImGUIPanel.h:123
@ PanelPopupFlags_MouseButtonLeft
Definition ImGUIPanel.h:116
@ PanelColor_DockingEmptyBg
Definition ImGUIPanel.h:59
@ PanelColor_ResizeGripHovered
Definition ImGUIPanel.h:48
@ PanelColor_NavWindowingHighlight
Definition ImGUIPanel.h:73
@ PanelColor_TabDimmed
Definition ImGUIPanel.h:55
@ PanelColor_PlotLines
Definition ImGUIPanel.h:60
@ PanelColor_SeparatorHovered
Definition ImGUIPanel.h:45
@ PanelColor_Separator
Definition ImGUIPanel.h:44
@ PanelColor_FrameBgHovered
Definition ImGUIPanel.h:25
@ PanelColor_Border
Definition ImGUIPanel.h:22
@ PanelColor_NavWindowingDimBg
Definition ImGUIPanel.h:74
@ PanelColor_InputTextCursor
Definition ImGUIPanel.h:50
@ PanelColor_TabSelectedOverline
Definition ImGUIPanel.h:54
@ PanelColor_WindowBg
Definition ImGUIPanel.h:19
@ PanelColor_ButtonHovered
Definition ImGUIPanel.h:39
@ PanelColor_ChildBg
Definition ImGUIPanel.h:20
@ PanelColor_HeaderActive
Definition ImGUIPanel.h:43
@ PanelColor_PlotHistogram
Definition ImGUIPanel.h:62
@ PanelColor_DockingPreview
Definition ImGUIPanel.h:58
@ PanelColor_TitleBg
Definition ImGUIPanel.h:27
@ PanelColor_TabHovered
Definition ImGUIPanel.h:51
@ PanelColor_SliderGrab
Definition ImGUIPanel.h:36
@ PanelColor_BorderShadow
Definition ImGUIPanel.h:23
@ PanelColor_ScrollbarGrabHovered
Definition ImGUIPanel.h:33
@ PanelColor_TableBorderStrong
Definition ImGUIPanel.h:65
@ PanelColor_ScrollbarBg
Definition ImGUIPanel.h:31
@ PanelColor_ResizeGripActive
Definition ImGUIPanel.h:49
@ PanelColor_ButtonActive
Definition ImGUIPanel.h:40
@ PanelColor_TableRowBg
Definition ImGUIPanel.h:67
@ PanelColor_ScrollbarGrab
Definition ImGUIPanel.h:32
@ PanelColor_ScrollbarGrabActive
Definition ImGUIPanel.h:34
@ PanelColor_Tab
Definition ImGUIPanel.h:52
@ PanelColor_Button
Definition ImGUIPanel.h:38
@ PanelColor_Text
Definition ImGUIPanel.h:17
@ PanelColor_TextDisabled
Definition ImGUIPanel.h:18
@ PanelColor_ModalWindowDimBg
Definition ImGUIPanel.h:75
@ PanelColor_ResizeGrip
Definition ImGUIPanel.h:47
@ PanelColor_PlotLinesHovered
Definition ImGUIPanel.h:61
@ PanelColor_Header
Definition ImGUIPanel.h:41
@ PanelColor_TextLink
Definition ImGUIPanel.h:69
@ PanelColor_TabSelected
Definition ImGUIPanel.h:53
@ PanelColor_TabDimmedSelected
Definition ImGUIPanel.h:56
@ PanelColor_PopupBg
Definition ImGUIPanel.h:21
@ PanelColor_SliderGrabActive
Definition ImGUIPanel.h:37
@ PanelColor_TitleBgActive
Definition ImGUIPanel.h:28
@ PanelColor_SeparatorActive
Definition ImGUIPanel.h:46
@ PanelColor_TableHeaderBg
Definition ImGUIPanel.h:64
@ PanelColor_FrameBgActive
Definition ImGUIPanel.h:26
@ PanelColor_PlotHistogramHovered
Definition ImGUIPanel.h:63
@ PanelColor_TitleBgCollapsed
Definition ImGUIPanel.h:29
@ PanelColor_TableRowBgAlt
Definition ImGUIPanel.h:68
@ PanelColor_MenuBarBg
Definition ImGUIPanel.h:30
@ PanelColor_CheckMark
Definition ImGUIPanel.h:35
@ PanelColor_TabDimmedSelectedOverline
Definition ImGUIPanel.h:57
@ PanelColor_HeaderHovered
Definition ImGUIPanel.h:42
@ PanelColor_TableBorderLight
Definition ImGUIPanel.h:66
@ PanelColor_DragDropTarget
Definition ImGUIPanel.h:71
@ PanelColor_NavCursor
Definition ImGUIPanel.h:72
@ PanelColor_TextSelectedBg
Definition ImGUIPanel.h:70
@ PanelColor_FrameBg
Definition ImGUIPanel.h:24
@ PanelFlags_NoFocusOnAppearing
Definition ImGUIPanel.h:93
@ PanelFlags_NoMove
Definition ImGUIPanel.h:87
@ PanelFlags_None
Definition ImGUIPanel.h:84
@ PanelFlags_NoNav
Definition ImGUIPanel.h:94
@ PanelFlags_NoDecoration
Definition ImGUIPanel.h:95
@ PanelFlags_NoBackground
Definition ImGUIPanel.h:91
@ PanelFlags_NoTitleBar
Definition ImGUIPanel.h:85
@ PanelFlags_AlwaysAutoResize
Definition ImGUIPanel.h:90
@ PanelFlags_NoScrollbar
Definition ImGUIPanel.h:88
@ PanelFlags_NoSavedSettings
Definition ImGUIPanel.h:92
@ PanelFlags_NoResize
Definition ImGUIPanel.h:86
@ PanelFlags_HorizontalScrollbar
Definition ImGUIPanel.h:89
@ PanelCondition_Always
Definition ImGUIPanel.h:104
@ PanelCondition_Appearing
Definition ImGUIPanel.h:107
@ PanelCondition_Once
Definition ImGUIPanel.h:105
@ PanelCondition_FirstUseEver
Definition ImGUIPanel.h:106
int PanelColor
Definition ImGUIPanel.h:79
int PanelCondition
Definition ImGUIPanel.h:110
int PanelFlags
Definition ImGUIPanel.h:98
int PanelPopupFlags
Definition ImGUIPanel.h:128