Updated ImGui.

This commit is contained in:
Бранимир Караџић 2019-02-24 15:11:36 -08:00
parent 588dfd96b3
commit a356a1d051
3 changed files with 13 additions and 12 deletions

View File

@ -1296,7 +1296,7 @@ int ImStrnicmp(const char* str1, const char* str2, size_t count)
void ImStrncpy(char* dst, const char* src, size_t count) void ImStrncpy(char* dst, const char* src, size_t count)
{ {
if (count < 1) if (count < 1)
return; return;
if (count > 1) if (count > 1)
strncpy(dst, src, count - 1); strncpy(dst, src, count - 1);
@ -1442,7 +1442,7 @@ int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args)
// CRC32 needs a 1KB lookup table (not cache friendly) // CRC32 needs a 1KB lookup table (not cache friendly)
// Although the code to generate the table is simple and shorter than the table itself, using a const table allows us to easily: // Although the code to generate the table is simple and shorter than the table itself, using a const table allows us to easily:
// - avoid an unnecessary branch/memory tap, - keep the ImHashXXX functions usable by static constructors, - make it thread-safe. // - avoid an unnecessary branch/memory tap, - keep the ImHashXXX functions usable by static constructors, - make it thread-safe.
static const ImU32 GCrc32LookupTable[256] = static const ImU32 GCrc32LookupTable[256] =
{ {
0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91, 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,
0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7,0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5, 0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7,0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5,
@ -2853,7 +2853,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
if ((window->DC.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled)) if ((window->DC.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
return false; return false;
// Special handling for the dummy item after Begin() which represent the title bar or tab. // Special handling for the dummy item after Begin() which represent the title bar or tab.
// When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case. // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.
if (window->DC.LastItemId == window->MoveId && window->WriteAccessed) if (window->DC.LastItemId == window->MoveId && window->WriteAccessed)
return false; return false;
@ -4047,7 +4047,7 @@ int ImGui::CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_
int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate) int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
if (key_index < 0) if (key_index < 0)
return 0; return 0;
IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown)); IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
const float t = g.IO.KeysDownDuration[key_index]; const float t = g.IO.KeysDownDuration[key_index];
@ -4057,7 +4057,7 @@ int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_r
bool ImGui::IsKeyPressed(int user_key_index, bool repeat) bool ImGui::IsKeyPressed(int user_key_index, bool repeat)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
if (user_key_index < 0) if (user_key_index < 0)
return false; return false;
IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));
const float t = g.IO.KeysDownDuration[user_key_index]; const float t = g.IO.KeysDownDuration[user_key_index];
@ -4753,7 +4753,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held) if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held)
{ {
g.MouseCursor = (border_n & 1) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS; g.MouseCursor = (border_n & 1) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS;
if (held) if (held)
*border_held = border_n; *border_held = border_n;
} }
if (held) if (held)
@ -6965,7 +6965,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags fla
void ImGui::EndPopup() void ImGui::EndPopup()
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
IM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls IM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
IM_ASSERT(g.BeginPopupStack.Size > 0); IM_ASSERT(g.BeginPopupStack.Size > 0);
@ -8772,7 +8772,7 @@ void ImGui::EndDragDropTarget()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// [SECTION] LOGGING/CAPTURING // [SECTION] LOGGING/CAPTURING
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// All text output from the interface can be captured into tty/file/clipboard. // All text output from the interface can be captured into tty/file/clipboard.
// By default, tree nodes are automatically opened during logging. // By default, tree nodes are automatically opened during logging.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -8827,7 +8827,7 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
LogText(IM_NEWLINE "%*s%.*s", tree_depth * 4, "", char_count, line_start); LogText(IM_NEWLINE "%*s%.*s", tree_depth * 4, "", char_count, line_start);
else if (g.LogLineFirstItem) else if (g.LogLineFirstItem)
LogText("%*s%.*s", tree_depth * 4, "", char_count, line_start); LogText("%*s%.*s", tree_depth * 4, "", char_count, line_start);
else else
LogText(" %.*s", char_count, line_start); LogText(" %.*s", char_count, line_start);
g.LogLineFirstItem = false; g.LogLineFirstItem = false;
} }
@ -8876,7 +8876,7 @@ void ImGui::LogToFile(int auto_open_depth, const char* filename)
if (g.LogEnabled) if (g.LogEnabled)
return; return;
// FIXME: We could probably open the file in text mode "at", however note that clipboard/buffer logging will still // FIXME: We could probably open the file in text mode "at", however note that clipboard/buffer logging will still
// be subject to outputting OS-incompatible carriage return if within strings the user doesn't use IM_NEWLINE. // be subject to outputting OS-incompatible carriage return if within strings the user doesn't use IM_NEWLINE.
// By opening the file in binary mode "ab" we have consistent output everywhere. // By opening the file in binary mode "ab" we have consistent output everywhere.
if (!filename) if (!filename)
@ -8933,6 +8933,7 @@ void ImGui::LogFinish()
SetClipboardText(g.LogBuffer.begin()); SetClipboardText(g.LogBuffer.begin());
break; break;
case ImGuiLogType_None: case ImGuiLogType_None:
IM_ASSERT(0);
break; break;
} }

View File

@ -407,7 +407,7 @@ ImDrawList* ImDrawList::CloneOutput() const
// Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds // Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds
#define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : _Data->ClipRectFullscreen) #define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : _Data->ClipRectFullscreen)
#define GetCurrentTextureId() (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : NULL) #define GetCurrentTextureId() (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : (ImTextureID)NULL)
void ImDrawList::AddDrawCmd() void ImDrawList::AddDrawCmd()
{ {

View File

@ -3158,7 +3158,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
ImGuiIO& io = g.IO; ImGuiIO& io = g.IO;
const ImGuiStyle& style = g.Style; const ImGuiStyle& style = g.Style;
const bool RENDER_SELECTION_WHEN_INACTIVE = true; const bool RENDER_SELECTION_WHEN_INACTIVE = false;
const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0;
const bool is_readonly = (flags & ImGuiInputTextFlags_ReadOnly) != 0; const bool is_readonly = (flags & ImGuiInputTextFlags_ReadOnly) != 0;
const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0; const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;