|
@@ -293,7 +293,7 @@ CODE
|
|
|
MyEngineScissor((int)(pcmd->ClipRect.x - pos.x), (int)(pcmd->ClipRect.y - pos.y), (int)(pcmd->ClipRect.z - pos.x), (int)(pcmd->ClipRect.w - pos.y));
|
|
MyEngineScissor((int)(pcmd->ClipRect.x - pos.x), (int)(pcmd->ClipRect.y - pos.y), (int)(pcmd->ClipRect.z - pos.x), (int)(pcmd->ClipRect.w - pos.y));
|
|
|
|
|
|
|
|
// Render 'pcmd->ElemCount/3' indexed triangles.
|
|
// Render 'pcmd->ElemCount/3' indexed triangles.
|
|
|
- // By default the indices ImDrawIdx are 16-bits, you can change them to 32-bits in imconfig.h if your engine doesn't support 16-bits indices.
|
|
|
|
|
|
|
+ // By default the indices ImDrawIdx are 16-bit, you can change them to 32-bit in imconfig.h if your engine doesn't support 16-bit indices.
|
|
|
MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer);
|
|
MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer);
|
|
|
}
|
|
}
|
|
|
idx_buffer += pcmd->ElemCount;
|
|
idx_buffer += pcmd->ElemCount;
|
|
@@ -353,6 +353,7 @@ CODE
|
|
|
When you are not sure about a 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 a 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.
|
|
|
|
|
|
|
|
|
|
+ - 2019/11/21 (1.74) - ImFontAtlas::AddCustomRectRegular() now requires an ID larger than 0x110000 (instead of 0x10000) to conform with supporting Unicode planes 1-16 in a future update. ID below 0x110000 will now assert.
|
|
|
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS for consistency.
|
|
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS for consistency.
|
|
|
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency.
|
|
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency.
|
|
|
- 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73.
|
|
- 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73.
|
|
@@ -1063,7 +1064,7 @@ ImGuiIO::ImGuiIO()
|
|
|
// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message
|
|
// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message
|
|
|
void ImGuiIO::AddInputCharacter(unsigned int c)
|
|
void ImGuiIO::AddInputCharacter(unsigned int c)
|
|
|
{
|
|
{
|
|
|
- if (c > 0 && c < 0x10000)
|
|
|
|
|
|
|
+ if (c > 0 && c <= IM_UNICODE_CODEPOINT_MAX)
|
|
|
InputQueueCharacters.push_back((ImWchar)c);
|
|
InputQueueCharacters.push_back((ImWchar)c);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1073,7 +1074,7 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|
|
{
|
|
{
|
|
|
unsigned int c = 0;
|
|
unsigned int c = 0;
|
|
|
utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL);
|
|
utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL);
|
|
|
- if (c > 0 && c < 0x10000)
|
|
|
|
|
|
|
+ if (c > 0 && c <= IM_UNICODE_CODEPOINT_MAX)
|
|
|
InputQueueCharacters.push_back((ImWchar)c);
|
|
InputQueueCharacters.push_back((ImWchar)c);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1188,7 +1189,7 @@ const char* ImStrchrRange(const char* str, const char* str_end, char c)
|
|
|
|
|
|
|
|
int ImStrlenW(const ImWchar* str)
|
|
int ImStrlenW(const ImWchar* str)
|
|
|
{
|
|
{
|
|
|
- //return (int)wcslen((const wchar_t*)str); // FIXME-OPT: Could use this when wchar_t are 16-bits
|
|
|
|
|
|
|
+ //return (int)wcslen((const wchar_t*)str); // FIXME-OPT: Could use this when wchar_t are 16-bit
|
|
|
int n = 0;
|
|
int n = 0;
|
|
|
while (*str++) n++;
|
|
while (*str++) n++;
|
|
|
return n;
|
|
return n;
|
|
@@ -1397,10 +1398,12 @@ ImFileHandle ImFileOpen(const char* filename, const char* mode)
|
|
|
return fopen(filename, mode);
|
|
return fopen(filename, mode);
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
-int ImFileClose(ImFileHandle f) { return fclose(f); }
|
|
|
|
|
-size_t ImFileGetSize(ImFileHandle f) { long off = 0, sz = 0; return ((off = ftell(f)) != -1 && !fseek(f, 0, SEEK_END) && (sz = ftell(f)) != -1 && !fseek(f, off, SEEK_SET)) ? (size_t)sz : (size_t)-1; }
|
|
|
|
|
-size_t ImFileRead(void* data, size_t sz, size_t count, ImFileHandle f) { return fread(data, sz, count, f); }
|
|
|
|
|
-size_t ImFileWrite(const void* data, size_t sz, size_t count, ImFileHandle f) { return fwrite(data, sz, count, f); }
|
|
|
|
|
|
|
+
|
|
|
|
|
+// We should in theory be using fseeko()/ftello() with off_t and _fseeki64()/_ftelli64() with __int64, waiting for the PR that does that in a very portable pre-C++11 zero-warnings way.
|
|
|
|
|
+bool ImFileClose(ImFileHandle f) { return fclose(f) == 0; }
|
|
|
|
|
+ImU64 ImFileGetSize(ImFileHandle f) { long off = 0, sz = 0; return ((off = ftell(f)) != -1 && !fseek(f, 0, SEEK_END) && (sz = ftell(f)) != -1 && !fseek(f, off, SEEK_SET)) ? (ImU64)sz : (ImU64)-1; }
|
|
|
|
|
+ImU64 ImFileRead(void* data, ImU64 sz, ImU64 count, ImFileHandle f) { return fread(data, (size_t)sz, (size_t)count, f); }
|
|
|
|
|
+ImU64 ImFileWrite(const void* data, ImU64 sz, ImU64 count, ImFileHandle f) { return fwrite(data, (size_t)sz, (size_t)count, f); }
|
|
|
#endif // #ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
|
#endif // #ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
|
|
|
|
|
|
|
// Helper: Load file content into memory
|
|
// Helper: Load file content into memory
|
|
@@ -1415,7 +1418,7 @@ void* ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_f
|
|
|
if ((f = ImFileOpen(filename, mode)) == NULL)
|
|
if ((f = ImFileOpen(filename, mode)) == NULL)
|
|
|
return NULL;
|
|
return NULL;
|
|
|
|
|
|
|
|
- size_t file_size = ImFileGetSize(f);
|
|
|
|
|
|
|
+ size_t file_size = (size_t)ImFileGetSize(f);
|
|
|
if (file_size == (size_t)-1)
|
|
if (file_size == (size_t)-1)
|
|
|
{
|
|
{
|
|
|
ImFileClose(f);
|
|
ImFileClose(f);
|
|
@@ -1448,7 +1451,7 @@ void* ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_f
|
|
|
// [SECTION] MISC HELPERS/UTILITIES (ImText* functions)
|
|
// [SECTION] MISC HELPERS/UTILITIES (ImText* functions)
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-// Convert UTF-8 to 32-bits character, process single character input.
|
|
|
|
|
|
|
+// Convert UTF-8 to 32-bit character, process single character input.
|
|
|
// Based on stb_from_utf8() from github.com/nothings/stb/
|
|
// Based on stb_from_utf8() from github.com/nothings/stb/
|
|
|
// We handle UTF-8 decoding error by skipping forward.
|
|
// We handle UTF-8 decoding error by skipping forward.
|
|
|
int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end)
|
|
int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end)
|
|
@@ -1463,7 +1466,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char*
|
|
|
}
|
|
}
|
|
|
if ((*str & 0xe0) == 0xc0)
|
|
if ((*str & 0xe0) == 0xc0)
|
|
|
{
|
|
{
|
|
|
- *out_char = 0xFFFD; // will be invalid but not end of string
|
|
|
|
|
|
|
+ *out_char = IM_UNICODE_CODEPOINT_INVALID; // will be invalid but not end of string
|
|
|
if (in_text_end && in_text_end - (const char*)str < 2) return 1;
|
|
if (in_text_end && in_text_end - (const char*)str < 2) return 1;
|
|
|
if (*str < 0xc2) return 2;
|
|
if (*str < 0xc2) return 2;
|
|
|
c = (unsigned int)((*str++ & 0x1f) << 6);
|
|
c = (unsigned int)((*str++ & 0x1f) << 6);
|
|
@@ -1474,7 +1477,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char*
|
|
|
}
|
|
}
|
|
|
if ((*str & 0xf0) == 0xe0)
|
|
if ((*str & 0xf0) == 0xe0)
|
|
|
{
|
|
{
|
|
|
- *out_char = 0xFFFD; // will be invalid but not end of string
|
|
|
|
|
|
|
+ *out_char = IM_UNICODE_CODEPOINT_INVALID; // will be invalid but not end of string
|
|
|
if (in_text_end && in_text_end - (const char*)str < 3) return 1;
|
|
if (in_text_end && in_text_end - (const char*)str < 3) return 1;
|
|
|
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3;
|
|
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3;
|
|
|
if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below
|
|
if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below
|
|
@@ -1488,7 +1491,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char*
|
|
|
}
|
|
}
|
|
|
if ((*str & 0xf8) == 0xf0)
|
|
if ((*str & 0xf8) == 0xf0)
|
|
|
{
|
|
{
|
|
|
- *out_char = 0xFFFD; // will be invalid but not end of string
|
|
|
|
|
|
|
+ *out_char = IM_UNICODE_CODEPOINT_INVALID; // will be invalid but not end of string
|
|
|
if (in_text_end && in_text_end - (const char*)str < 4) return 1;
|
|
if (in_text_end && in_text_end - (const char*)str < 4) return 1;
|
|
|
if (*str > 0xf4) return 4;
|
|
if (*str > 0xf4) return 4;
|
|
|
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4;
|
|
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4;
|
|
@@ -1519,7 +1522,7 @@ int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const cha
|
|
|
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
|
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
|
|
if (c == 0)
|
|
if (c == 0)
|
|
|
break;
|
|
break;
|
|
|
- if (c < 0x10000) // FIXME: Losing characters that don't fit in 2 bytes
|
|
|
|
|
|
|
+ if (c <= IM_UNICODE_CODEPOINT_MAX) // FIXME: Losing characters that don't fit in 2 bytes
|
|
|
*buf_out++ = (ImWchar)c;
|
|
*buf_out++ = (ImWchar)c;
|
|
|
}
|
|
}
|
|
|
*buf_out = 0;
|
|
*buf_out = 0;
|
|
@@ -1537,7 +1540,7 @@ int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end)
|
|
|
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
|
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
|
|
if (c == 0)
|
|
if (c == 0)
|
|
|
break;
|
|
break;
|
|
|
- if (c < 0x10000)
|
|
|
|
|
|
|
+ if (c <= IM_UNICODE_CODEPOINT_MAX)
|
|
|
char_count++;
|
|
char_count++;
|
|
|
}
|
|
}
|
|
|
return char_count;
|
|
return char_count;
|
|
@@ -3910,7 +3913,7 @@ static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* d
|
|
|
// (A) Handle the ImDrawCmd::VtxOffset value in your renderer back-end, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'.
|
|
// (A) Handle the ImDrawCmd::VtxOffset value in your renderer back-end, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'.
|
|
|
// Most example back-ends already support this from 1.71. Pre-1.71 back-ends won't.
|
|
// Most example back-ends already support this from 1.71. Pre-1.71 back-ends won't.
|
|
|
// Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them.
|
|
// Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them.
|
|
|
- // (B) Or handle 32-bits indices in your renderer back-end, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h.
|
|
|
|
|
|
|
+ // (B) Or handle 32-bit indices in your renderer back-end, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h.
|
|
|
// Most example back-ends already support this. For example, the OpenGL example code detect index size at compile-time:
|
|
// Most example back-ends already support this. For example, the OpenGL example code detect index size at compile-time:
|
|
|
// glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
|
// glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
|
|
// Your own engine or render API may use different parameters or function calls to specify index sizes.
|
|
// Your own engine or render API may use different parameters or function calls to specify index sizes.
|
|
@@ -9078,7 +9081,7 @@ void ImGui::LogText(const char* fmt, ...)
|
|
|
{
|
|
{
|
|
|
g.LogBuffer.Buf.resize(0);
|
|
g.LogBuffer.Buf.resize(0);
|
|
|
g.LogBuffer.appendfv(fmt, args);
|
|
g.LogBuffer.appendfv(fmt, args);
|
|
|
- ImFileWrite(g.LogBuffer.c_str(), sizeof(char), (size_t)g.LogBuffer.size(), g.LogFile);
|
|
|
|
|
|
|
+ ImFileWrite(g.LogBuffer.c_str(), sizeof(char), (ImU64)g.LogBuffer.size(), g.LogFile);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -9899,7 +9902,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
ImGui::PushID(tab);
|
|
ImGui::PushID(tab);
|
|
|
if (ImGui::SmallButton("<")) { TabBarQueueChangeTabOrder(tab_bar, tab, -1); } ImGui::SameLine(0, 2);
|
|
if (ImGui::SmallButton("<")) { TabBarQueueChangeTabOrder(tab_bar, tab, -1); } ImGui::SameLine(0, 2);
|
|
|
if (ImGui::SmallButton(">")) { TabBarQueueChangeTabOrder(tab_bar, tab, +1); } ImGui::SameLine();
|
|
if (ImGui::SmallButton(">")) { TabBarQueueChangeTabOrder(tab_bar, tab, +1); } ImGui::SameLine();
|
|
|
- ImGui::Text("%02d%c Tab 0x%08X", tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID);
|
|
|
|
|
|
|
+ ImGui::Text("%02d%c Tab 0x%08X '%s'", tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "");
|
|
|
ImGui::PopID();
|
|
ImGui::PopID();
|
|
|
}
|
|
}
|
|
|
ImGui::TreePop();
|
|
ImGui::TreePop();
|