Updated ImGui.

This commit is contained in:
Бранимир Караџић 2020-10-09 08:50:40 -07:00
parent 3142be44a5
commit adf93db26b
11 changed files with 132 additions and 98 deletions

View File

@ -1,4 +1,4 @@
// dear imgui, v1.79 WIP
// dear imgui, v1.79
// (main code and documentation)
// Help:
@ -11,7 +11,7 @@
// - FAQ http://dearimgui.org/faq
// - Homepage & latest https://github.com/ocornut/imgui
// - Releases & changelog https://github.com/ocornut/imgui/releases
// - Gallery https://github.com/ocornut/imgui/issues/3075 (please post your screenshots/video there!)
// - Gallery https://github.com/ocornut/imgui/issues/3488 (please post your screenshots/video there!)
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
// - Wiki https://github.com/ocornut/imgui/wiki
// - Issues & support https://github.com/ocornut/imgui/issues
@ -92,14 +92,13 @@ CODE
- 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 e.g. creating a window,.
opening a tree node for the first time, etc. but a typical frame should not allocate anything).
- Efficient runtime and memory consumption.
Designed for developers and content-creators, not the typical end-user! Some of the current weaknesses includes:
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.
@ -372,11 +371,12 @@ CODE
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
- 2020/10/05 (1.79) - removed ImGuiListClipper: Renamed constructor parameters which created an ambiguous alternative to using the ImGuiListClipper::Begin() function, with misleading edge cases (note: imgui_memory_editor <0.40 from imgui_club/ used this old clipper API. Update your copy if needed).
- 2020/09/25 (1.79) - renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete sooner because previous name was added recently).
- 2020/09/25 (1.79) - renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton.
- 2020/09/21 (1.79) - renamed OpenPopupContextItem() back to OpenPopupOnItemClick(), reverting the change from 1.77. For varieties of reason this is more self-explanatory.
- 2020/09/21 (1.79) - removed return value from OpenPopupOnItemClick() - returned true on mouse release on item - because it is inconsistent with other popup APIs and makes others misleading. It's also and unnecessary: you can use IsWindowAppearing() after BeginPopup() for a similar result.
- 2020/09/17 (1.79) - removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font. It was also getting in the way of better font scaling, so let's get rid of it now!
- 2020/09/17 (1.79) - removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font. If you scaled this value after calling AddFontDefault(), this is now done automatically. It was also getting in the way of better font scaling, so let's get rid of it now!
- 2020/08/17 (1.78) - obsoleted use of the trailing 'float power=1.0f' parameter for DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(), DragFloatRange2(), DragScalar(), DragScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(), SliderScalar(), SliderScalarN(), VSliderFloat() and VSliderScalar().
replaced the 'float power=1.0f' argument with integer-based flags defaulting to 0 (as with all our flags).
worked out a backward-compatibility scheme so hopefully most C++ codebase should not be affected. in short, when calling those functions:
@ -702,7 +702,7 @@ CODE
- If you are experienced with Dear ImGui and C++, look at the github issues, look at the Wiki, read docs/TODO.txt
and see how you want to help and can help!
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
You may post screenshot or links in the gallery threads (github.com/ocornut/imgui/issues/3075). Visuals are ideal as they inspire other programmers.
You may post screenshot or links in the gallery threads (github.com/ocornut/imgui/issues/3488). Visuals are ideal as they inspire other programmers.
But even without visuals, disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions.
- If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues (on github or privately).
@ -2194,13 +2194,10 @@ static void SetCursorPosYAndSetupForPrevLine(float pos_y, float line_height)
columns->LineMinY = window->DC.CursorPos.y; // Setting this so that cell Y position are set properly
}
ImGuiListClipper::ImGuiListClipper(int items_count, float items_height)
ImGuiListClipper::ImGuiListClipper()
{
DisplayStart = DisplayEnd = 0;
memset(this, 0, sizeof(*this));
ItemsCount = -1;
StepNo = 0;
ItemsHeight = StartPosY = 0.0f;
Begin(items_count, items_height);
}
ImGuiListClipper::~ImGuiListClipper()
@ -5146,7 +5143,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
// Resize grips and borders are on layer 1
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
// Manual resize grips
PushID("#RESIZE");
@ -5215,7 +5211,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
// Restore nav layer
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
// Navigation resize (keyboard/gamepad)
if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window)
@ -5386,7 +5381,6 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
// Layout buttons
// FIXME: Would be nice to generalize the subtleties expressed here into reusable code.
@ -5422,7 +5416,6 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
*p_open = false;
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
window->DC.ItemFlags = item_flags_backup;
// Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker)
@ -5998,7 +5991,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext;
window->DC.NavLayerActiveMaskNext = 0x00;
window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // -V595
@ -7039,7 +7031,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg)
// to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick).
// We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null.
// If we crash on a NULL g.NavWindow we need to fix the bug elsewhere.
window->DC.NavLayerActiveMaskNext |= window->DC.NavLayerCurrentMask;
window->DC.NavLayerActiveMaskNext |= (1 << window->DC.NavLayerCurrent);
if (g.NavId == id || g.NavAnyRequest)
if (g.NavWindow->RootWindowForNav == window->RootWindowForNav)
if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened))

View File

@ -1,4 +1,4 @@
// dear imgui, v1.79 WIP
// dear imgui, v1.79
// (headers)
// Help:
@ -11,7 +11,7 @@
// - FAQ http://dearimgui.org/faq
// - Homepage & latest https://github.com/ocornut/imgui
// - Releases & changelog https://github.com/ocornut/imgui/releases
// - Gallery https://github.com/ocornut/imgui/issues/3075 (please post your screenshots/video there!)
// - Gallery https://github.com/ocornut/imgui/issues/3488 (please post your screenshots/video there!)
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
// - Wiki https://github.com/ocornut/imgui/wiki
// - Issues & support https://github.com/ocornut/imgui/issues
@ -59,8 +59,8 @@ Index of this file:
// Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
#define IMGUI_VERSION "1.79 WIP"
#define IMGUI_VERSION_NUM 17803
#define IMGUI_VERSION "1.79"
#define IMGUI_VERSION_NUM 17900
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
@ -1886,38 +1886,45 @@ struct ImGuiStorage
};
// Helper: Manually clip large list of items.
// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all.
// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse
// clipping based on visibility to save yourself from processing those items at all.
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
// ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null.
// (Dear ImGui already clip items based on their bounds but it needs to measure text size to do so, whereas manual coarse clipping before submission makes this cost and your own data fetching/submission cost almost null)
// Usage:
// ImGuiListClipper clipper(1000); // we have 1000 elements, evenly spaced.
// while (clipper.Step())
// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
// ImGui::Text("line number %d", i);
// - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor).
// - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element.
// - (Step 2: empty step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.)
// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.
// ImGuiListClipper clipper;
// clipper.Begin(1000); // We have 1000 elements, evenly spaced.
// while (clipper.Step())
// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
// ImGui::Text("line number %d", i);
// Generally what happens is:
// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.
// - User code submit one element.
// - Clipper can measure the height of the first element
// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.
// - User code submit visible elements.
struct ImGuiListClipper
{
int DisplayStart;
int DisplayEnd;
int ItemsCount;
// [Internal]
int ItemsCount;
int StepNo;
float ItemsHeight;
float StartPosY;
// items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step).
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
// If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step().
ImGuiListClipper(int items_count = -1, float items_height = -1.0f);
~ImGuiListClipper();
IMGUI_API ImGuiListClipper();
IMGUI_API ~ImGuiListClipper();
// items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step)
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1.
IMGUI_API void End(); // Automatically called on the last call of Step() that returns false.
IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]
#endif
};
// Helpers macros to generate 32-bit encoded colors

View File

@ -1,4 +1,4 @@
// dear imgui, v1.79 WIP
// dear imgui, v1.79
// (demo code)
// Help:
@ -1088,27 +1088,34 @@ static void ShowDemoWindowWidgets()
}
if (ImGui::TreeNode("Grid"))
{
static int selected[4 * 4] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
for (int i = 0; i < 4 * 4; i++)
{
ImGui::PushID(i);
if (ImGui::Selectable("Sailor", selected[i] != 0, 0, ImVec2(50, 50)))
{
// Toggle
selected[i] = !selected[i];
static char selected[4][4] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } };
// Note: We _unnecessarily_ test for both x/y and i here only to silence some static analyzer.
// The second part of each test is unnecessary.
int x = i % 4;
int y = i / 4;
if (x > 0) { selected[i - 1] ^= 1; }
if (x < 3 && i < 15) { selected[i + 1] ^= 1; }
if (y > 0 && i > 3) { selected[i - 4] ^= 1; }
if (y < 3 && i < 12) { selected[i + 4] ^= 1; }
// Add in a bit of silly fun...
const float time = (float)ImGui::GetTime();
const bool winning_state = memchr(selected, 0, sizeof(selected)) == NULL; // If all cells are selected...
if (winning_state)
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f + 0.5f * cosf(time * 2.0f), 0.5f + 0.5f * sinf(time * 3.0f)));
for (int y = 0; y < 4; y++)
for (int x = 0; x < 4; x++)
{
if (x > 0)
ImGui::SameLine();
ImGui::PushID(y * 4 + x);
if (ImGui::Selectable("Sailor", selected[y][x] != 0, 0, ImVec2(50, 50)))
{
// Toggle clicked cell + toggle neighbors
selected[y][x] ^= 1;
if (x > 0) { selected[y][x - 1] ^= 1; }
if (x < 3) { selected[y][x + 1] ^= 1; }
if (y > 0) { selected[y - 1][x] ^= 1; }
if (y < 3) { selected[y + 1][x] ^= 1; }
}
ImGui::PopID();
}
if ((i % 4) < 3) ImGui::SameLine();
ImGui::PopID();
}
if (winning_state)
ImGui::PopStyleVar();
ImGui::TreePop();
}
if (ImGui::TreeNode("Alignment"))

View File

@ -1,4 +1,4 @@
// dear imgui, v1.79 WIP
// dear imgui, v1.79
// (drawing and font code)
/*

View File

@ -1,4 +1,4 @@
// dear imgui, v1.79 WIP
// dear imgui, v1.79
// (internal structures/api)
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
@ -1497,9 +1497,8 @@ struct IMGUI_API ImGuiWindowTempData
// Keyboard/Gamepad navigation
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
int NavLayerCurrentMask; // = (1 << NavLayerCurrent) used by ItemAdd prior to clipping.
int NavLayerActiveMask; // Which layer have been written to (result from previous frame)
int NavLayerActiveMaskNext; // Which layer have been written to (buffer for current frame)
int NavLayerActiveMask; // Which layers have been written to (result from previous frame)
int NavLayerActiveMaskNext; // Which layers have been written to (accumulator for current frame)
ImGuiID NavFocusScopeIdCurrent; // Current focus scope ID while appending
bool NavHideHighlightOneFrame;
bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
@ -1544,7 +1543,6 @@ struct IMGUI_API ImGuiWindowTempData
NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
NavLayerCurrent = ImGuiNavLayer_Main;
NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
NavFocusScopeIdCurrent = 0;
NavHideHighlightOneFrame = false;
NavHasScroll = false;

View File

@ -1,4 +1,4 @@
// dear imgui, v1.79 WIP
// dear imgui, v1.79
// (widgets code)
/*
@ -1071,7 +1071,8 @@ bool ImGui::Checkbox(const char* label, bool* v)
RenderNavHighlight(total_bb, id);
RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
ImU32 check_col = GetColorU32(ImGuiCol_CheckMark);
if (window->DC.ItemFlags & ImGuiItemFlags_MixedValue)
bool mixed_value = (window->DC.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
if (mixed_value)
{
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));
@ -1084,7 +1085,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
}
if (g.LogEnabled)
LogRenderedText(&total_bb.Min, *v ? "[x]" : "[ ]");
LogRenderedText(&total_bb.Min, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
if (label_size.x > 0.0f)
RenderText(ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y), label);
@ -1095,7 +1096,21 @@ bool ImGui::Checkbox(const char* label, bool* v)
bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value)
{
bool v = ((*flags & flags_value) == flags_value);
bool pressed = Checkbox(label, &v);
bool pressed;
if (v == false && (*flags & flags_value) != 0)
{
// Mixed value (FIXME: find a way to expose neatly to Checkbox?)
ImGuiWindow* window = GetCurrentWindow();
const ImGuiItemFlags backup_item_flags = window->DC.ItemFlags;
window->DC.ItemFlags |= ImGuiItemFlags_MixedValue;
pressed = Checkbox(label, &v);
window->DC.ItemFlags = backup_item_flags;
}
else
{
// Regular checkbox
pressed = Checkbox(label, &v);
}
if (pressed)
{
if (v)
@ -3848,7 +3863,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
return false;
}
draw_window = g.CurrentWindow; // Child window
draw_window->DC.NavLayerActiveMaskNext |= draw_window->DC.NavLayerCurrentMask; // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
draw_window->DC.NavLayerActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
inner_size.x -= draw_window->ScrollbarSizes.x;
}
else
@ -6477,7 +6492,6 @@ bool ImGui::BeginMenuBar()
window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y);
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
window->DC.MenuBarAppending = true;
AlignTextToFramePadding();
return true;
@ -6520,7 +6534,6 @@ void ImGui::EndMenuBar()
EndGroup(); // Restore position on layer 0
window->DC.LayoutType = ImGuiLayoutType_Vertical;
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
window->DC.MenuBarAppending = false;
}
@ -7843,6 +7856,7 @@ bool ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
text_pixel_clip_bb.Max.x -= close_button_sz;
}
// FIXME: if FramePadding is noticeably large, ellipsis_max_x will be wrong here (e.g. #3497), maybe for consistency that parameter of RenderTextEllipsis() shouldn't exist..
float ellipsis_max_x = close_button_visible ? text_pixel_clip_bb.Max.x : bb.Max.x - 1.0f;
RenderTextEllipsis(draw_list, text_ellipsis_clip_bb.Min, text_ellipsis_clip_bb.Max, text_pixel_clip_bb.Max.x, ellipsis_max_x, label, NULL, &label_size);

View File

@ -63,7 +63,10 @@ namespace ImGui
ImString chdir;
int pos = 0;
ImGuiListClipper clipper(FileList.size(), lineHeight);
ImGuiListClipper clipper;
clipper.Begin(FileList.size(), lineHeight);
clipper.Step();
for (FileInfoArray::const_iterator it = FileList.begin(), itEnd = FileList.end()
; it != itEnd
; ++it

View File

@ -38,7 +38,8 @@ namespace ImGui
float line_height = GetTextLineHeight();
int line_total_count = (int)((mem_size + Rows-1) / Rows);
ImGuiListClipper clipper(line_total_count, line_height);
ImGuiListClipper clipper;
clipper.Begin(line_total_count, line_height);
int visible_start_addr = clipper.DisplayStart * Rows;
int visible_end_addr = clipper.DisplayEnd * Rows;

View File

@ -393,7 +393,8 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
if (ImGui::ListBoxHeader("Encoders", ImVec2(ImGui::GetWindowWidth(), stats->numEncoders*itemHeightWithSpacing) ) )
{
ImGuiListClipper clipper(stats->numEncoders, itemHeight);
ImGuiListClipper clipper;
clipper.Begin(stats->numEncoders, itemHeight);
while (clipper.Step() )
{
@ -425,7 +426,8 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
if (ImGui::ListBoxHeader("Views", ImVec2(ImGui::GetWindowWidth(), stats->numViews*itemHeightWithSpacing) ) )
{
ImGuiListClipper clipper(stats->numViews, itemHeight);
ImGuiListClipper clipper;
clipper.Begin(stats->numViews, itemHeight);
while (clipper.Step() )
{

View File

@ -644,9 +644,9 @@ typedef InterpolatorT<bx::lerp, bx::easeInOutQuad> Interpolator;
void keyBindingHelp(const char* _bindings, const char* _description)
{
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), _bindings);
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%s", _bindings);
ImGui::SameLine(140);
ImGui::Text(_description);
ImGui::Text("%s", _description);
}
void help(const char* _error = NULL)
@ -908,6 +908,7 @@ int _main_(int _argc, char** _argv)
ImGui::Separator();
ImGui::TextColored(
ImVec4(0.0f, 1.0f, 1.0f, 1.0f)
, "%s"
, view.m_fileList[view.m_fileIndex].c_str()
);
}
@ -1067,19 +1068,23 @@ int _main_(int _argc, char** _argv)
ImGui::SetScrollY(ImGui::GetScrollY() + (index-end+1)*itemHeight);
}
ImGuiListClipper clipper(itemCount, itemHeight);
ImGuiListClipper clipper;
clipper.Begin(itemCount, itemHeight);
for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos)
while (clipper.Step() )
{
ImGui::PushID(pos);
bool isSelected = uint32_t(pos) == view.m_fileIndex;
if (ImGui::Selectable(view.m_fileList[pos].c_str(), &isSelected) )
for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos)
{
view.m_fileIndex = pos;
}
ImGui::PushID(pos);
ImGui::PopID();
bool isSelected = uint32_t(pos) == view.m_fileIndex;
if (ImGui::Selectable(view.m_fileList[pos].c_str(), &isSelected) )
{
view.m_fileIndex = pos;
}
ImGui::PopID();
}
}
clipper.End();

View File

@ -1118,9 +1118,9 @@ typedef InterpolatorT<bx::lerp, bx::easeLinear> InterpolatorLinear;
void keyBindingHelp(const char* _bindings, const char* _description)
{
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), _bindings);
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%s", _bindings);
ImGui::SameLine(100);
ImGui::Text(_description);
ImGui::Text("%s", _description);
}
void associate()
@ -1633,6 +1633,7 @@ int _main_(int _argc, char** _argv)
ImGui::Separator();
ImGui::TextColored(
ImVec4(0.0f, 1.0f, 1.0f, 1.0f)
, "%s"
, view.m_fileList[view.m_fileIndex].c_str()
);
@ -1843,19 +1844,23 @@ int _main_(int _argc, char** _argv)
ImGui::SetScrollY(ImGui::GetScrollY() + (index-end+1)*itemHeight);
}
ImGuiListClipper clipper(itemCount, itemHeight);
ImGuiListClipper clipper;
clipper.Begin(itemCount, itemHeight);
for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos)
while (clipper.Step() )
{
ImGui::PushID(pos);
bool isSelected = uint32_t(pos) == view.m_fileIndex;
if (ImGui::Selectable(view.m_fileList[pos].c_str(), &isSelected) )
for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos)
{
view.m_fileIndex = pos;
}
ImGui::PushID(pos);
ImGui::PopID();
bool isSelected = uint32_t(pos) == view.m_fileIndex;
if (ImGui::Selectable(view.m_fileList[pos].c_str(), &isSelected) )
{
view.m_fileIndex = pos;
}
ImGui::PopID();
}
}
clipper.End();