|
@@ -924,15 +924,11 @@ public:
|
|
|
inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; }
|
|
|
};
|
|
|
|
|
|
-// Helper: execute a block of code at maximum once a frame
|
|
|
-// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
|
|
+// Helper: execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
|
|
// Usage:
|
|
|
-// IMGUI_ONCE_UPON_A_FRAME
|
|
|
-// {
|
|
|
-// // code block will be executed one per frame
|
|
|
-// }
|
|
|
-// Attention! the macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces.
|
|
|
-#define IMGUI_ONCE_UPON_A_FRAME static ImGuiOnceUponAFrame imgui_oaf##__LINE__; if (imgui_oaf##__LINE__)
|
|
|
+// static ImGuiOnceUponAFrame oaf;
|
|
|
+// if (oaf)
|
|
|
+// ImGui::Text("This will be called only once per frame");
|
|
|
struct ImGuiOnceUponAFrame
|
|
|
{
|
|
|
ImGuiOnceUponAFrame() { RefFrame = -1; }
|
|
@@ -940,6 +936,11 @@ struct ImGuiOnceUponAFrame
|
|
|
operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }
|
|
|
};
|
|
|
|
|
|
+// Helper macro for ImGuiOnceUponAFrame. Attention: The macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces.
|
|
|
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // Will obsolete
|
|
|
+#define IMGUI_ONCE_UPON_A_FRAME static ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf)
|
|
|
+#endif
|
|
|
+
|
|
|
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
|
|
struct ImGuiTextFilter
|
|
|
{
|