|
@@ -637,8 +637,8 @@ CODE
|
|
// Now that we have an OpenGL texture, assuming our imgui rendering function (imgui_impl_xxx.cpp file) takes GLuint as ImTextureID, we can display it:
|
|
// Now that we have an OpenGL texture, assuming our imgui rendering function (imgui_impl_xxx.cpp file) takes GLuint as ImTextureID, we can display it:
|
|
ImGui::Image((void*)(intptr_t)my_opengl_texture, ImVec2(my_image_width, my_image_height));
|
|
ImGui::Image((void*)(intptr_t)my_opengl_texture, ImVec2(my_image_width, my_image_height));
|
|
|
|
|
|
- C/C++ tip: a void* is pointer-sized storage. You may safely store any pointer or integer into it by casting your value to ImTexture / void*, and vice-versa.
|
|
|
|
- Because both end-points (user code and rendering function) are under your control, you know exactly what is stored inside the ImTexture / void*.
|
|
|
|
|
|
+ C/C++ tip: a void* is pointer-sized storage. You may safely store any pointer or integer into it by casting your value to ImTextureID / void*, and vice-versa.
|
|
|
|
+ Because both end-points (user code and rendering function) are under your control, you know exactly what is stored inside the ImTextureID / void*.
|
|
Examples:
|
|
Examples:
|
|
|
|
|
|
GLuint my_tex = XXX;
|
|
GLuint my_tex = XXX;
|
|
@@ -875,7 +875,7 @@ CODE
|
|
A: - You can create a dummy window. Call Begin() with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags.
|
|
A: - You can create a dummy window. Call Begin() with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags.
|
|
(The ImGuiWindowFlags_NoDecoration flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse)
|
|
(The ImGuiWindowFlags_NoDecoration flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse)
|
|
Then you can retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like.
|
|
Then you can retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like.
|
|
- - You can call ImGui::GetBackgroundDrawList() or ImGui::GetForegroundDrawList() and use those draw list to display
|
|
|
|
|
|
+ - You can call ImGui::GetBackgroundDrawList() or ImGui::GetForegroundDrawList() and use those draw list to display
|
|
contents behind or over every other imgui windows.
|
|
contents behind or over every other imgui windows.
|
|
- You can create your own ImDrawList instance. You'll need to initialize them ImGui::GetDrawListSharedData(), or create
|
|
- You can create your own ImDrawList instance. You'll need to initialize them ImGui::GetDrawListSharedData(), or create
|
|
your own ImDrawListSharedData, and then call your rendered code with your own ImDrawList or ImDrawData data.
|
|
your own ImDrawListSharedData, and then call your rendered code with your own ImDrawList or ImDrawData data.
|
|
@@ -1297,7 +1297,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);
|
|
@@ -1443,7 +1443,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,
|
|
@@ -2850,7 +2850,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;
|
|
@@ -4093,7 +4093,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];
|
|
@@ -4103,7 +4103,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];
|
|
@@ -4800,7 +4800,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)
|
|
@@ -7009,7 +7009,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);
|
|
|
|
|
|
@@ -7876,7 +7876,7 @@ static void ImGui::NavUpdate()
|
|
if (g.NavWindow)
|
|
if (g.NavWindow)
|
|
{
|
|
{
|
|
ImDrawList* draw_list = GetForegroundDrawList(g.NavWindow);
|
|
ImDrawList* draw_list = GetForegroundDrawList(g.NavWindow);
|
|
- if (1) { for (int layer = 0; layer < 2; layer++) draw_list->AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG]
|
|
|
|
|
|
+ if (1) { for (int layer = 0; layer < 2; layer++) draw_list->AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG]
|
|
if (1) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); draw_list->AddCircleFilled(p, 3.0f, col); draw_list->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); }
|
|
if (1) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); draw_list->AddCircleFilled(p, 3.0f, col); draw_list->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); }
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
@@ -8829,7 +8829,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.
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
@@ -8884,7 +8884,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;
|
|
}
|
|
}
|
|
@@ -8933,7 +8933,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)
|