mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-30 18:29:04 +08:00
Documentation tweaks, comments
This commit is contained in:
parent
8149408408
commit
0dc18a6ca6
@ -119,7 +119,7 @@ Breaking Changes:
|
|||||||
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, not used by core, and honored by some binding ahead of merging the Nav branch).
|
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, not used by core, and honored by some binding ahead of merging the Nav branch).
|
||||||
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
||||||
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
||||||
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.
|
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it should be easy to replicate on your side (you can find the code in 1.53).
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
28
imgui.cpp
28
imgui.cpp
@ -216,7 +216,7 @@
|
|||||||
- The examples/ folders contains many functional implementation of the pseudo-code above.
|
- The examples/ folders contains many functional implementation of the pseudo-code above.
|
||||||
- When calling NewFrame(), the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags are updated.
|
- When calling NewFrame(), the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags are updated.
|
||||||
They tell you if ImGui intends to use your inputs. When a flag is set you want to hide the corresponding inputs from the rest of your application.
|
They tell you if ImGui intends to use your inputs. When a flag is set you want to hide the corresponding inputs from the rest of your application.
|
||||||
However, in both cases you need to pass on the inputs to imgui. Read the FAQ below for more information about those flags.
|
In both cases you need to pass on the inputs to imgui. Read the FAQ below for more information about those flags.
|
||||||
- Please read the FAQ above. Amusingly, it is called a FAQ because people frequently have the same issues!
|
- Please read the FAQ above. Amusingly, it is called a FAQ because people frequently have the same issues!
|
||||||
|
|
||||||
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS [BETA]
|
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS [BETA]
|
||||||
@ -258,11 +258,12 @@
|
|||||||
API BREAKING CHANGES
|
API BREAKING CHANGES
|
||||||
====================
|
====================
|
||||||
|
|
||||||
Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix.
|
Occasionally introducing changes that are breaking the API. We try to make the breakage minor and easy to fix.
|
||||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
Below is a change-log of API breaking changes only. If you are using one of the functions listed, expect to have to fix some code.
|
||||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
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.
|
||||||
|
|
||||||
- 2018/05/03 (1.61) - DragInt: The default compile-time format string has been changed from "%.0f" to "%d", we are not using integers internally any more.
|
- 2018/05/03 (1.61) - DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", we are not using integers internally any more.
|
||||||
If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
||||||
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.
|
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code.
|
||||||
If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to help you find them.
|
If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to help you find them.
|
||||||
@ -331,7 +332,7 @@
|
|||||||
- 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
- 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
||||||
- 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.
|
- 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.
|
||||||
If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you.
|
If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you.
|
||||||
However if your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.
|
If your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.
|
||||||
This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color.
|
This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color.
|
||||||
ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col)
|
ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col)
|
||||||
{
|
{
|
||||||
@ -769,6 +770,7 @@ static void UpdateMouseInputs();
|
|||||||
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
||||||
static void FocusFrontMostActiveWindow(ImGuiWindow* ignore_window);
|
static void FocusFrontMostActiveWindow(ImGuiWindow* ignore_window);
|
||||||
|
|
||||||
|
// Template widget behaviors
|
||||||
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
||||||
static bool DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power);
|
static bool DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power);
|
||||||
|
|
||||||
@ -2346,7 +2348,7 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
|
|||||||
// are found, so it only augments the graph produced by the above method using extra links. (important, since it doesn't guarantee strong connectedness)
|
// are found, so it only augments the graph produced by the above method using extra links. (important, since it doesn't guarantee strong connectedness)
|
||||||
// This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too.
|
// This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too.
|
||||||
// 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward.
|
// 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward.
|
||||||
// Disabling it may however lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option?
|
// Disabling it may lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option?
|
||||||
if (result->DistBox == FLT_MAX && dist_axial < result->DistAxial) // Check axial match
|
if (result->DistBox == FLT_MAX && dist_axial < result->DistAxial) // Check axial match
|
||||||
if (g.NavLayer == 1 && !(g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu))
|
if (g.NavLayer == 1 && !(g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu))
|
||||||
if ((g.NavMoveDir == ImGuiDir_Left && dax < 0.0f) || (g.NavMoveDir == ImGuiDir_Right && dax > 0.0f) || (g.NavMoveDir == ImGuiDir_Up && day < 0.0f) || (g.NavMoveDir == ImGuiDir_Down && day > 0.0f))
|
if ((g.NavMoveDir == ImGuiDir_Left && dax < 0.0f) || (g.NavMoveDir == ImGuiDir_Right && dax > 0.0f) || (g.NavMoveDir == ImGuiDir_Up && day < 0.0f) || (g.NavMoveDir == ImGuiDir_Down && day > 0.0f))
|
||||||
@ -5123,7 +5125,7 @@ bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)
|
|||||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||||
{
|
{
|
||||||
ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
||||||
IM_ASSERT(id != 0); // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
||||||
OpenPopupEx(id);
|
OpenPopupEx(id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -5137,7 +5139,7 @@ bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)
|
|||||||
{
|
{
|
||||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||||
ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
||||||
IM_ASSERT(id != 0); // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
||||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||||
OpenPopupEx(id);
|
OpenPopupEx(id);
|
||||||
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings);
|
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings);
|
||||||
@ -8802,6 +8804,7 @@ static inline float SliderBehaviorCalcRatioFromValue(ImGuiDataType data_type, TY
|
|||||||
return (float)((FLOATTYPE)(v_clamped - v_min) / (FLOATTYPE)(v_max - v_min));
|
return (float)((FLOATTYPE)(v_clamped - v_min) / (FLOATTYPE)(v_max - v_min));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Move some of the code into SliderBehavior(). Current responsability is larger than what the equivalent DragBehaviorT<> does, we also do some rendering, etc.
|
||||||
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
||||||
static bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, float power, ImGuiSliderFlags flags)
|
static bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, float power, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
@ -9225,6 +9228,7 @@ bool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const
|
|||||||
return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format);
|
return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is called by DragBehavior() when the widget is active (held by mouse or being manipulated with Nav controls)
|
||||||
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
||||||
static bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power)
|
static bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power)
|
||||||
{
|
{
|
||||||
@ -11035,7 +11039,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|||||||
if (*current_item >= 0 && *current_item < items_count)
|
if (*current_item >= 0 && *current_item < items_count)
|
||||||
items_getter(data, *current_item, &preview_text);
|
items_getter(data, *current_item, &preview_text);
|
||||||
|
|
||||||
// The old Combo() API exposed "popup_max_height_in_items", however the new more general BeginCombo() API doesn't, so we emulate it here.
|
// The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't, so we emulate it here.
|
||||||
if (popup_max_height_in_items != -1 && !g.NextWindowData.SizeConstraintCond)
|
if (popup_max_height_in_items != -1 && !g.NextWindowData.SizeConstraintCond)
|
||||||
{
|
{
|
||||||
float popup_max_height = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items);
|
float popup_max_height = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items);
|
||||||
@ -11247,7 +11251,7 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
|||||||
bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)
|
bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)
|
||||||
{
|
{
|
||||||
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
|
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
|
||||||
// However we don't add +0.40f if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.
|
// We don't add +0.40f if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.
|
||||||
// I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.
|
// I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.
|
||||||
if (height_in_items < 0)
|
if (height_in_items < 0)
|
||||||
height_in_items = ImMin(items_count, 7);
|
height_in_items = ImMin(items_count, 7);
|
||||||
@ -11603,7 +11607,7 @@ void ImGui::EndMenu()
|
|||||||
{
|
{
|
||||||
// Nav: When a left move request _within our child menu_ failed, close the menu.
|
// Nav: When a left move request _within our child menu_ failed, close the menu.
|
||||||
// A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
|
// A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
|
||||||
// However it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
// However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
||||||
|
4
imgui.h
4
imgui.h
@ -177,7 +177,7 @@ namespace ImGui
|
|||||||
// Windows
|
// Windows
|
||||||
// (Begin = push window to the stack and start appending to it. End = pop window from the stack. You may append multiple times to the same window during the same frame)
|
// (Begin = push window to the stack and start appending to it. End = pop window from the stack. You may append multiple times to the same window during the same frame)
|
||||||
// Begin()/BeginChild() return false to indicate the window being collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
// Begin()/BeginChild() return false to indicate the window being collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
||||||
// However you need to always call a matching End()/EndChild() for a Begin()/BeginChild() call, regardless of its return value (this is due to legacy reason and is inconsistent with BeginMenu/EndMenu, BeginPopup/EndPopup and other functions where the End call should only be called if the corresponding Begin function returned true.)
|
// You need to always call a matching End()/EndChild() for a Begin()/BeginChild() call, regardless of its return value (this is due to legacy reason and is inconsistent with BeginMenu/EndMenu, BeginPopup/EndPopup and other functions where the End call should only be called if the corresponding Begin function returned true.)
|
||||||
// Passing 'bool* p_open != NULL' shows a close widget in the upper-right corner of the window, which when clicking will set the boolean to false.
|
// Passing 'bool* p_open != NULL' shows a close widget in the upper-right corner of the window, which when clicking will set the boolean to false.
|
||||||
// Use child windows to introduce independent scrolling/clipping regions within a host window. Child windows can embed their own child.
|
// Use child windows to introduce independent scrolling/clipping regions within a host window. Child windows can embed their own child.
|
||||||
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
|
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
|
||||||
@ -1577,7 +1577,7 @@ enum ImDrawListFlags_
|
|||||||
// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
|
// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
|
||||||
// Each ImGui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to access the current window draw list and draw custom primitives.
|
// Each ImGui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to access the current window draw list and draw custom primitives.
|
||||||
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
|
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
|
||||||
// All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), however you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well)
|
// All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), but you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well)
|
||||||
// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.
|
// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.
|
||||||
struct ImDrawList
|
struct ImDrawList
|
||||||
{
|
{
|
||||||
|
@ -549,16 +549,18 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (ImGui::TreeNode("UTF-8 Text"))
|
if (ImGui::TreeNode("UTF-8 Text"))
|
||||||
{
|
{
|
||||||
// UTF-8 test with Japanese characters
|
// UTF-8 test with Japanese characters
|
||||||
// (needs a suitable font, try Arial Unicode or M+ fonts http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html)
|
// (Needs a suitable font, try Noto, or Arial Unicode, or M+ fonts. Read misc/fonts/README.txt for details.)
|
||||||
// - From C++11 you can use the u8"my text" syntax to encode literal strings as UTF-8
|
// - From C++11 you can use the u8"my text" syntax to encode literal strings as UTF-8
|
||||||
// - For earlier compiler, you may be able to encode your sources as UTF-8 (e.g. Visual Studio save your file as 'UTF-8 without signature')
|
// - For earlier compiler, you may be able to encode your sources as UTF-8 (e.g. Visual Studio save your file as 'UTF-8 without signature')
|
||||||
// - HOWEVER, FOR THIS DEMO FILE, BECAUSE WE WANT TO SUPPORT COMPILER, WE ARE *NOT* INCLUDING RAW UTF-8 CHARACTERS IN THIS SOURCE FILE.
|
// - FOR THIS DEMO FILE ONLY, BECAUSE WE WANT TO SUPPORT OLD COMPILERS, WE ARE *NOT* INCLUDING RAW UTF-8 CHARACTERS IN THIS SOURCE FILE.
|
||||||
// Instead we are encoding a few string with hexadecimal constants. Don't do this in your application!
|
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
||||||
|
// Please use u8"text in any language" in your application!
|
||||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
||||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->LoadFromFileTTF() manually to load extra character ranges.");
|
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->LoadFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
||||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)");
|
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||||
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
||||||
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"; // "nihongo"
|
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
||||||
|
//static char buf[32] = u8"NIHONGO"; // <- this is how you would write it with C++11, using real kanjis
|
||||||
ImGui::InputText("UTF-8 input", buf, IM_ARRAYSIZE(buf));
|
ImGui::InputText("UTF-8 input", buf, IM_ARRAYSIZE(buf));
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@ -2593,7 +2595,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
ImGui::Text("Left-click and drag to add lines,\nRight-click to undo");
|
ImGui::Text("Left-click and drag to add lines,\nRight-click to undo");
|
||||||
|
|
||||||
// Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
|
// Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
|
||||||
// However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
|
// But you can also draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
|
||||||
// If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
|
// If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
|
||||||
ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates!
|
ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates!
|
||||||
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
|
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
|
||||||
@ -2745,7 +2747,7 @@ struct ExampleAppConsole
|
|||||||
// ImGuiListClipper clipper(Items.Size);
|
// ImGuiListClipper clipper(Items.Size);
|
||||||
// while (clipper.Step())
|
// while (clipper.Step())
|
||||||
// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||||
// However take note that you can not use this code as is if a filter is active because it breaks the 'cheap random-access' property. We would need random-access on the post-filtered list.
|
// However, note that you can not use this code as is if a filter is active because it breaks the 'cheap random-access' property. We would need random-access on the post-filtered list.
|
||||||
// A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices that passed the filtering test, recomputing this array when user changes the filter,
|
// A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices that passed the filtering test, recomputing this array when user changes the filter,
|
||||||
// and appending newly elements as they are inserted. This is left as a task to the user until we can manage to improve this example code!
|
// and appending newly elements as they are inserted. This is left as a task to the user until we can manage to improve this example code!
|
||||||
// If your items are of variable size you may want to implement code similar to what ImGuiListClipper does. Or split your data into fixed height items to allow random-seeking into your list.
|
// If your items are of variable size you may want to implement code similar to what ImGuiListClipper does. Or split your data into fixed height items to allow random-seeking into your list.
|
||||||
|
Loading…
Reference in New Issue
Block a user