mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-21 23:26:36 +00:00
Merge branch 'master' into viewport
# Conflicts: # imgui.cpp
This commit is contained in:
commit
a2616c79fe
@ -38,6 +38,7 @@ Breaking Changes:
|
|||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- Clarified and improved the source code sectioning in all files (easier to search or browse sections).
|
||||||
- Nav: Removed the [Beta] tag from various descriptions of the gamepad/keyboard navigation system.
|
- Nav: Removed the [Beta] tag from various descriptions of the gamepad/keyboard navigation system.
|
||||||
Although it is not perfect and will keep being improved, it is fairly functional and used by many. (#787)
|
Although it is not perfect and will keep being improved, it is fairly functional and used by many. (#787)
|
||||||
- Fixed a build issue with non-Cygwin GCC under Windows.
|
- Fixed a build issue with non-Cygwin GCC under Windows.
|
||||||
|
224
imgui.cpp
224
imgui.cpp
@ -22,12 +22,15 @@
|
|||||||
Index of this file:
|
Index of this file:
|
||||||
|
|
||||||
DOCUMENTATION
|
DOCUMENTATION
|
||||||
|
|
||||||
- MISSION STATEMENT
|
- MISSION STATEMENT
|
||||||
- END-USER GUIDE
|
- END-USER GUIDE
|
||||||
- PROGRAMMER GUIDE (read me!)
|
- PROGRAMMER GUIDE (read me!)
|
||||||
- Read first
|
- Read first
|
||||||
- How to update to a newer version of Dear ImGui
|
- How to update to a newer version of Dear ImGui
|
||||||
- Getting started with integrating Dear ImGui in your code/engine
|
- Getting started with integrating Dear ImGui in your code/engine
|
||||||
|
- This is how a simple application may look like (2 variations)
|
||||||
|
- This is how a simple rendering function may look like
|
||||||
- Using gamepad/keyboard navigation controls
|
- Using gamepad/keyboard navigation controls
|
||||||
- API BREAKING CHANGES (read me when you update!)
|
- API BREAKING CHANGES (read me when you update!)
|
||||||
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
|
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
|
||||||
@ -45,31 +48,35 @@ DOCUMENTATION
|
|||||||
- How can I help?
|
- How can I help?
|
||||||
|
|
||||||
CODE
|
CODE
|
||||||
- Forward Declarations
|
(search for "[SECTION]" in the code to find them)
|
||||||
- Context and Memory Allocators
|
|
||||||
- User facing structures (ImGuiStyle, ImGuiIO)
|
// [SECTION] FORWARD DECLARATIONS
|
||||||
- Helper/Utilities (ImXXX functions, Color functions)
|
// [SECTION] CONTEXT AND MEMORY ALLOCATORS
|
||||||
- ImGuiStorage
|
// [SECTION] MAIN USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)
|
||||||
- ImGuiTextFilter
|
// [SECTION] MISC HELPER/UTILITIES (Maths, String, Format, Hash, File functions)
|
||||||
- ImGuiTextBuffer
|
// [SECTION] MISC HELPER/UTILITIES (ImText* functions)
|
||||||
- ImGuiListClipper
|
// [SECTION] MISC HELPER/UTILITIES (Color functions)
|
||||||
- Render Helpers
|
// [SECTION] ImGuiStorage
|
||||||
- Main Code (most of the code! lots of stuff, needs tidying up)
|
// [SECTION] ImGuiTextFilter
|
||||||
- Tooltips
|
// [SECTION] ImGuiTextBuffer
|
||||||
- Popups
|
// [SECTION] ImGuiListClipper
|
||||||
- Viewports, Platform Windows
|
// [SECTION] RENDER HELPERS
|
||||||
- Navigation
|
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
||||||
- Columns
|
// [SECTION] TOOLTIPS
|
||||||
- Drag and Drop
|
// [SECTION] POPUPS
|
||||||
- Logging
|
// [SECTION] VIEWPORTS, PLATFORM WINDOWS
|
||||||
- Settings
|
// [SECTION] KEYBOARD/GAMEPAD NAVIGATION
|
||||||
- Platform Dependent Helpers
|
// [SECTION] COLUMNS
|
||||||
- Metrics/Debug window
|
// [SECTION] DRAG AND DROP
|
||||||
|
// [SECTION] LOGGING/CAPTURING
|
||||||
|
// [SECTION] SETTINGS
|
||||||
|
// [SECTION] PLATFORM DEPENDENT HELPERS
|
||||||
|
// [SECTION] METRICS/DEBUG WINDOW
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Documentation
|
// DOCUMENTATION
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -895,7 +902,7 @@ static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the h
|
|||||||
static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time before the window list starts to appear
|
static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time before the window list starts to appear
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Forward Declarations
|
// [SECTION] FORWARD DECLARATIONS
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
static void SetCurrentWindow(ImGuiWindow* window);
|
static void SetCurrentWindow(ImGuiWindow* window);
|
||||||
@ -954,7 +961,7 @@ static int FindPlatformMonitorForRect(const ImRect& r);
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Context and Memory Allocators
|
// [SECTION] CONTEXT AND MEMORY ALLOCATORS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Current context pointer. Implicitly used by all ImGui functions. Always assumed to be != NULL.
|
// Current context pointer. Implicitly used by all ImGui functions. Always assumed to be != NULL.
|
||||||
@ -983,7 +990,7 @@ static void (*GImAllocatorFreeFunc)(void* ptr, void* user_data) = FreeWrapper;
|
|||||||
static void* GImAllocatorUserData = NULL;
|
static void* GImAllocatorUserData = NULL;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// User facing main structures
|
// [SECTION] MAIN USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImGuiStyle::ImGuiStyle()
|
ImGuiStyle::ImGuiStyle()
|
||||||
@ -1125,7 +1132,7 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// HELPERS/UTILITIES
|
// [SECTION] MISC HELPER/UTILITIES (Maths, String, Format, Hash, File functions)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p)
|
ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p)
|
||||||
@ -1343,8 +1350,66 @@ ImU32 ImHash(const void* data, int data_size, ImU32 seed)
|
|||||||
return ~crc;
|
return ~crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FILE* ImFileOpen(const char* filename, const char* mode)
|
||||||
|
{
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__)
|
||||||
|
// We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames. Converting both strings from UTF-8 to wchar format (using a single allocation, because we can)
|
||||||
|
const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1;
|
||||||
|
const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1;
|
||||||
|
ImVector<ImWchar> buf;
|
||||||
|
buf.resize(filename_wsize + mode_wsize);
|
||||||
|
ImTextStrFromUtf8(&buf[0], filename_wsize, filename, NULL);
|
||||||
|
ImTextStrFromUtf8(&buf[filename_wsize], mode_wsize, mode, NULL);
|
||||||
|
return _wfopen((wchar_t*)&buf[0], (wchar_t*)&buf[filename_wsize]);
|
||||||
|
#else
|
||||||
|
return fopen(filename, mode);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load file content into memory
|
||||||
|
// Memory allocated with ImGui::MemAlloc(), must be freed by user using ImGui::MemFree()
|
||||||
|
void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, size_t* out_file_size, int padding_bytes)
|
||||||
|
{
|
||||||
|
IM_ASSERT(filename && file_open_mode);
|
||||||
|
if (out_file_size)
|
||||||
|
*out_file_size = 0;
|
||||||
|
|
||||||
|
FILE* f;
|
||||||
|
if ((f = ImFileOpen(filename, file_open_mode)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
long file_size_signed;
|
||||||
|
if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET))
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t file_size = (size_t)file_size_signed;
|
||||||
|
void* file_data = ImGui::MemAlloc(file_size + padding_bytes);
|
||||||
|
if (file_data == NULL)
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (fread(file_data, 1, file_size, f) != file_size)
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
ImGui::MemFree(file_data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (padding_bytes > 0)
|
||||||
|
memset((void*)(((char*)file_data) + file_size), 0, (size_t)padding_bytes);
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
if (out_file_size)
|
||||||
|
*out_file_size = file_size;
|
||||||
|
|
||||||
|
return file_data;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// HELPERS/UTILITIES (ImText* helpers)
|
// [SECTION] MISC HELPERS/UTILITIES (ImText* functions)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Convert UTF-8 to 32-bits character, process single character input.
|
// Convert UTF-8 to 32-bits character, process single character input.
|
||||||
@ -1526,66 +1591,9 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_e
|
|||||||
return bytes_count;
|
return bytes_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* ImFileOpen(const char* filename, const char* mode)
|
|
||||||
{
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__)
|
|
||||||
// We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames. Converting both strings from UTF-8 to wchar format (using a single allocation, because we can)
|
|
||||||
const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1;
|
|
||||||
const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1;
|
|
||||||
ImVector<ImWchar> buf;
|
|
||||||
buf.resize(filename_wsize + mode_wsize);
|
|
||||||
ImTextStrFromUtf8(&buf[0], filename_wsize, filename, NULL);
|
|
||||||
ImTextStrFromUtf8(&buf[filename_wsize], mode_wsize, mode, NULL);
|
|
||||||
return _wfopen((wchar_t*)&buf[0], (wchar_t*)&buf[filename_wsize]);
|
|
||||||
#else
|
|
||||||
return fopen(filename, mode);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load file content into memory
|
|
||||||
// Memory allocated with ImGui::MemAlloc(), must be freed by user using ImGui::MemFree()
|
|
||||||
void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, size_t* out_file_size, int padding_bytes)
|
|
||||||
{
|
|
||||||
IM_ASSERT(filename && file_open_mode);
|
|
||||||
if (out_file_size)
|
|
||||||
*out_file_size = 0;
|
|
||||||
|
|
||||||
FILE* f;
|
|
||||||
if ((f = ImFileOpen(filename, file_open_mode)) == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
long file_size_signed;
|
|
||||||
if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET))
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t file_size = (size_t)file_size_signed;
|
|
||||||
void* file_data = ImGui::MemAlloc(file_size + padding_bytes);
|
|
||||||
if (file_data == NULL)
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (fread(file_data, 1, file_size, f) != file_size)
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
ImGui::MemFree(file_data);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (padding_bytes > 0)
|
|
||||||
memset((void*)(((char*)file_data) + file_size), 0, (size_t)padding_bytes);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
if (out_file_size)
|
|
||||||
*out_file_size = file_size;
|
|
||||||
|
|
||||||
return file_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// COLOR FUNCTIONS
|
// [SECTION] MISC HELPER/UTILTIES (Color functions)
|
||||||
|
// Note: The Convert functions are early design which are not consistent with other API.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in)
|
ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in)
|
||||||
@ -1692,7 +1700,7 @@ ImU32 ImGui::GetColorU32(ImU32 col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiStorage
|
// [SECTION] ImGuiStorage
|
||||||
// Helper: Key->value storage
|
// Helper: Key->value storage
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -1841,7 +1849,7 @@ void ImGuiStorage::SetAllInt(int v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiTextFilter
|
// [SECTION] ImGuiTextFilter
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
||||||
@ -1945,7 +1953,7 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiTextBuffer
|
// [SECTION] ImGuiTextBuffer
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// On some platform vsnprintf() takes va_list by reference and modifies it.
|
// On some platform vsnprintf() takes va_list by reference and modifies it.
|
||||||
@ -1993,7 +2001,8 @@ void ImGuiTextBuffer::appendf(const char* fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiListClipper
|
// [SECTION] ImGuiListClipper
|
||||||
|
// This is currently not as flexible/powerful as it should be, needs some rework (see TODO)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)
|
static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)
|
||||||
@ -2077,8 +2086,8 @@ bool ImGuiListClipper::Step()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// RENDER HELPERS
|
// [SECTION] RENDER HELPERS
|
||||||
// Those [Internal] functions are a terrible mess - their signature and behavior will change.
|
// Those (internal) functions are currently quite a legacy mess - their signature and behavior will change.
|
||||||
// Also see imgui_draw.cpp for some more which have been reworked to not rely on ImGui:: state.
|
// Also see imgui_draw.cpp for some more which have been reworked to not rely on ImGui:: state.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -2297,8 +2306,7 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// MAIN CODE
|
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
||||||
// (this category is still too large and badly ordered, needs some tidying up)
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods
|
// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods
|
||||||
@ -2759,8 +2767,6 @@ float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)
|
|||||||
return ImMax(wrap_pos_x - pos.x, 1.0f);
|
return ImMax(wrap_pos_x - pos.x, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void* ImGui::MemAlloc(size_t size)
|
void* ImGui::MemAlloc(size_t size)
|
||||||
{
|
{
|
||||||
if (ImGuiContext* ctx = GImGui)
|
if (ImGuiContext* ctx = GImGui)
|
||||||
@ -6559,7 +6565,7 @@ void ImGui::Unindent(float indent_w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// TOOLTIPS
|
// [SECTION] TOOLTIPS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImGui::BeginTooltip()
|
void ImGui::BeginTooltip()
|
||||||
@ -6628,7 +6634,7 @@ void ImGui::SetTooltip(const char* fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// POPUPS
|
// [SECTION] POPUPS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool ImGui::IsPopupOpen(ImGuiID id)
|
bool ImGui::IsPopupOpen(ImGuiID id)
|
||||||
@ -7011,7 +7017,7 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// VIEWPORTS / PLATFORM WINDOWS
|
// [SECTION] VIEWPORTS / PLATFORM WINDOWS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImGuiViewport* ImGui::GetMainViewport()
|
ImGuiViewport* ImGui::GetMainViewport()
|
||||||
@ -7639,7 +7645,7 @@ void ImGui::DestroyPlatformWindows()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// NAVIGATION
|
// [SECTION] KEYBOARD/GAMEPAD NAVIGATION
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy)
|
ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy)
|
||||||
@ -8638,7 +8644,8 @@ void ImGui::NavUpdateWindowingList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// COLUMNS
|
// [SECTION] COLUMNS
|
||||||
|
// In the current version, Columns are very weak. Needs to be replaced with a more full-featured system.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImGui::NextColumn()
|
void ImGui::NextColumn()
|
||||||
@ -8960,7 +8967,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// DRAG AND DROP
|
// [SECTION] DRAG AND DROP
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImGui::ClearDragDrop()
|
void ImGui::ClearDragDrop()
|
||||||
@ -9247,7 +9254,7 @@ void ImGui::EndDragDropTarget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LOGGING
|
// [SECTION] LOGGING/CAPTURING
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Pass text data straight to log (without being displayed)
|
// Pass text data straight to log (without being displayed)
|
||||||
@ -9427,7 +9434,7 @@ void ImGui::LogButtons()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// SETTINGS
|
// [SECTION] SETTINGS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImGui::MarkIniSettingsDirty()
|
void ImGui::MarkIniSettingsDirty()
|
||||||
@ -9648,7 +9655,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// PLATFORM DEPENDENT HELPERS
|
// [SECTION] PLATFORM DEPENDENT HELPERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
|
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
|
||||||
@ -9735,7 +9742,7 @@ static void SetClipboardTextFn_DefaultImpl(void*, const char* text)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// METRICS/DEBUG WINDOW
|
// [SECTION] METRICS/DEBUG WINDOW
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void RenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb)
|
static void RenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb)
|
||||||
@ -9794,8 +9801,12 @@ void ImGui::ShowViewportThumbnails()
|
|||||||
|
|
||||||
void ImGui::ShowMetricsWindow(bool* p_open)
|
void ImGui::ShowMetricsWindow(bool* p_open)
|
||||||
{
|
{
|
||||||
if (ImGui::Begin("ImGui Metrics", p_open))
|
if (!ImGui::Begin("ImGui Metrics", p_open))
|
||||||
{
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static bool show_draw_cmd_clip_rects = true;
|
static bool show_draw_cmd_clip_rects = true;
|
||||||
static bool show_window_begin_order = false;
|
static bool show_window_begin_order = false;
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
@ -10023,7 +10034,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
overlay_draw_list->AddText(NULL, font_size, window->Pos, IM_COL32(255, 255, 255, 255), buf);
|
overlay_draw_list->AddText(NULL, font_size, window->Pos, IM_COL32(255, 255, 255, 255), buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,27 @@
|
|||||||
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant or used in threads.
|
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant or used in threads.
|
||||||
// This might be a pattern you occasionally want to use in your code, but most of the real data you would be editing is likely to be stored outside your functions.
|
// This might be a pattern you occasionally want to use in your code, but most of the real data you would be editing is likely to be stored outside your functions.
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Index of this file:
|
||||||
|
|
||||||
|
// [SECTION] Forward Declarations, Helpers
|
||||||
|
// [SECTION] Demo Window / ShowDemoWindow()
|
||||||
|
// [SECTION] Style Editor / ShowStyleEditor()
|
||||||
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
||||||
|
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
||||||
|
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
|
||||||
|
// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()
|
||||||
|
// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor()
|
||||||
|
// [SECTION] Example App: Long Text / ShowExampleAppLongText()
|
||||||
|
// [SECTION] Example App: Auto Resize / ShowExampleAppAutoResize()
|
||||||
|
// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()
|
||||||
|
// [SECTION] Example App: Simple Overlay / ShowExampleAppSimpleOverlay()
|
||||||
|
// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()
|
||||||
|
// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering()
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
@ -67,7 +88,7 @@
|
|||||||
#define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B))
|
#define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B))
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// DEMO CODE
|
// [SECTION] Forward Declarations, Helpers
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && defined(IMGUI_DISABLE_TEST_WINDOWS) && !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Obsolete name since 1.53, TEST->DEMO
|
#if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && defined(IMGUI_DISABLE_TEST_WINDOWS) && !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Obsolete name since 1.53, TEST->DEMO
|
||||||
@ -127,6 +148,10 @@ void ImGui::ShowUserGuide()
|
|||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Demo Window / ShowDemoWindow()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate most Dear ImGui features (this is big function!)
|
// Demonstrate most Dear ImGui features (this is big function!)
|
||||||
// You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature.
|
// You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature.
|
||||||
void ImGui::ShowDemoWindow(bool* p_open)
|
void ImGui::ShowDemoWindow(bool* p_open)
|
||||||
@ -2373,6 +2398,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Style Editor / ShowStyleEditor()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.
|
// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.
|
||||||
// Here we use the simplified Combo() api that packs items into a single literal string. Useful for quick combo boxes where the choices are known locally.
|
// Here we use the simplified Combo() api that packs items into a single literal string. Useful for quick combo boxes where the choices are known locally.
|
||||||
bool ImGui::ShowStyleSelector(const char* label)
|
bool ImGui::ShowStyleSelector(const char* label)
|
||||||
@ -2636,7 +2665,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: MAIN MENU BAR
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate creating a fullscreen menu bar and populating it.
|
// Demonstrate creating a fullscreen menu bar and populating it.
|
||||||
@ -2729,10 +2758,10 @@ static void ShowExampleMenuFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: CONSOLE
|
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrating creating a simple console window, with scrolling, filtering, completion and history.
|
// Demonstrate creating a simple console window, with scrolling, filtering, completion and history.
|
||||||
// For the console example, here we are using a more C++ like approach of declaring a class to hold the data and the functions.
|
// For the console example, here we are using a more C++ like approach of declaring a class to hold the data and the functions.
|
||||||
struct ExampleAppConsole
|
struct ExampleAppConsole
|
||||||
{
|
{
|
||||||
@ -3042,7 +3071,7 @@ static void ShowExampleAppConsole(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: LOG
|
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Usage:
|
// Usage:
|
||||||
@ -3132,7 +3161,7 @@ static void ShowExampleAppLog(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: SIMPLE LAYOUT
|
// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate create a window with multiple child windows.
|
// Demonstrate create a window with multiple child windows.
|
||||||
@ -3180,7 +3209,7 @@ static void ShowExampleAppLayout(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: PROPERTY EDITOR
|
// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate create a simple property editor.
|
// Demonstrate create a simple property editor.
|
||||||
@ -3253,7 +3282,7 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: LONG TEXT
|
// [SECTION] Example App: Long Text / ShowExampleAppLongText()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate/test rendering huge amount of text, and the incidence of clipping.
|
// Demonstrate/test rendering huge amount of text, and the incidence of clipping.
|
||||||
@ -3311,7 +3340,7 @@ static void ShowExampleAppLongText(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: AUTO RESIZE
|
// [SECTION] Example App: Auto Resize / ShowExampleAppAutoResize()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate creating a window which gets auto-resized according to its content.
|
// Demonstrate creating a window which gets auto-resized according to its content.
|
||||||
@ -3332,7 +3361,7 @@ static void ShowExampleAppAutoResize(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: CONSTRAINED RESIZE
|
// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate creating a window with custom resize constraints.
|
// Demonstrate creating a window with custom resize constraints.
|
||||||
@ -3383,7 +3412,7 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: SIMPLE OVERLAY
|
// [SECTION] Example App: Simple Overlay / ShowExampleAppSimpleOverlay()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate creating a simple static window with no decoration + a context-menu to choose which corner of the screen to use.
|
// Demonstrate creating a simple static window with no decoration + a context-menu to choose which corner of the screen to use.
|
||||||
@ -3424,7 +3453,7 @@ static void ShowExampleAppSimpleOverlay(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: WINDOW TITLES
|
// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
||||||
@ -3455,7 +3484,7 @@ static void ShowExampleAppWindowTitles(bool*)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// EXAMPLE APP CODE: CUSTOM RENDERING
|
// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate using the low-level ImDrawList to draw custom shapes.
|
// Demonstrate using the low-level ImDrawList to draw custom shapes.
|
||||||
|
@ -4,16 +4,19 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Index of this file:
|
Index of this file:
|
||||||
- Cruft for stb_truetype/stb_rectpack implementation
|
|
||||||
- Style functions (default style)
|
// [SECTION] STB libraries implementation
|
||||||
- ImDrawList
|
// [SECTION] Style functions
|
||||||
- ImDrawData
|
// [SECTION] ImDrawList
|
||||||
- ShadeVertsXXX helpers functions
|
// [SECTION] ImDrawData
|
||||||
- ImFontConfig
|
// [SECTION] Helpers ShadeVertsXXX functions
|
||||||
- ImFontAtlas
|
// [SECTION] ImFontConfig
|
||||||
- ImFont
|
// [SECTION] ImFontAtlas
|
||||||
- Internal Render Helpers
|
// [SECTION] ImFontAtlas glyph ranges helpers + GlyphRangesBuilder
|
||||||
- Default font data
|
// [SECTION] ImFont
|
||||||
|
// [SECTION] Internal Render Helpers
|
||||||
|
// [SECTION] Decompression code
|
||||||
|
// [SECTION] Default font data (ProggyClean.ttf)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -72,7 +75,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// STB libraries implementation
|
// [SECTION] STB libraries implementation
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// Compile time options:
|
// Compile time options:
|
||||||
@ -161,7 +164,7 @@ using namespace IMGUI_STB_NAMESPACE;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Style functions
|
// [SECTION] Style functions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
||||||
@ -316,7 +319,7 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImDrawListData
|
// ImDrawList
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImDrawListSharedData::ImDrawListSharedData()
|
ImDrawListSharedData::ImDrawListSharedData()
|
||||||
@ -334,10 +337,6 @@ ImDrawListSharedData::ImDrawListSharedData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// ImDrawList
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ImDrawList::Clear()
|
void ImDrawList::Clear()
|
||||||
{
|
{
|
||||||
CmdBuffer.resize(0);
|
CmdBuffer.resize(0);
|
||||||
@ -1227,7 +1226,7 @@ void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImDrawData
|
// [SECTION] ImDrawData
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
|
// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
|
||||||
@ -1264,7 +1263,7 @@ void ImDrawData::ScaleClipRects(const ImVec2& scale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Shade functions
|
// [SECTION] Helpers ShadeVertsXXX functions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Generic linear color gradient, write to RGB fields, leave A untouched.
|
// Generic linear color gradient, write to RGB fields, leave A untouched.
|
||||||
@ -1311,7 +1310,7 @@ void ImGui::ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int ve
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImFontConfig
|
// [SECTION] ImFontConfig
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImFontConfig::ImFontConfig()
|
ImFontConfig::ImFontConfig()
|
||||||
@ -1337,7 +1336,7 @@ ImFontConfig::ImFontConfig()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImFontAtlas
|
// [SECTION] ImFontAtlas
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// A work of art lies ahead! (. = white layer, X = black layer, others are blank)
|
// A work of art lies ahead! (. = white layer, X = black layer, others are blank)
|
||||||
@ -2074,6 +2073,10 @@ static void UnpackAccumulativeOffsetsIntoRanges(int base_codepoint, const short*
|
|||||||
out_ranges[0] = 0;
|
out_ranges[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// [SECTION] ImFontAtlas glyph ranges helpers + GlyphRangesBuilder
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
const ImWchar* ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon()
|
const ImWchar* ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon()
|
||||||
{
|
{
|
||||||
// Store 2500 regularly used characters for Simplified Chinese.
|
// Store 2500 regularly used characters for Simplified Chinese.
|
||||||
@ -2223,10 +2226,6 @@ const ImWchar* ImFontAtlas::GetGlyphRangesThai()
|
|||||||
return &ranges[0];
|
return &ranges[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// ImFontAtlas::GlyphRangesBuilder
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ImFontAtlas::GlyphRangesBuilder::AddText(const char* text, const char* text_end)
|
void ImFontAtlas::GlyphRangesBuilder::AddText(const char* text, const char* text_end)
|
||||||
{
|
{
|
||||||
while (text_end ? (text < text_end) : *text)
|
while (text_end ? (text < text_end) : *text)
|
||||||
@ -2262,7 +2261,7 @@ void ImFontAtlas::GlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImFont
|
// [SECTION] ImFont
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImFont::ImFont()
|
ImFont::ImFont()
|
||||||
@ -2813,12 +2812,12 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Internals Render Helpers
|
// [SECTION] Internal Render Helpers
|
||||||
// (progressively moved from imgui.cpp to here when they are redesigned to stop accessing ImGui global state)
|
// (progressively moved from imgui.cpp to here when they are redesigned to stop accessing ImGui global state)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// RenderMouseCursor()
|
// - RenderMouseCursor()
|
||||||
// RenderArrowPointingAt()
|
// - RenderArrowPointingAt()
|
||||||
// RenderRectFilledRangeH()
|
// - RenderRectFilledRangeH()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImGui::RenderMouseCursor(ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor)
|
void ImGui::RenderMouseCursor(ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor)
|
||||||
@ -2938,8 +2937,9 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im
|
|||||||
draw_list->PathFillConvex(col);
|
draw_list->PathFillConvex(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// DEFAULT FONT DATA
|
// [SECTION] Decompression code
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Compressed with stb_compress() then converted to a C array and encoded as base85.
|
// Compressed with stb_compress() then converted to a C array and encoded as base85.
|
||||||
// Use the program in misc/fonts/binary_to_compressed_c.cpp to create the array from a TTF file.
|
// Use the program in misc/fonts/binary_to_compressed_c.cpp to create the array from a TTF file.
|
||||||
@ -3058,6 +3058,8 @@ static unsigned int stb_decompress(unsigned char *output, const unsigned char *i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Default font data (ProggyClean.ttf)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ProggyClean.ttf
|
// ProggyClean.ttf
|
||||||
// Copyright (c) 2004, 2005 Tristan Grimmer
|
// Copyright (c) 2004, 2005 Tristan Grimmer
|
||||||
|
@ -4,22 +4,24 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Index of this file:
|
Index of this file:
|
||||||
- Widgets: Text, etc.
|
|
||||||
- Widgets: Button, Image, Checkbox, RadioButton, ProgressBar, Bullet, etc.
|
// [SECTION] Forward Declarations
|
||||||
- Widgets: Low-level Layout helpers: Spacing, Dummy, NewLine, Separator, etc.
|
// [SECTION] Widgets: Text, etc.
|
||||||
- Widgets: ComboBox
|
// [SECTION] Widgets: Main (Button, Image, Checkbox, RadioButton, ProgressBar, Bullet, etc.)
|
||||||
- Data Type and Data Formatting Helpers
|
// [SECTION] Widgets: Low-level Layout helpers (Spacing, Dummy, NewLine, Separator, etc.)
|
||||||
- Widgets: DragScalar, DragFloat, DragInt, etc.
|
// [SECTION] Widgets: ComboBox
|
||||||
- Widgets: SliderScalar, SliderFloat, SliderInt, etc.
|
// [SECTION] Data Type and Data Formatting Helpers
|
||||||
- Widgets: InputScalar, InputFloat, InputInt, etc.
|
// [SECTION] Widgets: DragScalar, DragFloat, DragInt, etc.
|
||||||
- Widgets: InputText, InputTextMultiline
|
// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.
|
||||||
- Widgets: ColorEdit, ColorPicker, ColorButton, etc.
|
// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc.
|
||||||
- Widgets: TreeNode, TreePush, TreePop, etc.
|
// [SECTION] Widgets: InputText, InputTextMultiline
|
||||||
- Widgets: Selectable
|
// [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc.
|
||||||
- Widgets: ListBox
|
// [SECTION] Widgets: TreeNode, CollapsingHeader, etc.
|
||||||
- Widgets: PlotLines, PlotHistogram
|
// [SECTION] Widgets: Selectable
|
||||||
- Widgets: Value
|
// [SECTION] Widgets: ListBox
|
||||||
- Widgets: MenuItem, BeginMenu, EndMenu, etc.
|
// [SECTION] Widgets: PlotLines, PlotHistogram
|
||||||
|
// [SECTION] Widgets: Value helpers
|
||||||
|
// [SECTION] Widgets: MenuItem, BeginMenu, EndMenu, etc.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -81,7 +83,7 @@ static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Forward Declarations
|
// [SECTION] Forward Declarations
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// Data Type helpers
|
// Data Type helpers
|
||||||
@ -95,7 +97,8 @@ static int InputTextCalcTextLenAndLineCount(const char* text_begin,
|
|||||||
static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Text
|
// [SECTION] Widgets: Text, etc.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - TextUnformatted()
|
// - TextUnformatted()
|
||||||
// - Text()
|
// - Text()
|
||||||
// - TextV()
|
// - TextV()
|
||||||
@ -350,7 +353,8 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Main
|
// [SECTION] Widgets: Main
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - ButtonBehavior() [Internal]
|
// - ButtonBehavior() [Internal]
|
||||||
// - Button()
|
// - Button()
|
||||||
// - SmallButton()
|
// - SmallButton()
|
||||||
@ -1053,7 +1057,8 @@ void ImGui::Bullet()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Low-level Layout helpers
|
// [SECTION] Widgets: Low-level Layout helpers
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - Spacing()
|
// - Spacing()
|
||||||
// - Dummy()
|
// - Dummy()
|
||||||
// - NewLine()
|
// - NewLine()
|
||||||
@ -1234,7 +1239,8 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Combo Box
|
// [SECTION] Widgets: Combo Box
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - BeginCombo()
|
// - BeginCombo()
|
||||||
// - EndCombo()
|
// - EndCombo()
|
||||||
// - Combo()
|
// - Combo()
|
||||||
@ -1448,7 +1454,8 @@ bool ImGui::Combo(const char* label, int* current_item, const char* items_separa
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Data Type and Data Formatting Helpers [Internal]
|
// [SECTION] Data Type and Data Formatting Helpers [Internal]
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - PatchFormatStringFloatToInt()
|
// - PatchFormatStringFloatToInt()
|
||||||
// - DataTypeFormatString()
|
// - DataTypeFormatString()
|
||||||
// - DataTypeApplyOp()
|
// - DataTypeApplyOp()
|
||||||
@ -1677,7 +1684,8 @@ TYPE ImGui::RoundScalarWithFormatT(const char* format, ImGuiDataType data_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Drags
|
// [SECTION] Widgets: DragScalar, DragFloat, DragInt, etc.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - DragBehaviorT<>() [Internal]
|
// - DragBehaviorT<>() [Internal]
|
||||||
// - DragBehavior() [Internal]
|
// - DragBehavior() [Internal]
|
||||||
// - DragScalar()
|
// - DragScalar()
|
||||||
@ -2014,7 +2022,8 @@ bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Sliders
|
// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - SliderBehaviorT<>() [Internal]
|
// - SliderBehaviorT<>() [Internal]
|
||||||
// - SliderBehavior() [Internal]
|
// - SliderBehavior() [Internal]
|
||||||
// - SliderScalar()
|
// - SliderScalar()
|
||||||
@ -2478,11 +2487,12 @@ bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Inputs (_excepted InputText_)
|
// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc.
|
||||||
// - ImParseFormatFindStart()
|
//-------------------------------------------------------------------------
|
||||||
// - ImParseFormatFindEnd()
|
// - ImParseFormatFindStart() [Internal]
|
||||||
// - ImParseFormatTrimDecorations()
|
// - ImParseFormatFindEnd() [Internal]
|
||||||
// - ImParseFormatPrecision()
|
// - ImParseFormatTrimDecorations() [Internal]
|
||||||
|
// - ImParseFormatPrecision() [Internal]
|
||||||
// - InputScalarAsWidgetReplacement() [Internal]
|
// - InputScalarAsWidgetReplacement() [Internal]
|
||||||
// - InputScalar()
|
// - InputScalar()
|
||||||
// - InputScalarN()
|
// - InputScalarN()
|
||||||
@ -2774,7 +2784,8 @@ bool ImGui::InputDouble(const char* label, double* v, double step, double step_f
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: InputText
|
// [SECTION] Widgets: InputText, InputTextMultiline
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - InputText()
|
// - InputText()
|
||||||
// - InputTextMultiline()
|
// - InputTextMultiline()
|
||||||
// - InputTextEx() [Internal]
|
// - InputTextEx() [Internal]
|
||||||
@ -3751,7 +3762,8 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Color Editor / Picker
|
// [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - ColorEdit3()
|
// - ColorEdit3()
|
||||||
// - ColorEdit4()
|
// - ColorEdit4()
|
||||||
// - ColorPicker3()
|
// - ColorPicker3()
|
||||||
@ -4551,7 +4563,8 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Trees
|
// [SECTION] Widgets: TreeNode, CollapsingHeader, etc.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - TreeNode()
|
// - TreeNode()
|
||||||
// - TreeNodeV()
|
// - TreeNodeV()
|
||||||
// - TreeNodeEx()
|
// - TreeNodeEx()
|
||||||
@ -4944,7 +4957,8 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Selectables
|
// [SECTION] Widgets: Selectable
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - Selectable()
|
// - Selectable()
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -5052,7 +5066,8 @@ bool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: List Box
|
// [SECTION] Widgets: ListBox
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - ListBox()
|
// - ListBox()
|
||||||
// - ListBoxHeader()
|
// - ListBoxHeader()
|
||||||
// - ListBoxFooter()
|
// - ListBoxFooter()
|
||||||
@ -5161,7 +5176,8 @@ bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(v
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Data Plotting
|
// [SECTION] Widgets: PlotLines, PlotHistogram
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - PlotEx() [Internal]
|
// - PlotEx() [Internal]
|
||||||
// - PlotLines()
|
// - PlotLines()
|
||||||
// - PlotHistogram()
|
// - PlotHistogram()
|
||||||
@ -5315,7 +5331,9 @@ void ImGui::PlotHistogram(const char* label, float (*values_getter)(void* data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Value() helpers
|
// [SECTION] Widgets: Value helpers
|
||||||
|
// Those is not very useful, legacy API.
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
// - Value()
|
// - Value()
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -5349,8 +5367,9 @@ void ImGui::Value(const char* prefix, float v, const char* float_format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// WIDGETS: Menus
|
// [SECTION] MenuItem, BeginMenu, EndMenu, etc.
|
||||||
// - ImGuiMenuColumns
|
//-------------------------------------------------------------------------
|
||||||
|
// - ImGuiMenuColumns [Internal]
|
||||||
// - BeginMainMenuBar()
|
// - BeginMainMenuBar()
|
||||||
// - EndMainMenuBar()
|
// - EndMainMenuBar()
|
||||||
// - BeginMenuBar()
|
// - BeginMenuBar()
|
||||||
|
Loading…
Reference in New Issue
Block a user