mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Updated ImGui.
This commit is contained in:
15
3rdparty/dear-imgui/imgui.cpp
vendored
15
3rdparty/dear-imgui/imgui.cpp
vendored
@@ -1482,27 +1482,27 @@ ImU32 ImHashData(const void* data_p, size_t data_size, ImU32 seed)
|
||||
// - If we reach ### in the string we discard the hash so far and reset to the seed.
|
||||
// - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build)
|
||||
// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
|
||||
ImU32 ImHashStr(const char* data, size_t data_size, ImU32 seed)
|
||||
ImU32 ImHashStr(const char* data_p, size_t data_size, ImU32 seed)
|
||||
{
|
||||
seed = ~seed;
|
||||
ImU32 crc = seed;
|
||||
const unsigned char* src = (const unsigned char*)data;
|
||||
const unsigned char* data = (const unsigned char*)data_p;
|
||||
const ImU32* crc32_lut = GCrc32LookupTable;
|
||||
if (data_size != 0)
|
||||
{
|
||||
while (data_size-- != 0)
|
||||
{
|
||||
unsigned char c = *src++;
|
||||
if (c == '#' && src[0] == '#' && src[1] == '#')
|
||||
unsigned char c = *data++;
|
||||
if (c == '#' && data_size >= 2 && data[0] == '#' && data[1] == '#')
|
||||
crc = seed;
|
||||
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (unsigned char c = *src++)
|
||||
while (unsigned char c = *data++)
|
||||
{
|
||||
if (c == '#' && src[0] == '#' && src[1] == '#')
|
||||
if (c == '#' && data[0] == '#' && data[1] == '#')
|
||||
crc = seed;
|
||||
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
||||
}
|
||||
@@ -3370,12 +3370,13 @@ void ImGui::NewFrame()
|
||||
// (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)
|
||||
IM_ASSERT(g.Initialized);
|
||||
IM_ASSERT((g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!");
|
||||
IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
|
||||
IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value!");
|
||||
IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
|
||||
IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
|
||||
IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
|
||||
IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)!");
|
||||
IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
|
||||
IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting.");
|
||||
for (int n = 0; n < ImGuiKey_COUNT; n++)
|
||||
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
|
||||
|
||||
|
||||
11
3rdparty/dear-imgui/imgui_demo.cpp
vendored
11
3rdparty/dear-imgui/imgui_demo.cpp
vendored
@@ -1460,20 +1460,23 @@ static void ShowDemoWindowWidgets()
|
||||
static int item_type = 1;
|
||||
static bool b = false;
|
||||
static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f };
|
||||
static char str[16] = {};
|
||||
ImGui::RadioButton("Text", &item_type, 0);
|
||||
ImGui::RadioButton("Button", &item_type, 1);
|
||||
ImGui::RadioButton("Checkbox", &item_type, 2);
|
||||
ImGui::RadioButton("SliderFloat", &item_type, 3);
|
||||
ImGui::RadioButton("ColorEdit4", &item_type, 4);
|
||||
ImGui::RadioButton("ListBox", &item_type, 5);
|
||||
ImGui::RadioButton("InputText", &item_type, 4);
|
||||
ImGui::RadioButton("ColorEdit4", &item_type, 5);
|
||||
ImGui::RadioButton("ListBox", &item_type, 6);
|
||||
ImGui::Separator();
|
||||
bool ret = false;
|
||||
if (item_type == 0) { ImGui::Text("ITEM: Text"); } // Testing text items with no identifier/interaction
|
||||
if (item_type == 1) { ret = ImGui::Button("ITEM: Button"); } // Testing button
|
||||
if (item_type == 2) { ret = ImGui::Checkbox("ITEM: Checkbox", &b); } // Testing checkbox
|
||||
if (item_type == 3) { ret = ImGui::SliderFloat("ITEM: SliderFloat", &col4f[0], 0.0f, 1.0f); } // Testing basic item
|
||||
if (item_type == 4) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged)
|
||||
if (item_type == 5) { const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
||||
if (item_type == 4) { ret = ImGui::InputText("ITEM: InputText", &str[0], IM_ARRAYSIZE(str)); } // Testing input text (which handles tabbing)
|
||||
if (item_type == 5) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged)
|
||||
if (item_type == 6) { const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
||||
ImGui::BulletText(
|
||||
"Return value = %d\n"
|
||||
"IsItemFocused() = %d\n"
|
||||
|
||||
4
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
4
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
@@ -4234,8 +4234,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
ImDrawList* draw_list = window->DrawList;
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
|
||||
ImDrawList* draw_list = window->DrawList;
|
||||
ImGuiStyle& style = g.Style;
|
||||
ImGuiIO& io = g.IO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user