mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-27 12:11:34 +00:00
Merge branch 'master' of https://github.com/jtilander/imgui into jtilander-master
Conflicts: imgui.cpp
This commit is contained in:
commit
e36fad65dd
256
imgui.cpp
256
imgui.cpp
@ -1036,7 +1036,8 @@ struct ImGuiState
|
||||
}
|
||||
};
|
||||
|
||||
static ImGuiState GImGui;
|
||||
static ImGuiState GImDefaultState;
|
||||
static ImGuiState* GImGui = &GImDefaultState;
|
||||
|
||||
struct ImGuiWindow
|
||||
{
|
||||
@ -1091,32 +1092,32 @@ public:
|
||||
void FocusItemUnregister();
|
||||
|
||||
ImGuiAabb Aabb() const { return ImGuiAabb(Pos, Pos+Size); }
|
||||
ImFont* Font() const { return GImGui.Font; }
|
||||
float FontSize() const { return GImGui.FontSize * FontWindowScale; }
|
||||
ImFont* Font() const { return GImGui->Font; }
|
||||
float FontSize() const { return GImGui->FontSize * FontWindowScale; }
|
||||
ImVec2 CursorPos() const { return DC.CursorPos; }
|
||||
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui.Style.FramePadding.y * 2.0f; }
|
||||
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui->Style.FramePadding.y * 2.0f; }
|
||||
ImGuiAabb TitleBarAabb() const { return ImGuiAabb(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
|
||||
ImVec2 WindowPadding() const { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(1,1) : GImGui.Style.WindowPadding; }
|
||||
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui.Style.Colors[idx]; c.w *= GImGui.Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
|
||||
ImU32 Color(const ImVec4& col) const { ImVec4 c = col; c.w *= GImGui.Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
|
||||
ImVec2 WindowPadding() const { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(1,1) : GImGui->Style.WindowPadding; }
|
||||
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
|
||||
ImU32 Color(const ImVec4& col) const { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
|
||||
};
|
||||
|
||||
static ImGuiWindow* GetCurrentWindow()
|
||||
{
|
||||
IM_ASSERT(GImGui.CurrentWindow != NULL); // ImGui::NewFrame() hasn't been called yet?
|
||||
GImGui.CurrentWindow->Accessed = true;
|
||||
return GImGui.CurrentWindow;
|
||||
IM_ASSERT(GImGui->CurrentWindow != NULL); // ImGui::NewFrame() hasn't been called yet?
|
||||
GImGui->CurrentWindow->Accessed = true;
|
||||
return GImGui->CurrentWindow;
|
||||
}
|
||||
|
||||
static void SetActiveId(ImGuiID id)
|
||||
{
|
||||
GImGui.ActiveId = id;
|
||||
GImGui->ActiveId = id;
|
||||
}
|
||||
|
||||
static void RegisterAliveId(const ImGuiID& id)
|
||||
{
|
||||
if (GImGui.ActiveId == id)
|
||||
GImGui.ActiveIdIsAlive = true;
|
||||
if (GImGui->ActiveId == id)
|
||||
GImGui->ActiveIdIsAlive = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1247,7 +1248,7 @@ void ImGuiTextFilter::Draw(const char* label, float width)
|
||||
if (width < 0.0f)
|
||||
{
|
||||
ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
||||
width = ImMax(window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x - (label_size.x + GImGui.Style.ItemSpacing.x*4), 10.0f);
|
||||
width = ImMax(window->Pos.x + ImGui::GetContentRegionMax().x - window->DC.CursorPos.x - (label_size.x + GImGui->Style.ItemSpacing.x*4), 10.0f);
|
||||
}
|
||||
ImGui::PushItemWidth(width);
|
||||
ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
|
||||
@ -1429,7 +1430,7 @@ ImGuiID ImGuiWindow::GetID(const void* ptr)
|
||||
|
||||
bool ImGuiWindow::FocusItemRegister(bool is_active, bool tab_stop)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
const bool allow_keyboard_focus = window->DC.AllowKeyboardFocus.back();
|
||||
@ -1463,7 +1464,7 @@ void ImGuiWindow::FocusItemUnregister()
|
||||
|
||||
void ImGuiWindow::AddToRenderList()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
if (!DrawList->commands.empty() && !DrawList->vtx_buffer.empty())
|
||||
{
|
||||
@ -1483,17 +1484,17 @@ void ImGuiWindow::AddToRenderList()
|
||||
|
||||
void* ImGui::MemAlloc(size_t sz)
|
||||
{
|
||||
return GImGui.IO.MemAllocFn(sz);
|
||||
return GImGui->IO.MemAllocFn(sz);
|
||||
}
|
||||
|
||||
void ImGui::MemFree(void* ptr)
|
||||
{
|
||||
return GImGui.IO.MemFreeFn(ptr);
|
||||
return GImGui->IO.MemFreeFn(ptr);
|
||||
}
|
||||
|
||||
static ImGuiIniData* FindWindowSettings(const char* name)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
for (size_t i = 0; i != g.Settings.size(); i++)
|
||||
{
|
||||
ImGuiIniData* ini = g.Settings[i];
|
||||
@ -1511,7 +1512,7 @@ static ImGuiIniData* AddWindowSettings(const char* name)
|
||||
ini->Collapsed = false;
|
||||
ini->Pos = ImVec2(FLT_MAX,FLT_MAX);
|
||||
ini->Size = ImVec2(0,0);
|
||||
GImGui.Settings.push_back(ini);
|
||||
GImGui->Settings.push_back(ini);
|
||||
return ini;
|
||||
}
|
||||
|
||||
@ -1519,7 +1520,7 @@ static ImGuiIniData* AddWindowSettings(const char* name)
|
||||
// FIXME: Write something less rubbish
|
||||
static void LoadSettings()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
const char* filename = g.IO.IniFilename;
|
||||
if (!filename)
|
||||
return;
|
||||
@ -1565,7 +1566,7 @@ static void LoadSettings()
|
||||
|
||||
static void SaveSettings()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
const char* filename = g.IO.IniFilename;
|
||||
if (!filename)
|
||||
return;
|
||||
@ -1604,25 +1605,44 @@ static void SaveSettings()
|
||||
|
||||
static void MarkSettingsDirty()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
if (g.SettingsDirtyTimer <= 0.0f)
|
||||
g.SettingsDirtyTimer = g.IO.IniSavingRate;
|
||||
}
|
||||
|
||||
void* ImGui::GetInternalState()
|
||||
{
|
||||
return GImGui;
|
||||
}
|
||||
|
||||
unsigned ImGui::GetInternalStateSize()
|
||||
{
|
||||
return sizeof(ImGuiState);
|
||||
}
|
||||
|
||||
void ImGui::SetInternalState(void* state, bool construct)
|
||||
{
|
||||
if( construct )
|
||||
new (state) ImGuiState;
|
||||
|
||||
GImGui = (ImGuiState*)state;
|
||||
}
|
||||
|
||||
|
||||
ImGuiIO& ImGui::GetIO()
|
||||
{
|
||||
return GImGui.IO;
|
||||
return GImGui->IO;
|
||||
}
|
||||
|
||||
ImGuiStyle& ImGui::GetStyle()
|
||||
{
|
||||
return GImGui.Style;
|
||||
return GImGui->Style;
|
||||
}
|
||||
|
||||
void ImGui::NewFrame()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
// Check user data
|
||||
IM_ASSERT(g.IO.DeltaTime > 0.0f);
|
||||
@ -1779,7 +1799,7 @@ void ImGui::NewFrame()
|
||||
// NB: behaviour of ImGui after Shutdown() is not tested/guaranteed at the moment. This function is merely here to free heap allocations.
|
||||
void ImGui::Shutdown()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
if (!g.Initialized)
|
||||
return;
|
||||
|
||||
@ -1867,7 +1887,7 @@ static void PopClipRect()
|
||||
|
||||
void ImGui::Render()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
||||
|
||||
const bool first_render_of_the_frame = (g.FrameCountRendered != g.FrameCount);
|
||||
@ -1967,7 +1987,7 @@ static const char* FindTextDisplayEnd(const char* text, const char* text_end =
|
||||
// Pass text data straight to log (without being displayed)
|
||||
void ImGui::LogText(const char* fmt, ...)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
if (!g.LogEnabled)
|
||||
return;
|
||||
|
||||
@ -1987,7 +2007,7 @@ void ImGui::LogText(const char* fmt, ...)
|
||||
// Internal version that takes a position to decide on newline placement and pad items according to their depth.
|
||||
static void LogText(const ImVec2& ref_pos, const char* text, const char* text_end)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
if (!text_end)
|
||||
@ -2053,7 +2073,7 @@ static float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)
|
||||
// RenderText() calls ImDrawList::AddText() calls ImBitmapFont::RenderText()
|
||||
static void RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash, float wrap_width)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
// Hide anything after a '##' string
|
||||
@ -2125,7 +2145,7 @@ static void RenderCollapseTriangle(ImVec2 p_min, bool opened, float scale, bool
|
||||
}
|
||||
|
||||
// Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker.
|
||||
// CalcTextSize("") should return ImVec2(0.0f, GImGui.FontSize)
|
||||
// CalcTextSize("") should return ImVec2(0.0f, GImGui->FontSize)
|
||||
ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -2152,7 +2172,7 @@ ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_tex
|
||||
// Find window given position, search front-to-back
|
||||
static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
for (int i = (int)g.Windows.size()-1; i >= 0; i--)
|
||||
{
|
||||
ImGuiWindow* window = g.Windows[(size_t)i];
|
||||
@ -2172,7 +2192,7 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
|
||||
// NB- Expand the aabb to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
|
||||
static bool IsMouseHoveringBox(const ImGuiAabb& box)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
// Clip
|
||||
@ -2195,14 +2215,14 @@ bool ImGui::IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max)
|
||||
|
||||
bool ImGui::IsMouseHoveringWindow()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return g.HoveredWindow == window;
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseHoveringAnyWindow()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
return g.HoveredWindow != NULL;
|
||||
}
|
||||
|
||||
@ -2213,14 +2233,14 @@ bool ImGui::IsPosHoveringAnyWindow(const ImVec2& pos)
|
||||
|
||||
static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
const int key_index = g.IO.KeyMap[key];
|
||||
return ImGui::IsKeyPressed(key_index, repeat);
|
||||
}
|
||||
|
||||
bool ImGui::IsKeyPressed(int key_index, bool repeat)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
|
||||
const float t = g.IO.KeysDownTime[key_index];
|
||||
if (t == 0.0f)
|
||||
@ -2238,7 +2258,7 @@ bool ImGui::IsKeyPressed(int key_index, bool repeat)
|
||||
|
||||
bool ImGui::IsMouseClicked(int button, bool repeat)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
const float t = g.IO.MouseDownTime[button];
|
||||
if (t == 0.0f)
|
||||
@ -2256,14 +2276,14 @@ bool ImGui::IsMouseClicked(int button, bool repeat)
|
||||
|
||||
bool ImGui::IsMouseDoubleClicked(int button)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
return g.IO.MouseDoubleClicked[button];
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetMousePos()
|
||||
{
|
||||
return GImGui.IO.MousePos;
|
||||
return GImGui->IO.MousePos;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemHovered()
|
||||
@ -2274,7 +2294,7 @@ bool ImGui::IsItemHovered()
|
||||
|
||||
bool ImGui::IsItemActive()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
if (g.ActiveId)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -2298,7 +2318,7 @@ ImVec2 ImGui::GetItemBoxMax()
|
||||
// Tooltip is stored and turned into a BeginTooltip()/EndTooltip() sequence at the end of the frame. Each call override previous value.
|
||||
void ImGui::SetTooltipV(const char* fmt, va_list args)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImFormatStringV(g.Tooltip, IM_ARRAYSIZE(g.Tooltip), fmt, args);
|
||||
}
|
||||
|
||||
@ -2312,17 +2332,17 @@ void ImGui::SetTooltip(const char* fmt, ...)
|
||||
|
||||
float ImGui::GetTime()
|
||||
{
|
||||
return GImGui.Time;
|
||||
return GImGui->Time;
|
||||
}
|
||||
|
||||
int ImGui::GetFrameCount()
|
||||
{
|
||||
return GImGui.FrameCount;
|
||||
return GImGui->FrameCount;
|
||||
}
|
||||
|
||||
void ImGui::BeginTooltip()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_Tooltip;
|
||||
ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), g.Style.Colors[ImGuiCol_TooltipBg].w, window_flags);
|
||||
}
|
||||
@ -2335,7 +2355,7 @@ void ImGui::EndTooltip()
|
||||
|
||||
void ImGui::BeginChild(const char* str_id, ImVec2 size, bool border, ImGuiWindowFlags extra_flags)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
|
||||
@ -2394,7 +2414,7 @@ void ImGui::EndChild()
|
||||
static ImGuiWindow* FindWindowByName(const char* name)
|
||||
{
|
||||
// FIXME-OPT: Consider optimizing this (e.g. sorted hashes to window pointers)
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
for (size_t i = 0; i != g.Windows.size(); i++)
|
||||
if (strcmp(g.Windows[i]->Name, name) == 0)
|
||||
return g.Windows[i];
|
||||
@ -2403,7 +2423,7 @@ static ImGuiWindow* FindWindowByName(const char* name)
|
||||
|
||||
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
// Create window the first time
|
||||
ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow));
|
||||
@ -2458,7 +2478,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
||||
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCondition_FirstUseEver) prior to calling Begin().
|
||||
bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alpha, ImGuiWindowFlags flags)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
||||
IM_ASSERT(name != NULL); // Must pass a name
|
||||
@ -2878,7 +2898,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
||||
|
||||
void ImGui::End()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
ImGui::Columns(1, "#CloseColumns");
|
||||
@ -2899,7 +2919,7 @@ void ImGui::End()
|
||||
// Moving window to front of display (which happens to be back of our sorted list)
|
||||
static void FocusWindow(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
g.FocusedWindow = window;
|
||||
|
||||
if (g.Windows.back() == window)
|
||||
@ -2935,7 +2955,7 @@ float ImGui::GetItemWidth()
|
||||
|
||||
static void SetFont(ImFont* font)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
IM_ASSERT(font && font->IsLoaded());
|
||||
IM_ASSERT(font->Scale > 0.0f);
|
||||
@ -2948,7 +2968,7 @@ static void SetFont(ImFont* font)
|
||||
|
||||
void ImGui::PushFont(ImFont* font)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
if (!font)
|
||||
font = g.IO.Fonts->Fonts[0];
|
||||
@ -2960,7 +2980,7 @@ void ImGui::PushFont(ImFont* font)
|
||||
|
||||
void ImGui::PopFont()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
g.CurrentWindow->DrawList->PopTextureID();
|
||||
g.FontStack.pop_back();
|
||||
@ -2993,7 +3013,7 @@ void ImGui::PopTextWrapPos()
|
||||
|
||||
void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
ImGuiColMod backup;
|
||||
backup.Col = idx;
|
||||
@ -3004,7 +3024,7 @@ void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)
|
||||
|
||||
void ImGui::PopStyleColor(int count)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
@ -3017,7 +3037,7 @@ void ImGui::PopStyleColor(int count)
|
||||
|
||||
static float* GetStyleVarFloatAddr(ImGuiStyleVar idx)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
switch (idx)
|
||||
{
|
||||
case ImGuiStyleVar_Alpha: return &g.Style.Alpha;
|
||||
@ -3030,7 +3050,7 @@ static float* GetStyleVarFloatAddr(ImGuiStyleVar idx)
|
||||
|
||||
static ImVec2* GetStyleVarVec2Addr(ImGuiStyleVar idx)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
switch (idx)
|
||||
{
|
||||
case ImGuiStyleVar_WindowPadding: return &g.Style.WindowPadding;
|
||||
@ -3043,7 +3063,7 @@ static ImVec2* GetStyleVarVec2Addr(ImGuiStyleVar idx)
|
||||
|
||||
void ImGui::PushStyleVar(ImGuiStyleVar idx, float val)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
float* pvar = GetStyleVarFloatAddr(idx);
|
||||
IM_ASSERT(pvar != NULL); // Called function with wrong-type? Variable is not a float.
|
||||
@ -3057,7 +3077,7 @@ void ImGui::PushStyleVar(ImGuiStyleVar idx, float val)
|
||||
|
||||
void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
ImVec2* pvar = GetStyleVarVec2Addr(idx);
|
||||
IM_ASSERT(pvar != NULL); // Called function with wrong-type? Varialble is not a ImVec2.
|
||||
@ -3070,7 +3090,7 @@ void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
||||
|
||||
void ImGui::PopStyleVar(int count)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
@ -3134,7 +3154,7 @@ const char* ImGui::GetStyleColName(ImGuiCol idx)
|
||||
|
||||
bool ImGui::GetWindowIsFocused()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return g.FocusedWindow == window;
|
||||
}
|
||||
@ -3211,21 +3231,21 @@ void ImGui::SetWindowCollapsed(bool collapsed, ImGuiSetCondition cond)
|
||||
|
||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCondition cond)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowPosVal = pos;
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiSetCondition_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowSizeVal = size;
|
||||
g.SetNextWindowSizeCond = cond ? cond : ImGuiSetCondition_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiSetCondition cond)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowCollapsedVal = collapsed;
|
||||
g.SetNextWindowCollapsedCond = cond ? cond : ImGuiSetCondition_Always;
|
||||
}
|
||||
@ -3238,12 +3258,12 @@ ImVec2 ImGui::GetContentRegionMax()
|
||||
if (window->DC.ColumnsCount != 1)
|
||||
{
|
||||
m.x = GetColumnOffset(window->DC.ColumnsCurrent + 1);
|
||||
m.x -= GImGui.Style.WindowPadding.x;
|
||||
m.x -= GImGui->Style.WindowPadding.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->ScrollbarY)
|
||||
m.x -= GImGui.Style.ScrollBarWidth;
|
||||
m.x -= GImGui->Style.ScrollBarWidth;
|
||||
}
|
||||
|
||||
return m;
|
||||
@ -3260,7 +3280,7 @@ ImVec2 ImGui::GetWindowContentRegionMax()
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
ImVec2 m = window->Size - window->WindowPadding();
|
||||
if (window->ScrollbarY)
|
||||
m.x -= GImGui.Style.ScrollBarWidth;
|
||||
m.x -= GImGui->Style.ScrollBarWidth;
|
||||
return m;
|
||||
}
|
||||
|
||||
@ -3272,7 +3292,7 @@ float ImGui::GetTextLineHeight()
|
||||
|
||||
float ImGui::GetTextLineSpacing()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return window->FontSize() + g.Style.ItemSpacing.y;
|
||||
}
|
||||
@ -3415,7 +3435,7 @@ void ImGui::TextWrapped(const char* fmt, ...)
|
||||
|
||||
void ImGui::TextUnformatted(const char* text, const char* text_end)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -3517,7 +3537,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
||||
|
||||
void ImGui::AlignFirstTextHeightToWidgets()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -3530,7 +3550,7 @@ void ImGui::AlignFirstTextHeightToWidgets()
|
||||
// Add a label+text combo aligned to other label+value widgets
|
||||
void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -3563,7 +3583,7 @@ void ImGui::LabelText(const char* label, const char* fmt, ...)
|
||||
|
||||
static bool IsHovered(const ImGuiAabb& bb, const ImGuiID& id)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
if (g.HoveredId == 0)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -3575,7 +3595,7 @@ static bool IsHovered(const ImGuiAabb& bb, const ImGuiID& id)
|
||||
|
||||
static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
const bool hovered = IsHovered(bb, id);
|
||||
@ -3620,7 +3640,7 @@ static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_ho
|
||||
|
||||
bool ImGui::Button(const char* label, const ImVec2& size_arg, bool repeat_when_held)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -3656,7 +3676,7 @@ bool ImGui::Button(const char* label, const ImVec2& size_arg, bool repeat_when_h
|
||||
// Small buttons fits within text without additional spacing.
|
||||
bool ImGui::SmallButton(const char* label)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -3761,7 +3781,7 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2&
|
||||
// The color used are the button colors.
|
||||
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -3798,7 +3818,7 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
|
||||
// Start logging ImGui output to TTY
|
||||
void ImGui::LogToTTY(int max_depth)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (g.LogEnabled)
|
||||
return;
|
||||
@ -3813,7 +3833,7 @@ void ImGui::LogToTTY(int max_depth)
|
||||
// Start logging ImGui output to given file
|
||||
void ImGui::LogToFile(int max_depth, const char* filename)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (g.LogEnabled)
|
||||
return;
|
||||
@ -3836,7 +3856,7 @@ void ImGui::LogToFile(int max_depth, const char* filename)
|
||||
void ImGui::LogToClipboard(int max_depth)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
if (g.LogEnabled)
|
||||
return;
|
||||
|
||||
@ -3849,7 +3869,7 @@ void ImGui::LogToClipboard(int max_depth)
|
||||
|
||||
void ImGui::LogFinish()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
if (!g.LogEnabled)
|
||||
return;
|
||||
|
||||
@ -3874,7 +3894,7 @@ void ImGui::LogFinish()
|
||||
// Helper to display logging buttons
|
||||
void ImGui::LogButtons()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
ImGui::PushID("LogButtons");
|
||||
const bool log_to_tty = ImGui::Button("Log To TTY");
|
||||
@ -3902,7 +3922,7 @@ void ImGui::LogButtons()
|
||||
|
||||
bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool display_frame, const bool default_open)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -4000,7 +4020,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool d
|
||||
// Text with a little bullet aligned to the typical tree node.
|
||||
void ImGui::BulletTextV(const char* fmt, va_list args)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -4161,7 +4181,7 @@ static void ApplyNumericalTextInput(const char* buf, float *v)
|
||||
|
||||
float ref_v = *v;
|
||||
if (op)
|
||||
if (sscanf(GImGui.InputTextState.InitialText, "%f", &ref_v) < 1)
|
||||
if (sscanf(GImGui->InputTextState.InitialText, "%f", &ref_v) < 1)
|
||||
return;
|
||||
|
||||
float op_v = 0.0f;
|
||||
@ -4186,7 +4206,7 @@ static void ApplyNumericalTextInput(const char* buf, float *v)
|
||||
// Adjust display_format to decorate the value with a prefix or a suffix.
|
||||
bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -4426,7 +4446,7 @@ bool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const cha
|
||||
// Add multiple sliders on 1 line for compact edition of multiple components
|
||||
static bool SliderFloatN(const char* label, float v[3], int components, float v_min, float v_max, const char* display_format, float power)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -4476,7 +4496,7 @@ bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max
|
||||
|
||||
static bool SliderIntN(const char* label, int v[3], int components, int v_min, int v_max, const char* display_format)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -4532,7 +4552,7 @@ enum ImGuiPlotType
|
||||
|
||||
static void Plot(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -4665,7 +4685,7 @@ void ImGui::PlotHistogram(const char* label, float (*values_getter)(void* data,
|
||||
|
||||
bool ImGui::Checkbox(const char* label, bool* v)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -4723,7 +4743,7 @@ bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int f
|
||||
|
||||
bool ImGui::RadioButton(const char* label, bool active)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -4933,7 +4953,7 @@ void ImGuiTextEditState::RenderTextScrolledClipped(ImFont* font, float font_size
|
||||
|
||||
bool ImGui::InputFloat(const char* label, float *v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -5062,7 +5082,7 @@ static bool InputTextFilterCharacter(ImWchar c, ImGuiInputTextFlags flags)
|
||||
// Edit a string of text
|
||||
bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, void (*callback)(ImGuiTextEditCallbackData*), void* user_data)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -5355,7 +5375,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
|
||||
|
||||
static bool InputFloatN(const char* label, float* v, int components, int decimal_precision)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -5455,7 +5475,7 @@ bool ImGui::Combo(const char* label, int* current_item, const char* items_separa
|
||||
// Combo box function.
|
||||
bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int popup_height_items)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -5577,7 +5597,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
||||
// A little colored square. Return true when clicked.
|
||||
bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_border)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -5624,7 +5644,7 @@ bool ImGui::ColorEdit3(const char* label, float col[3])
|
||||
// Use CTRL-Click to input value and TAB to go to next item.
|
||||
bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
@ -5807,7 +5827,7 @@ void ImGui::Spacing()
|
||||
// Advance cursor given item size.
|
||||
static void ItemSize(ImVec2 size, ImVec2* adjust_vertical_offset)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -5833,7 +5853,7 @@ static void ItemSize(const ImGuiAabb& aabb, ImVec2* adjust_start_offset)
|
||||
|
||||
static bool IsClipped(const ImGuiAabb& bb)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
if (!bb.Overlaps(ImGuiAabb(window->ClipRectStack.back())) && !g.LogEnabled)
|
||||
@ -5868,7 +5888,7 @@ static bool ItemAdd(const ImGuiAabb& bb, const ImGuiID* id)
|
||||
// spacing_w >= 0 : enforce spacing
|
||||
void ImGui::SameLine(int column_x, int spacing_w)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -5892,7 +5912,7 @@ void ImGui::SameLine(int column_x, int spacing_w)
|
||||
|
||||
void ImGui::NextColumn()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -5924,7 +5944,7 @@ void ImGui::NextColumn()
|
||||
|
||||
float ImGui::GetColumnOffset(int column_index)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (column_index < 0)
|
||||
column_index = window->DC.ColumnsCurrent;
|
||||
@ -5940,7 +5960,7 @@ float ImGui::GetColumnOffset(int column_index)
|
||||
|
||||
void ImGui::SetColumnOffset(int column_index, float offset)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (column_index < 0)
|
||||
column_index = window->DC.ColumnsCurrent;
|
||||
@ -5973,7 +5993,7 @@ static void PushColumnClipRect(int column_index)
|
||||
|
||||
void ImGui::Columns(int columns_count, const char* id, bool border)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
@ -6041,7 +6061,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
||||
|
||||
void ImGui::TreePush(const char* str_id)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->DC.ColumnsStartX += g.Style.TreeNodeSpacing;
|
||||
window->DC.CursorPos.x = window->Pos.x + window->DC.ColumnsStartX + window->DC.ColumnsOffsetX;
|
||||
@ -6051,7 +6071,7 @@ void ImGui::TreePush(const char* str_id)
|
||||
|
||||
void ImGui::TreePush(const void* ptr_id)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->DC.ColumnsStartX += g.Style.TreeNodeSpacing;
|
||||
window->DC.CursorPos.x = window->Pos.x + window->DC.ColumnsStartX + window->DC.ColumnsOffsetX;
|
||||
@ -6061,7 +6081,7 @@ void ImGui::TreePush(const void* ptr_id)
|
||||
|
||||
void ImGui::TreePop()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->DC.ColumnsStartX -= g.Style.TreeNodeSpacing;
|
||||
window->DC.CursorPos.x = window->Pos.x + window->DC.ColumnsStartX + window->DC.ColumnsOffsetX;
|
||||
@ -6229,7 +6249,7 @@ void ImDrawList::AddVtx(const ImVec2& pos, ImU32 col)
|
||||
{
|
||||
vtx_write->pos = pos;
|
||||
vtx_write->col = col;
|
||||
vtx_write->uv = GImGui.FontTexUvWhitePixel;
|
||||
vtx_write->uv = GImGui->FontTexUvWhitePixel;
|
||||
vtx_write++;
|
||||
}
|
||||
|
||||
@ -7553,21 +7573,21 @@ static void SetClipboardTextFn_DefaultImpl(const char* text)
|
||||
// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
|
||||
static const char* GetClipboardTextFn_DefaultImpl()
|
||||
{
|
||||
return GImGui.PrivateClipboard;
|
||||
return GImGui->PrivateClipboard;
|
||||
}
|
||||
|
||||
// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
|
||||
static void SetClipboardTextFn_DefaultImpl(const char* text)
|
||||
{
|
||||
if (GImGui.PrivateClipboard)
|
||||
if (GImGui->PrivateClipboard)
|
||||
{
|
||||
ImGui::MemFree(GImGui.PrivateClipboard);
|
||||
GImGui.PrivateClipboard = NULL;
|
||||
ImGui::MemFree(GImGui->PrivateClipboard);
|
||||
GImGui->PrivateClipboard = NULL;
|
||||
}
|
||||
const char* text_end = text + strlen(text);
|
||||
GImGui.PrivateClipboard = (char*)ImGui::MemAlloc((size_t)(text_end - text) + 1);
|
||||
memcpy(GImGui.PrivateClipboard, text, (size_t)(text_end - text));
|
||||
GImGui.PrivateClipboard[(size_t)(text_end - text)] = 0;
|
||||
GImGui->PrivateClipboard = (char*)ImGui::MemAlloc((size_t)(text_end - text) + 1);
|
||||
memcpy(GImGui->PrivateClipboard, text, (size_t)(text_end - text));
|
||||
GImGui->PrivateClipboard[(size_t)(text_end - text)] = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -7578,7 +7598,7 @@ static void SetClipboardTextFn_DefaultImpl(const char* text)
|
||||
|
||||
void ImGui::ShowUserGuide()
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
ImGui::BulletText("Double-click on title bar to collapse window.");
|
||||
ImGui::BulletText("Click and drag on lower right corner to resize window.");
|
||||
@ -7602,7 +7622,7 @@ void ImGui::ShowUserGuide()
|
||||
|
||||
void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
{
|
||||
ImGuiState& g = GImGui;
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiStyle& style = g.Style;
|
||||
|
||||
const ImGuiStyle def; // Default style
|
||||
|
3
imgui.h
3
imgui.h
@ -146,6 +146,9 @@ public:
|
||||
namespace ImGui
|
||||
{
|
||||
// Main
|
||||
IMGUI_API void* GetInternalState();
|
||||
IMGUI_API unsigned GetInternalStateSize();
|
||||
IMGUI_API void SetInternalState(void* state, bool construct = false);
|
||||
IMGUI_API ImGuiIO& GetIO();
|
||||
IMGUI_API ImGuiStyle& GetStyle();
|
||||
IMGUI_API void NewFrame();
|
||||
|
Loading…
Reference in New Issue
Block a user