|
|
@@ -103,8 +103,7 @@
|
|
|
- Add the Dear 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.
|
|
|
+ - See examples/ folder for standalone sample applications.
|
|
|
- You may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
|
|
|
- When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them.
|
|
|
|
|
|
@@ -1417,6 +1416,23 @@ static ImVector<ImGuiStorage::Pair>::iterator LowerBound(ImVector<ImGuiStorage::
|
|
|
return first;
|
|
|
}
|
|
|
|
|
|
+// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
|
|
|
+void ImGuiStorage::BuildSortByKey()
|
|
|
+{
|
|
|
+ struct StaticFunc
|
|
|
+ {
|
|
|
+ static int PairCompareByID(const void* lhs, const void* rhs)
|
|
|
+ {
|
|
|
+ // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
|
|
|
+ if (((const Pair*)lhs)->key > ((const Pair*)rhs)->key) return +1;
|
|
|
+ if (((const Pair*)lhs)->key < ((const Pair*)rhs)->key) return -1;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (Data.Size > 1)
|
|
|
+ qsort(Data.Data, (size_t)Data.Size, sizeof(Pair), StaticFunc::PairCompareByID);
|
|
|
+}
|
|
|
+
|
|
|
int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
|
|
|
{
|
|
|
ImVector<Pair>::iterator it = LowerBound(const_cast<ImVector<ImGuiStorage::Pair>&>(Data), key);
|