Updated ImGui.
This commit is contained in:
parent
86969904d9
commit
407381c404
242
3rdparty/ocornut-imgui/imgui.cpp
vendored
242
3rdparty/ocornut-imgui/imgui.cpp
vendored
@ -17,15 +17,15 @@
|
||||
- END-USER GUIDE
|
||||
- PROGRAMMER GUIDE (read me!)
|
||||
- Read first
|
||||
- Getting started with integrating imgui in your code/engine
|
||||
- How to update to a newer version of ImGui
|
||||
- Getting started with integrating ImGui in your code/engine
|
||||
- API BREAKING CHANGES (read me when you update!)
|
||||
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
|
||||
- How can I help?
|
||||
- How do I update to a newer version of ImGui?
|
||||
- What is ImTextureID and how do I display an image?
|
||||
- I integrated ImGui in my engine and the text or lines are blurry..
|
||||
- I integrated ImGui in my engine and some elements are clipping or disappearing when I move windows around..
|
||||
- How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs.
|
||||
- How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on labels/IDs.
|
||||
- How can I tell when ImGui wants my mouse/keyboard inputs VS when I can pass them to my application?
|
||||
- How can I load a different font than the default?
|
||||
- How can I easily use icons in my application?
|
||||
@ -40,19 +40,18 @@
|
||||
MISSION STATEMENT
|
||||
=================
|
||||
|
||||
- easy to use to create code-driven and data-driven tools
|
||||
- easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools
|
||||
- easy to hack and improve
|
||||
- minimize screen real-estate usage
|
||||
- minimize setup and maintenance
|
||||
- minimize state storage on user side
|
||||
- portable, minimize dependencies, run on target (consoles, phones, etc.)
|
||||
- efficient runtime (NB- we do allocate when "growing" content - creating a window / opening a tree node for the first time, etc. - but a typical frame won't allocate anything)
|
||||
- read about immediate-mode gui principles @ http://mollyrocket.com/861, http://mollyrocket.com/forums/index.html
|
||||
- Easy to use to create code-driven and data-driven tools
|
||||
- Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools
|
||||
- Easy to hack and improve
|
||||
- Minimize screen real-estate usage
|
||||
- Minimize setup and maintenance
|
||||
- Minimize state storage on user side
|
||||
- Portable, minimize dependencies, run on target (consoles, phones, etc.)
|
||||
- Efficient runtime and memory consumption (NB- we do allocate when "growing" content - creating a window / opening a tree node for the first time, etc. - but a typical frame won't allocate anything)
|
||||
|
||||
Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes:
|
||||
- doesn't look fancy, doesn't animate
|
||||
- limited layout features, intricate layouts are typically crafted in code
|
||||
- Doesn't look fancy, doesn't animate
|
||||
- Limited layout features, intricate layouts are typically crafted in code
|
||||
|
||||
|
||||
END-USER GUIDE
|
||||
@ -87,65 +86,110 @@
|
||||
- Read the FAQ below this section!
|
||||
- Your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs.
|
||||
- Call and read ImGui::ShowTestWindow() for demo code demonstrating most features.
|
||||
- Customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
|
||||
- You can learn about immediate-mode gui principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861
|
||||
|
||||
HOW TO UPDATE TO A NEWER VERSION OF IMGUI
|
||||
|
||||
- Overwrite all the sources files except for imconfig.h (if you have made modification to your copy of imconfig.h)
|
||||
- Read the "API BREAKING CHANGES" section (below). This is where we list occasional API breaking changes.
|
||||
If a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed from the public API.
|
||||
If you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it.
|
||||
Please report any issue to the GitHub page!
|
||||
- Try to keep your copy of dear imgui reasonably up to date.
|
||||
|
||||
GETTING STARTED WITH INTEGRATING IMGUI IN YOUR CODE/ENGINE
|
||||
|
||||
- See examples/ folder for standalone sample applications. Prefer reading examples/opengl_example/ first as it is the simplest.
|
||||
You may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
|
||||
- Init: call ImGui::GetIO() to retrieve the ImGuiIO structure and fill the fields marked 'Settings'.
|
||||
- Init: call io.Fonts->GetTexDataAsRGBA32(...) and load the font texture pixels into graphics memory.
|
||||
- Add the ImGui source files to your projects, using your preferred build system. It is recommended you build the .cpp files as part of your project and not as a library.
|
||||
- You can later customize the imconfig.h file to tweak some compilation time behavior, such as integrating imgui types with your own maths types.
|
||||
- See examples/ folder for standalone sample applications. To understand the integration process, you can read examples/opengl2_example/ because it is short,
|
||||
then switch to the one more appropriate to your use case.
|
||||
- You may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
|
||||
- When using ImGui, your programming IDE if your friend: follow the declaration of variables, functions and types to find comments about them.
|
||||
|
||||
- Init: retrieve the ImGuiIO structure with ImGui::GetIO() and fill the fields marked 'Settings': at minimum you need to set io.DisplaySize (application resolution).
|
||||
Later on you will fill your keyboard mapping, clipboard handlers, and other advanced features but for a basic integration you don't need to worry about it all.
|
||||
- Init: call io.Fonts->GetTexDataAsRGBA32(...), it will build the font atlas texture, then load the texture pixels into graphics memory.
|
||||
- Every frame:
|
||||
1/ in your mainloop or right after you got your keyboard/mouse info, call ImGui::GetIO() and fill the fields marked 'Input'
|
||||
2/ call ImGui::NewFrame() as early as you can!
|
||||
3/ use any ImGui function you want between NewFrame() and Render()
|
||||
4/ call ImGui::Render() as late as you can to end the frame and finalize render data. it will call your RenderDrawListFn handler that you set in the IO structure.
|
||||
- In your main loop as early a possible, fill the IO fields marked 'Input' (e.g. mouse position, buttons, keyboard info, etc.)
|
||||
- Call ImGui::NewFrame() to begin the imgui frame
|
||||
- You can use any ImGui function you want between NewFrame() and Render()
|
||||
- Call ImGui::Render() as late as you can to end the frame and finalize render data. it will call your io.RenderDrawListFn handler.
|
||||
(if you don't need to render, you still need to call Render() and ignore the callback, or call EndFrame() instead. if you call neither some aspects of windows focusing/moving will appear broken.)
|
||||
- All rendering information are stored into command-lists until ImGui::Render() is called.
|
||||
- ImGui never touches or knows about your GPU state. the only function that knows about GPU is the RenderDrawListFn handler that you provide.
|
||||
- Effectively it means you can create widgets at any time in your code, regardless of considerations of being in "update" vs "render" phases of your own application.
|
||||
- Refer to the examples applications in the examples/ folder for instruction on how to setup your code.
|
||||
- A typical application skeleton may be:
|
||||
- A minimal application skeleton may be:
|
||||
|
||||
// Application init
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.DisplaySize.x = 1920.0f;
|
||||
io.DisplaySize.y = 1280.0f;
|
||||
io.IniFilename = "imgui.ini";
|
||||
io.RenderDrawListsFn = my_render_function; // Setup a render function, or set to NULL and call GetDrawData() after Render() to access the render data.
|
||||
// TODO: Fill others settings of the io structure
|
||||
io.RenderDrawListsFn = MyRenderFunction; // Setup a render function, or set to NULL and call GetDrawData() after Render() to access the render data.
|
||||
// TODO: Fill others settings of the io structure later.
|
||||
|
||||
// Load texture atlas (there is a default font so you don't need to care about choosing a font yet)
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32(pixels, &width, &height);
|
||||
// TODO: At this points you've got a texture pointed to by 'pixels' and you need to upload that your your graphic system
|
||||
// TODO: Store your texture pointer/identifier (whatever your engine uses) in 'io.Fonts->TexID'
|
||||
// TODO: At this points you've got the texture data and you need to upload that your your graphic system:
|
||||
MyTexture* texture = MyEngine::CreateTextureFromMemoryPixels(pixels, width, height, TEXTURE_TYPE_RGBA)
|
||||
// TODO: Store your texture pointer/identifier (whatever your engine uses) in 'io.Fonts->TexID'. This will be passed back to your via the renderer.
|
||||
io.Fonts->TexID = (void*)texture;
|
||||
|
||||
// Application main loop
|
||||
while (true)
|
||||
{
|
||||
// 1) get low-level inputs (e.g. on Win32, GetKeyboardState(), or poll your events, etc.)
|
||||
// TODO: fill all fields of IO structure and call NewFrame
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.DeltaTime = 1.0f/60.0f;
|
||||
io.MousePos = mouse_pos;
|
||||
io.MouseDown[0] = mouse_button_0;
|
||||
io.MouseDown[1] = mouse_button_1;
|
||||
io.KeysDown[i] = ...
|
||||
// Setup low-level inputs (e.g. on Win32, GetKeyboardState(), or write to those fields from your Windows message loop handlers, etc.)
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.DeltaTime = 1.0f/60.0f;
|
||||
io.MousePos = mouse_pos;
|
||||
io.MouseDown[0] = mouse_button_0;
|
||||
io.MouseDown[1] = mouse_button_1;
|
||||
|
||||
// 2) call NewFrame(), after this point you can use ImGui::* functions anytime
|
||||
ImGui::NewFrame();
|
||||
// Call NewFrame(), after this point you can use ImGui::* functions anytime
|
||||
ImGui::NewFrame();
|
||||
|
||||
// 3) most of your application code here
|
||||
MyGameUpdate(); // may use any ImGui functions, e.g. ImGui::Begin("My window"); ImGui::Text("Hello, world!"); ImGui::End();
|
||||
MyGameRender(); // may use any ImGui functions
|
||||
// Most of your application code here
|
||||
MyGameUpdate(); // may use any ImGui functions, e.g. ImGui::Begin("My window"); ImGui::Text("Hello, world!"); ImGui::End();
|
||||
MyGameRender(); // may use any ImGui functions as well!
|
||||
|
||||
// 4) render & swap video buffers
|
||||
ImGui::Render();
|
||||
SwapBuffers();
|
||||
// Render & swap video buffers
|
||||
ImGui::Render();
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
- A minimal render function skeleton may be:
|
||||
|
||||
void void MyRenderFunction(ImDrawData* draw_data)(ImDrawData* draw_data)
|
||||
{
|
||||
// TODO: Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
|
||||
// TODO: Setup viewport, orthographic projection matrix
|
||||
// TODO: Setup shader: vertex { float2 pos, float2 uv, u32 color }, fragment shader sample color from 1 texture, multiply by vertex color.
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data; // vertex buffer generated by ImGui
|
||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data; // index buffer generated by ImGui
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Render 'pcmd->ElemCount/3' texture triangles
|
||||
MyEngineBindTexture(pcmd->TextureId);
|
||||
MyEngineScissor((int)pcmd->ClipRect.x, (int)pcmd->ClipRect.y, (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y));
|
||||
MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer);
|
||||
}
|
||||
idx_buffer += pcmd->ElemCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- The examples/ folders contains many functional implementation of the pseudo-code above.
|
||||
- When calling NewFrame(), the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'io.WantTextInput' flags are updated.
|
||||
They tell you if ImGui intends to use your inputs. So for example, if 'io.WantCaptureMouse' is set you would typically want to hide
|
||||
mouse inputs from the rest of your application. Read the FAQ below for more information about those flags.
|
||||
@ -159,6 +203,7 @@
|
||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2017/08/11 (1.51) - renamed ImGuiSetCond_*** types and flags to ImGuiCond_***. Kept redirection enums (will obsolete).
|
||||
- 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton().
|
||||
- 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu.
|
||||
- changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under "Color/Picker Widgets", to understand the various new options.
|
||||
@ -281,21 +326,6 @@
|
||||
A: - If you are experienced enough with ImGui and with C/C++, look at the todo list and see how you want/can help!
|
||||
- Become a Patron/donate! Convince your company to become a Patron or provide serious funding for development time! See http://www.patreon.com/imgui
|
||||
|
||||
Q: How do I update to a newer version of ImGui?
|
||||
A: Overwrite the following files:
|
||||
imgui.cpp
|
||||
imgui.h
|
||||
imgui_demo.cpp
|
||||
imgui_draw.cpp
|
||||
imgui_internal.h
|
||||
stb_rect_pack.h
|
||||
stb_textedit.h
|
||||
stb_truetype.h
|
||||
Don't overwrite imconfig.h if you have made modification to your copy.
|
||||
If you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it.
|
||||
Check the "API BREAKING CHANGES" sections for a list of occasional API breaking changes.
|
||||
Please report any issue to the GitHub page!
|
||||
|
||||
Q: What is ImTextureID and how do I display an image?
|
||||
A: ImTextureID is a void* used to pass renderer-agnostic texture references around until it hits your render function.
|
||||
ImGui knows nothing about what those bits represent, it just passes them around. It is up to you to decide what you want the void* to carry!
|
||||
@ -314,7 +344,7 @@
|
||||
Q: I integrated ImGui in my engine and some elements are clipping or disappearing when I move windows around..
|
||||
A: Most likely you are mishandling the clipping rectangles in your render function. Rectangles provided by ImGui are defined as (x1=left,y1=top,x2=right,y2=bottom) and NOT as (x1,y1,width,height).
|
||||
|
||||
Q: Can I have multiple widgets with the same label? Can I have widget without a label? (Yes)
|
||||
Q: Can I have multiple widgets with the same label? Can I have widget without a label?
|
||||
A: Yes. A primer on the use of labels/IDs in ImGui..
|
||||
|
||||
- Elements that are not clickable, such as Text() items don't need an ID.
|
||||
@ -709,9 +739,9 @@ static ImFont* GetDefaultFont();
|
||||
static void SetCurrentFont(ImFont* font);
|
||||
static void SetCurrentWindow(ImGuiWindow* window);
|
||||
static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);
|
||||
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond cond);
|
||||
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiSetCond cond);
|
||||
static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiSetCond cond);
|
||||
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond);
|
||||
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond);
|
||||
static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond);
|
||||
static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs);
|
||||
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags);
|
||||
static inline bool IsWindowContentHoverable(ImGuiWindow* window);
|
||||
@ -1883,7 +1913,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
AutoFitOnlyGrows = false;
|
||||
AutoPosLastDirection = -1;
|
||||
HiddenFrames = 0;
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCond_Always | ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing;
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;
|
||||
SetWindowPosCenterWanted = false;
|
||||
|
||||
LastFrameActive = -1;
|
||||
@ -2453,7 +2483,7 @@ void ImGui::NewFrame()
|
||||
CloseInactivePopups();
|
||||
|
||||
// Create implicit window - we will only render it if the user has added something to it.
|
||||
ImGui::SetNextWindowSize(ImVec2(400,400), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("Debug");
|
||||
}
|
||||
|
||||
@ -2608,6 +2638,8 @@ static void SaveIniSettingsToDisk(const char* ini_filename)
|
||||
if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
|
||||
continue;
|
||||
ImGuiIniData* settings = FindWindowSettings(window->Name);
|
||||
if (!settings) // This will only return NULL in the rare instance where the window was first created with ImGuiWindowFlags_NoSavedSettings then had the flag disabled later on. We don't bind settings in this case (bug #1000).
|
||||
continue;
|
||||
settings->Pos = window->Pos;
|
||||
settings->Size = window->SizeFull;
|
||||
settings->Collapsed = window->Collapsed;
|
||||
@ -3901,9 +3933,9 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
||||
}
|
||||
else
|
||||
{
|
||||
window->SetWindowPosAllowFlags &= ~ImGuiSetCond_FirstUseEver;
|
||||
window->SetWindowSizeAllowFlags &= ~ImGuiSetCond_FirstUseEver;
|
||||
window->SetWindowCollapsedAllowFlags &= ~ImGuiSetCond_FirstUseEver;
|
||||
window->SetWindowPosAllowFlags &= ~ImGuiCond_FirstUseEver;
|
||||
window->SetWindowSizeAllowFlags &= ~ImGuiCond_FirstUseEver;
|
||||
window->SetWindowCollapsedAllowFlags &= ~ImGuiCond_FirstUseEver;
|
||||
}
|
||||
|
||||
if (settings->Pos.x != FLT_MAX)
|
||||
@ -3972,7 +4004,7 @@ static void ApplySizeFullWithConstraint(ImGuiWindow* window, ImVec2 new_size)
|
||||
// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.
|
||||
// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
|
||||
// - Passing 'bool* p_open' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
|
||||
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCond_FirstUseEver) prior to calling Begin().
|
||||
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiCond_FirstUseEver) prior to calling Begin().
|
||||
bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
{
|
||||
return ImGui::Begin(name, p_open, ImVec2(0.f, 0.f), -1.0f, flags);
|
||||
@ -4030,12 +4062,12 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
||||
if (g.SetNextWindowPosCond)
|
||||
{
|
||||
const ImVec2 backup_cursor_pos = window->DC.CursorPos; // FIXME: not sure of the exact reason of this saving/restore anymore :( need to look into that.
|
||||
if (!window_was_active || window_appearing_after_being_hidden) window->SetWindowPosAllowFlags |= ImGuiSetCond_Appearing;
|
||||
if (!window_was_active || window_appearing_after_being_hidden) window->SetWindowPosAllowFlags |= ImGuiCond_Appearing;
|
||||
window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.SetNextWindowPosCond) != 0;
|
||||
if (window_pos_set_by_api && ImLengthSqr(g.SetNextWindowPosVal - ImVec2(-FLT_MAX,-FLT_MAX)) < 0.001f)
|
||||
{
|
||||
window->SetWindowPosCenterWanted = true; // May be processed on the next frame if this is our first frame and we are measuring size
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing);
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4046,7 +4078,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
||||
}
|
||||
if (g.SetNextWindowSizeCond)
|
||||
{
|
||||
if (!window_was_active || window_appearing_after_being_hidden) window->SetWindowSizeAllowFlags |= ImGuiSetCond_Appearing;
|
||||
if (!window_was_active || window_appearing_after_being_hidden) window->SetWindowSizeAllowFlags |= ImGuiCond_Appearing;
|
||||
window_size_set_by_api = (window->SetWindowSizeAllowFlags & g.SetNextWindowSizeCond) != 0;
|
||||
SetWindowSize(window, g.SetNextWindowSizeVal, g.SetNextWindowSizeCond);
|
||||
g.SetNextWindowSizeCond = 0;
|
||||
@ -4062,7 +4094,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
||||
}
|
||||
if (g.SetNextWindowCollapsedCond)
|
||||
{
|
||||
if (!window_was_active || window_appearing_after_being_hidden) window->SetWindowCollapsedAllowFlags |= ImGuiSetCond_Appearing;
|
||||
if (!window_was_active || window_appearing_after_being_hidden) window->SetWindowCollapsedAllowFlags |= ImGuiCond_Appearing;
|
||||
SetWindowCollapsed(window, g.SetNextWindowCollapsedVal, g.SetNextWindowCollapsedCond);
|
||||
g.SetNextWindowCollapsedCond = 0;
|
||||
}
|
||||
@ -5019,12 +5051,12 @@ static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y)
|
||||
window->DC.CursorMaxPos.y -= window->Scroll.y;
|
||||
}
|
||||
|
||||
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond cond)
|
||||
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
|
||||
{
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
|
||||
return;
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing);
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
||||
window->SetWindowPosCenterWanted = false;
|
||||
|
||||
// Set
|
||||
@ -5035,13 +5067,13 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co
|
||||
window->DC.CursorMaxPos += (window->Pos - old_pos); // And more importantly we need to adjust this so size calculation doesn't get affected.
|
||||
}
|
||||
|
||||
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
||||
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
SetWindowPos(window, pos, cond);
|
||||
}
|
||||
|
||||
void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond)
|
||||
void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond)
|
||||
{
|
||||
if (ImGuiWindow* window = FindWindowByName(name))
|
||||
SetWindowPos(window, pos, cond);
|
||||
@ -5053,12 +5085,12 @@ ImVec2 ImGui::GetWindowSize()
|
||||
return window->Size;
|
||||
}
|
||||
|
||||
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiSetCond cond)
|
||||
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond)
|
||||
{
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowSizeAllowFlags & cond) == 0)
|
||||
return;
|
||||
window->SetWindowSizeAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing);
|
||||
window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
||||
|
||||
// Set
|
||||
if (size.x > 0.0f)
|
||||
@ -5083,30 +5115,30 @@ static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiSetCond
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::SetWindowSize(const ImVec2& size, ImGuiSetCond cond)
|
||||
void ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond)
|
||||
{
|
||||
SetWindowSize(GImGui->CurrentWindow, size, cond);
|
||||
}
|
||||
|
||||
void ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond)
|
||||
void ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond)
|
||||
{
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (window)
|
||||
SetWindowSize(window, size, cond);
|
||||
}
|
||||
|
||||
static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiSetCond cond)
|
||||
static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond)
|
||||
{
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0)
|
||||
return;
|
||||
window->SetWindowCollapsedAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing);
|
||||
window->SetWindowCollapsedAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
||||
|
||||
// Set
|
||||
window->Collapsed = collapsed;
|
||||
}
|
||||
|
||||
void ImGui::SetWindowCollapsed(bool collapsed, ImGuiSetCond cond)
|
||||
void ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond)
|
||||
{
|
||||
SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond);
|
||||
}
|
||||
@ -5116,7 +5148,7 @@ bool ImGui::IsWindowCollapsed()
|
||||
return GImGui->CurrentWindow->Collapsed;
|
||||
}
|
||||
|
||||
void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond)
|
||||
void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond)
|
||||
{
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (window)
|
||||
@ -5141,25 +5173,25 @@ void ImGui::SetWindowFocus(const char* name)
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextWindowPosVal = pos;
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiSetCond_Always;
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowPosCenter(ImGuiSetCond cond)
|
||||
void ImGui::SetNextWindowPosCenter(ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextWindowPosVal = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiSetCond_Always;
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond)
|
||||
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextWindowSizeVal = size;
|
||||
g.SetNextWindowSizeCond = cond ? cond : ImGuiSetCond_Always;
|
||||
g.SetNextWindowSizeCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback, void* custom_callback_user_data)
|
||||
@ -5175,21 +5207,21 @@ void ImGui::SetNextWindowContentSize(const ImVec2& size)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextWindowContentSizeVal = size;
|
||||
g.SetNextWindowContentSizeCond = ImGuiSetCond_Always;
|
||||
g.SetNextWindowContentSizeCond = ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowContentWidth(float width)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextWindowContentSizeVal = ImVec2(width, g.SetNextWindowContentSizeCond ? g.SetNextWindowContentSizeVal.y : 0.0f);
|
||||
g.SetNextWindowContentSizeCond = ImGuiSetCond_Always;
|
||||
g.SetNextWindowContentSizeCond = ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond)
|
||||
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextWindowCollapsedVal = collapsed;
|
||||
g.SetNextWindowCollapsedCond = cond ? cond : ImGuiSetCond_Always;
|
||||
g.SetNextWindowCollapsedCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowFocus()
|
||||
@ -6011,14 +6043,14 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|
||||
bool is_open;
|
||||
if (g.SetNextTreeNodeOpenCond != 0)
|
||||
{
|
||||
if (g.SetNextTreeNodeOpenCond & ImGuiSetCond_Always)
|
||||
if (g.SetNextTreeNodeOpenCond & ImGuiCond_Always)
|
||||
{
|
||||
is_open = g.SetNextTreeNodeOpenVal;
|
||||
storage->SetInt(id, is_open);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We treat ImGuiSetCondition_Once and ImGuiSetCondition_FirstUseEver the same because tree node state are not saved persistently.
|
||||
// We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently.
|
||||
const int stored_value = storage->GetInt(id, -1);
|
||||
if (stored_value == -1)
|
||||
{
|
||||
@ -6285,11 +6317,11 @@ float ImGui::GetTreeNodeToLabelSpacing()
|
||||
return g.FontSize + (g.Style.FramePadding.x * 2.0f);
|
||||
}
|
||||
|
||||
void ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond)
|
||||
void ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.SetNextTreeNodeOpenVal = is_open;
|
||||
g.SetNextTreeNodeOpenCond = cond ? cond : ImGuiSetCond_Always;
|
||||
g.SetNextTreeNodeOpenCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::PushID(const char* str_id)
|
||||
@ -9058,7 +9090,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
||||
|
||||
if (menu_is_open)
|
||||
{
|
||||
SetNextWindowPos(popup_pos, ImGuiSetCond_Always);
|
||||
SetNextWindowPos(popup_pos, ImGuiCond_Always);
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_ShowBorders | ((window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) ? ImGuiWindowFlags_ChildMenu|ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu);
|
||||
menu_is_open = BeginPopupEx(label, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
||||
}
|
||||
@ -9266,7 +9298,7 @@ static void ColorPickerOptionsPopup(ImGuiColorEditFlags flags, float* ref_col)
|
||||
g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask);
|
||||
ImGui::SetCursorScreenPos(backup_pos);
|
||||
ImVec4 dummy_ref_col;
|
||||
memcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (ImGuiColorEditFlags_NoAlpha ? 3 : 4));
|
||||
memcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (picker_flags & ImGuiColorEditFlags_NoAlpha ? 3 : 4));
|
||||
ImGui::ColorPicker4("##dummypicker", &dummy_ref_col.x, picker_flags);
|
||||
ImGui::PopID();
|
||||
}
|
||||
@ -9476,11 +9508,11 @@ static void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGui
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;
|
||||
default: break;
|
||||
case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
default: return; // Fix warning for ImGuiDir_None
|
||||
}
|
||||
}
|
||||
|
||||
|
45
3rdparty/ocornut-imgui/imgui.h
vendored
45
3rdparty/ocornut-imgui/imgui.h
vendored
@ -73,7 +73,7 @@ typedef int ImGuiKey; // a key identifier (ImGui-side enum) // e
|
||||
typedef int ImGuiColorEditFlags; // color edit flags for Color*() // enum ImGuiColorEditFlags_
|
||||
typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_
|
||||
typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_
|
||||
typedef int ImGuiSetCond; // condition flags for Set*() // enum ImGuiSetCond_
|
||||
typedef int ImGuiCond; // condition flags for Set*() // enum ImGuiCond_
|
||||
typedef int ImGuiInputTextFlags; // flags for InputText*() // enum ImGuiInputTextFlags_
|
||||
typedef int ImGuiSelectableFlags; // flags for Selectable() // enum ImGuiSelectableFlags_
|
||||
typedef int ImGuiTreeNodeFlags; // flags for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_
|
||||
@ -148,22 +148,22 @@ namespace ImGui
|
||||
IMGUI_API bool IsWindowCollapsed();
|
||||
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows
|
||||
|
||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set next window position. call before Begin()
|
||||
IMGUI_API void SetNextWindowPosCenter(ImGuiSetCond cond = 0); // set next window position to be centered on screen. call before Begin()
|
||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
|
||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // set next window position. call before Begin()
|
||||
IMGUI_API void SetNextWindowPosCenter(ImGuiCond cond = 0); // set next window position to be centered on screen. call before Begin()
|
||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
|
||||
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints.
|
||||
IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (enforce the range of scrollbars). set axis to 0.0f to leave it automatic. call before Begin()
|
||||
IMGUI_API void SetNextWindowContentWidth(float width); // set next window content width (enforce the range of horizontal scrollbar). call before Begin()
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set next window collapsed state. call before Begin()
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin()
|
||||
IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin()
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
||||
IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / front-most. prefer using SetNextWindowFocus().
|
||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position.
|
||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis.
|
||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state
|
||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus.
|
||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position.
|
||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis.
|
||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state
|
||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus.
|
||||
|
||||
IMGUI_API float GetScrollX(); // get scrolling amount [0..GetScrollMaxX()]
|
||||
IMGUI_API float GetScrollY(); // get scrolling amount [0..GetScrollMaxY()]
|
||||
@ -345,7 +345,7 @@ namespace ImGui
|
||||
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
||||
IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing()
|
||||
IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
|
||||
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0); // set next TreeNode/CollapsingHeader open state.
|
||||
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state.
|
||||
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
|
||||
IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header
|
||||
|
||||
@ -709,13 +709,18 @@ enum ImGuiMouseCursor_
|
||||
};
|
||||
|
||||
// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
|
||||
// All those functions treat 0 as a shortcut to ImGuiSetCond_Always
|
||||
enum ImGuiSetCond_
|
||||
// All those functions treat 0 as a shortcut to ImGuiCond_Always
|
||||
enum ImGuiCond_
|
||||
{
|
||||
ImGuiSetCond_Always = 1 << 0, // Set the variable
|
||||
ImGuiSetCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed)
|
||||
ImGuiSetCond_FirstUseEver = 1 << 2, // Set the variable if the window has no saved data (if doesn't exist in the .ini file)
|
||||
ImGuiSetCond_Appearing = 1 << 3 // Set the variable if the window is appearing after being hidden/inactive (or the first time)
|
||||
ImGuiCond_Always = 1 << 0, // Set the variable
|
||||
ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed)
|
||||
ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the window has no saved data (if doesn't exist in the .ini file)
|
||||
ImGuiCond_Appearing = 1 << 3 // Set the variable if the window is appearing after being hidden/inactive (or the first time)
|
||||
|
||||
// Obsolete names (will be obsolete)
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
, ImGuiSetCond_Always = ImGuiCond_Always, ImGuiSetCond_Once = ImGuiCond_Once, ImGuiSetCond_FirstUseEver = ImGuiCond_FirstUseEver, ImGuiSetCond_Appearing = ImGuiCond_Appearing
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ImGuiStyle
|
||||
@ -782,7 +787,7 @@ struct ImGuiIO
|
||||
bool OSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// User Functions
|
||||
// Settings (User Functions)
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// Rendering function, will be called in Render().
|
||||
|
29
3rdparty/ocornut-imgui/imgui_demo.cpp
vendored
29
3rdparty/ocornut-imgui/imgui_demo.cpp
vendored
@ -181,7 +181,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
|
||||
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
||||
if (!no_menu) window_flags |= ImGuiWindowFlags_MenuBar;
|
||||
ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("ImGui Demo", p_open, window_flags))
|
||||
{
|
||||
// Early out if the window is collapsed, as an optimization.
|
||||
@ -855,8 +855,8 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
if (ImGui::Button("Uint8 + HSV"))
|
||||
ImGui::SetColorEditOptions(ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_HSV);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Float + HDR + NoClamp"))
|
||||
ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HDR);
|
||||
if (ImGui::Button("Float + HDR"))
|
||||
ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_RGB);
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
@ -2118,12 +2118,12 @@ static void ShowExampleAppManipulatingWindowTitle(bool*)
|
||||
// You can use the "##" and "###" markers to manipulate the display/ID.
|
||||
|
||||
// Using "##" to display same title but have unique identifier.
|
||||
ImGui::SetNextWindowPos(ImVec2(100,100), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(100,100), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("Same title as another window##1");
|
||||
ImGui::Text("This is window 1.\nMy title is the same as window 2, but my identifier is unique.");
|
||||
ImGui::End();
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(100,200), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(100,200), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("Same title as another window##2");
|
||||
ImGui::Text("This is window 2.\nMy title is the same as window 1, but my identifier is unique.");
|
||||
ImGui::End();
|
||||
@ -2131,7 +2131,7 @@ static void ShowExampleAppManipulatingWindowTitle(bool*)
|
||||
// Using "###" to display a changing title but keep a static identifier "AnimatedTitle"
|
||||
char buf[128];
|
||||
sprintf(buf, "Animated title %c %d###AnimatedTitle", "|/-\\"[(int)(ImGui::GetTime()/0.25f)&3], rand());
|
||||
ImGui::SetNextWindowPos(ImVec2(100,300), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(100,300), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin(buf);
|
||||
ImGui::Text("This window has a changing title.");
|
||||
ImGui::End();
|
||||
@ -2140,7 +2140,7 @@ static void ShowExampleAppManipulatingWindowTitle(bool*)
|
||||
// Demonstrate using the low-level ImDrawList to draw custom shapes.
|
||||
static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(350,560), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(350,560), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("Example: Custom rendering", p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
@ -2293,7 +2293,7 @@ struct ExampleAppConsole
|
||||
|
||||
void Draw(const char* title, bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin(title, p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
@ -2308,6 +2308,7 @@ struct ExampleAppConsole
|
||||
if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.Size); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Add Dummy Error")) { AddLog("[error] something went wrong"); } ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Clear")) { ClearLog(); } ImGui::SameLine();
|
||||
bool copy_to_clipboard = ImGui::SmallButton("Copy"); ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Scroll to bottom")) ScrollToBottom = true;
|
||||
//static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); }
|
||||
|
||||
@ -2338,6 +2339,8 @@ struct ExampleAppConsole
|
||||
// and appending newly elements as they are inserted. This is left as a task to the user until we can manage to improve this example code!
|
||||
// If your items are of variable size you may want to implement code similar to what ImGuiListClipper does. Or split your data into fixed height items to allow random-seeking into your list.
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
|
||||
if (copy_to_clipboard)
|
||||
ImGui::LogToClipboard();
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
{
|
||||
const char* item = Items[i];
|
||||
@ -2350,6 +2353,8 @@ struct ExampleAppConsole
|
||||
ImGui::TextUnformatted(item);
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
if (copy_to_clipboard)
|
||||
ImGui::LogFinish();
|
||||
if (ScrollToBottom)
|
||||
ImGui::SetScrollHere();
|
||||
ScrollToBottom = false;
|
||||
@ -2552,7 +2557,7 @@ struct ExampleAppLog
|
||||
|
||||
void Draw(const char* title, bool* p_open = NULL)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin(title, p_open);
|
||||
if (ImGui::Button("Clear")) Clear();
|
||||
ImGui::SameLine();
|
||||
@ -2609,7 +2614,7 @@ static void ShowExampleAppLog(bool* p_open)
|
||||
// Demonstrate create a window with multiple child windows.
|
||||
static void ShowExampleAppLayout(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
|
||||
if (ImGui::Begin("Example: Layout", p_open, ImGuiWindowFlags_MenuBar))
|
||||
{
|
||||
if (ImGui::BeginMenuBar())
|
||||
@ -2655,7 +2660,7 @@ static void ShowExampleAppLayout(bool* p_open)
|
||||
// Demonstrate create a simple property editor.
|
||||
static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(430,450), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(430,450), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("Example: Property editor", p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
@ -2728,7 +2733,7 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
// Demonstrate/test rendering huge amount of text, and the incidence of clipping.
|
||||
static void ShowExampleAppLongText(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("Example: Long text display", p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
|
18
3rdparty/ocornut-imgui/imgui_internal.h
vendored
18
3rdparty/ocornut-imgui/imgui_internal.h
vendored
@ -425,17 +425,17 @@ struct ImGuiContext
|
||||
ImVec2 SetNextWindowSizeVal;
|
||||
ImVec2 SetNextWindowContentSizeVal;
|
||||
bool SetNextWindowCollapsedVal;
|
||||
ImGuiSetCond SetNextWindowPosCond;
|
||||
ImGuiSetCond SetNextWindowSizeCond;
|
||||
ImGuiSetCond SetNextWindowContentSizeCond;
|
||||
ImGuiSetCond SetNextWindowCollapsedCond;
|
||||
ImGuiCond SetNextWindowPosCond;
|
||||
ImGuiCond SetNextWindowSizeCond;
|
||||
ImGuiCond SetNextWindowContentSizeCond;
|
||||
ImGuiCond SetNextWindowCollapsedCond;
|
||||
ImRect SetNextWindowSizeConstraintRect; // Valid if 'SetNextWindowSizeConstraint' is true
|
||||
ImGuiSizeConstraintCallback SetNextWindowSizeConstraintCallback;
|
||||
void* SetNextWindowSizeConstraintCallbackUserData;
|
||||
void* SetNextWindowSizeConstraintCallbackUserData;
|
||||
bool SetNextWindowSizeConstraint;
|
||||
bool SetNextWindowFocus;
|
||||
bool SetNextTreeNodeOpenVal;
|
||||
ImGuiSetCond SetNextTreeNodeOpenCond;
|
||||
ImGuiCond SetNextTreeNodeOpenCond;
|
||||
|
||||
// Render
|
||||
ImDrawData RenderDrawData; // Main ImDrawData instance to pass render information to the user
|
||||
@ -666,9 +666,9 @@ struct IMGUI_API ImGuiWindow
|
||||
bool AutoFitOnlyGrows;
|
||||
int AutoPosLastDirection;
|
||||
int HiddenFrames;
|
||||
int SetWindowPosAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowPos() call will succeed with this particular flag.
|
||||
int SetWindowSizeAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowSize() call will succeed with this particular flag.
|
||||
int SetWindowCollapsedAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowCollapsed() call will succeed with this particular flag.
|
||||
ImGuiCond SetWindowPosAllowFlags; // store condition flags for next SetWindowPos() call.
|
||||
ImGuiCond SetWindowSizeAllowFlags; // store condition flags for next SetWindowSize() call.
|
||||
ImGuiCond SetWindowCollapsedAllowFlags; // store condition flags for next SetWindowCollapsed() call.
|
||||
bool SetWindowPosCenterWanted;
|
||||
|
||||
ImGuiDrawContext DC; // Temporary per-window data, reset at the beginning of the frame
|
||||
|
Loading…
Reference in New Issue
Block a user