Removed old nested structure: renaming ImGuiStorage::ImGuiStoragePair type to ImGuiStoragePair (simpler for many languages).

This commit is contained in:
ocornut 2024-06-10 17:42:08 +02:00
parent 7538ca6f40
commit 22d65c7949
3 changed files with 27 additions and 18 deletions

View File

@ -41,6 +41,9 @@ HOW TO UPDATE?
Breaking changes: Breaking changes:
- Removed old nested structure: renaming ImGuiStorage::ImGuiStoragePair type to
ImGuiStoragePair (simpler for many languages). No significant nested type left.
Other changes: Other changes:
- Examples: GLFW+Vulkan, SDL+Vulkan: handle swap chain resize even without Vulkan - Examples: GLFW+Vulkan, SDL+Vulkan: handle swap chain resize even without Vulkan

View File

@ -430,6 +430,7 @@ CODE
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. When you are not sure about an 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. You can read releases logs https://github.com/ocornut/imgui/releases for more details.
- 2024/06/10 (1.90.9) - removed old nested structure: renaming ImGuiStorage::ImGuiStoragePair type to ImGuiStoragePair (simpler for many languages).
- 2024/06/06 (1.90.8) - reordered ImGuiInputTextFlags values. This should not be breaking unless you are using generated headers that have values not matching the main library. - 2024/06/06 (1.90.8) - reordered ImGuiInputTextFlags values. This should not be breaking unless you are using generated headers that have values not matching the main library.
- 2024/06/06 (1.90.8) - removed 'ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft', was mostly unused and misleading. - 2024/06/06 (1.90.8) - removed 'ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft', was mostly unused and misleading.
- 2024/05/27 (1.90.7) - commented out obsolete symbols marked obsolete in 1.88 (May 2022): - 2024/05/27 (1.90.7) - commented out obsolete symbols marked obsolete in 1.88 (May 2022):
@ -2502,15 +2503,14 @@ void ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float&
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// std::lower_bound but without the bullshit // std::lower_bound but without the bullshit
static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key) static ImGuiStoragePair* LowerBound(ImVector<ImGuiStoragePair>& data, ImGuiID key)
{ {
ImGuiStorage::ImGuiStoragePair* first = data.Data; ImGuiStoragePair* first = data.Data;
ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; ImGuiStoragePair* last = data.Data + data.Size;
size_t count = (size_t)(last - first); for (size_t count = (size_t)(last - first); count > 0; )
while (count > 0)
{ {
size_t count2 = count >> 1; size_t count2 = count >> 1;
ImGuiStorage::ImGuiStoragePair* mid = first + count2; ImGuiStoragePair* mid = first + count2;
if (mid->key < key) if (mid->key < key)
{ {
first = ++mid; first = ++mid;
@ -15419,7 +15419,7 @@ void ImGui::DebugNodeStorage(ImGuiStorage* storage, const char* label)
{ {
if (!TreeNode(label, "%s: %d entries, %d bytes", label, storage->Data.Size, storage->Data.size_in_bytes())) if (!TreeNode(label, "%s: %d entries, %d bytes", label, storage->Data.Size, storage->Data.size_in_bytes()))
return; return;
for (const ImGuiStorage::ImGuiStoragePair& p : storage->Data) for (const ImGuiStoragePair& p : storage->Data)
BulletText("Key 0x%08X Value { i: %d }", p.key, p.val_i); // Important: we currently don't store a type, real value may not be integer. BulletText("Key 0x%08X Value { i: %d }", p.key, p.val_i); // Important: we currently don't store a type, real value may not be integer.
TreePop(); TreePop();
} }

28
imgui.h
View File

@ -28,7 +28,7 @@
// Library Version // Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.90.9 WIP" #define IMGUI_VERSION "1.90.9 WIP"
#define IMGUI_VERSION_NUM 19080 #define IMGUI_VERSION_NUM 19081
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE
/* /*
@ -178,7 +178,8 @@ struct ImGuiOnceUponAFrame; // Helper for running a block of code not mo
struct ImGuiPayload; // User data payload for drag and drop operations struct ImGuiPayload; // User data payload for drag and drop operations
struct ImGuiPlatformImeData; // Platform IME data for io.SetPlatformImeDataFn() function. struct ImGuiPlatformImeData; // Platform IME data for io.SetPlatformImeDataFn() function.
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use) struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
struct ImGuiStorage; // Helper for key->value storage struct ImGuiStorage; // Helper for key->value storage (container sorted by key)
struct ImGuiStoragePair; // Helper for key->value storage (pair)
struct ImGuiStyle; // Runtime data for styling/colors struct ImGuiStyle; // Runtime data for styling/colors
struct ImGuiTableSortSpecs; // Sorting specifications for a table (often handling sort specs for a single column, occasionally more) struct ImGuiTableSortSpecs; // Sorting specifications for a table (often handling sort specs for a single column, occasionally more)
struct ImGuiTableColumnSortSpecs; // Sorting specification for one column of a table struct ImGuiTableColumnSortSpecs; // Sorting specification for one column of a table
@ -2460,6 +2461,16 @@ struct ImGuiTextBuffer
IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2);
}; };
// [Internal] Key+Value for ImGuiStorage
struct ImGuiStoragePair
{
ImGuiID key;
union { int val_i; float val_f; void* val_p; };
ImGuiStoragePair(ImGuiID _key, int _val) { key = _key; val_i = _val; }
ImGuiStoragePair(ImGuiID _key, float _val) { key = _key; val_f = _val; }
ImGuiStoragePair(ImGuiID _key, void* _val) { key = _key; val_p = _val; }
};
// Helper: Key->Value storage // Helper: Key->Value storage
// Typically you don't have to worry about this since a storage is held within each Window. // Typically you don't have to worry about this since a storage is held within each Window.
// We use it to e.g. store collapse state for a tree (Int 0/1) // We use it to e.g. store collapse state for a tree (Int 0/1)
@ -2471,15 +2482,6 @@ struct ImGuiTextBuffer
struct ImGuiStorage struct ImGuiStorage
{ {
// [Internal] // [Internal]
struct ImGuiStoragePair
{
ImGuiID key;
union { int val_i; float val_f; void* val_p; };
ImGuiStoragePair(ImGuiID _key, int _val) { key = _key; val_i = _val; }
ImGuiStoragePair(ImGuiID _key, float _val) { key = _key; val_f = _val; }
ImGuiStoragePair(ImGuiID _key, void* _val) { key = _key; val_p = _val; }
};
ImVector<ImGuiStoragePair> Data; ImVector<ImGuiStoragePair> Data;
// - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)
@ -2508,6 +2510,10 @@ struct ImGuiStorage
IMGUI_API void BuildSortByKey(); IMGUI_API void BuildSortByKey();
// Obsolete: use on your own storage if you know only integer are being stored (open/close all tree nodes) // Obsolete: use on your own storage if you know only integer are being stored (open/close all tree nodes)
IMGUI_API void SetAllInt(int val); IMGUI_API void SetAllInt(int val);
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//typedef ::ImGuiStoragePair ImGuiStoragePair; // 1.90.8: moved type outside struct
#endif
}; };
// Helper: Manually clip large list of items. // Helper: Manually clip large list of items.