mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Merge branch 'master' into viewport + added viewport ConfigFlags/BackendFlags
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
commit
af27ec296b
@ -32,9 +32,16 @@ HOW TO UPDATE?
|
||||
VERSION 1.65 (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
- Renamed io.OptCursorBlink/io.ConfigCursorBlink to io.ConfigInputTextCursorBlink. (#1427)
|
||||
|
||||
Other Changes:
|
||||
|
||||
- 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)
|
||||
- Fixed a build issue with non-Cygwin GCC under Windows.
|
||||
- Demo: Added a "Configuration" block to make io.ConfigFlags/io.BackendFlags more prominent.
|
||||
- Examples: OpenGL3: Fixed error condition when using the GLAD loader. (#2059, #2002). [@jiri]
|
||||
|
||||
|
||||
@ -75,7 +82,7 @@ Breaking Changes:
|
||||
- InputText: Removed ImGuiTextEditCallbackData::ReadOnly since it is a duplication of (ImGuiTextEditCallbackData::Flags & ImGuiInputTextFlags_ReadOnly).
|
||||
- Renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit() for consistency with new IsItemEdited() API.
|
||||
Kept redirection function (will obsolete soonish as IsItemDeactivatedAfterChange() is very recent).
|
||||
- Renamed io.OptCursorBlink to io.ConfigCursorBlink, io.OptMacOSXBehaviors to io.ConfigMacOSXBehaviors for consistency. (#1427, #473)
|
||||
- Renamed io.OptCursorBlink to io.ConfigCursorBlink [-> io.ConfigInputTextCursorBlink in 1.65], io.OptMacOSXBehaviors to io.ConfigMacOSXBehaviors for consistency. (#1427, #473)
|
||||
- Removed obsolete redirection functions: CollapsingHeader() variation with 2 bools - marked obsolete in v1.49, May 2016.
|
||||
|
||||
Other Changes:
|
||||
|
17
imgui.cpp
17
imgui.cpp
@ -28,7 +28,7 @@ DOCUMENTATION
|
||||
- Read first
|
||||
- How to update to a newer version of Dear ImGui
|
||||
- Getting started with integrating Dear ImGui in your code/engine
|
||||
- Using gamepad/keyboard navigation controls [BETA]
|
||||
- Using gamepad/keyboard navigation controls
|
||||
- API BREAKING CHANGES (read me when you update!)
|
||||
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
|
||||
- How can I tell whether to dispatch mouse/keyboard to imgui or to my application?
|
||||
@ -155,7 +155,7 @@ CODE
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
// TODO: Set optional io.ConfigFlags values, e.g. 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard' to enable keyboard controls
|
||||
// TODO: Fill optional settings of the io structure later.
|
||||
// TODO: Fill optional fields of the io structure later.
|
||||
// TODO: Load TTF/OTF fonts if you don't want to use the default font.
|
||||
|
||||
// Initialize helper Platform and Renderer bindings (here we are using imgui_impl_win32 and imgui_impl_dx11)
|
||||
@ -191,7 +191,7 @@ CODE
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
// TODO: Set optional io.ConfigFlags values, e.g. 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard' to enable keyboard controls
|
||||
// TODO: Fill optional settings of the io structure later.
|
||||
// TODO: Fill optional fields of the io structure later.
|
||||
// TODO: Load TTF/OTF fonts if you don't want to use the default font.
|
||||
|
||||
// Build and load the texture atlas into a texture
|
||||
@ -290,9 +290,10 @@ CODE
|
||||
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!
|
||||
|
||||
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS [BETA]
|
||||
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS
|
||||
|
||||
- The gamepad/keyboard navigation is in Beta. Ask questions and report issues at https://github.com/ocornut/imgui/issues/787
|
||||
- The gamepad/keyboard navigation is fairly functional and keeps being improved.
|
||||
- You can ask questions and report issues at https://github.com/ocornut/imgui/issues/787
|
||||
- The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||
- Gamepad:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
||||
@ -345,6 +346,7 @@ CODE
|
||||
- 2018/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
||||
- 2018/XX/XX (1.XX) - removed io.DisplayVisibleMin, io.DisplayVisibleMax settings (it was used to clip within the DisplayMin..DisplayMax range, I don't know of anyone using it)
|
||||
|
||||
- 2018/09/05 (1.65) - renamed io.OptCursorBlink/io.ConfigCursorBlink to io.ConfigInputTextCursorBlink. (#1427)
|
||||
- 2018/08/31 (1.64) - added imgui_widgets.cpp file, extracted and moved widgets code out of imgui.cpp into imgui_widgets.cpp. Re-ordered some of the code remaining in imgui.cpp.
|
||||
NONE OF THE FUNCTIONS HAVE CHANGED. THE CODE IS SEMANTICALLY 100% IDENTICAL, BUT _EVERY_ FUNCTION HAS BEEN MOVED.
|
||||
Because of this, any local modifications to imgui.cpp will likely conflict when you update. Read docs/CHANGELOG.txt for suggestions.
|
||||
@ -352,7 +354,7 @@ CODE
|
||||
- 2018/08/21 (1.63) - renamed ImGuiTextEditCallback to ImGuiInputTextCallback, ImGuiTextEditCallbackData to ImGuiInputTextCallbackData for consistency. Kept redirection types (will obsolete).
|
||||
- 2018/08/21 (1.63) - removed ImGuiInputTextCallbackData::ReadOnly since it is a duplication of (ImGuiInputTextCallbackData::Flags & ImGuiInputTextFlags_ReadOnly).
|
||||
- 2018/08/01 (1.63) - removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor of a global io.ConfigResizeWindowsFromEdges to enable the feature.
|
||||
- 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink, io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency.
|
||||
- 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink [-> io.ConfigInputTextCursorBlink in 1.65], io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency.
|
||||
- 2018/07/22 (1.63) - changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time.
|
||||
- 2018/07/08 (1.63) - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete).
|
||||
- 2018/06/06 (1.62) - renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set.
|
||||
@ -932,6 +934,7 @@ static ImVec2 NavCalcPreferredRefPos();
|
||||
static void NavSaveLastChildNavWindow(ImGuiWindow* nav_window);
|
||||
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
||||
|
||||
// Misc
|
||||
static void UpdateMouseInputs();
|
||||
static void UpdateMouseWheel();
|
||||
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
|
||||
@ -1076,7 +1079,7 @@ ImGuiIO::ImGuiIO()
|
||||
#else
|
||||
ConfigMacOSXBehaviors = false;
|
||||
#endif
|
||||
ConfigCursorBlink = true;
|
||||
ConfigInputTextCursorBlink = true;
|
||||
ConfigResizeWindowsFromEdges = false;
|
||||
|
||||
// Settings (User Functions)
|
||||
|
16
imgui.h
16
imgui.h
@ -832,7 +832,7 @@ enum ImGuiKey_
|
||||
ImGuiKey_COUNT
|
||||
};
|
||||
|
||||
// [BETA] Gamepad/Keyboard directional navigation
|
||||
// Gamepad/Keyboard directional navigation
|
||||
// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
||||
// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Back-end: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().
|
||||
// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://goo.gl/9LgVZW.
|
||||
@ -881,7 +881,7 @@ enum ImGuiConfigFlags_
|
||||
ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiConfigFlags_PlatformHasViewports + ImGuiConfigFlags_RendererHasViewports set by the respective back-ends)
|
||||
ImGuiConfigFlags_ViewportsNoTaskBarIcons= 1 << 11, // Disable task bars icons for all secondary viewports (will set ImGuiViewportFlags_NoTaskBarIcon on them)
|
||||
ImGuiConfigFlags_ViewportsNoMerge = 1 << 12, // All floating windows _always_ have create their own viewport and platform window.
|
||||
ImGuiConfigFlags_DpiEnableScaleViewports= 1 << 13, // Reposition and resize imgui windows when the DpiScale of a viewport changed (mostly useful for the main viewport hosting other window). Note that resizing the main window itself is up to your application.
|
||||
ImGuiConfigFlags_DpiEnableScaleViewports= 1 << 13, // FIXME-DPI: Reposition and resize imgui windows when the DpiScale of a viewport changed (mostly useful for the main viewport hosting other window). Note that resizing the main window itself is up to your application.
|
||||
ImGuiConfigFlags_DpiEnableScaleFonts = 1 << 14, // FIXME-DPI: Request bitmap-scaled fonts to match DpiScale. This is a very low-quality workaround. The correct way to handle DPI is _currently_ to replace the atlas and/or fonts in the Platform_OnChangedViewport callback, but this is all early work in progress.
|
||||
|
||||
// User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core ImGui)
|
||||
@ -898,8 +898,8 @@ enum ImGuiBackendFlags_
|
||||
|
||||
// [BETA] Viewports
|
||||
ImGuiBackendFlags_PlatformHasViewports = 1 << 10, // Back-end Platform supports multiple viewports.
|
||||
ImGuiBackendFlags_RendererHasViewports = 1 << 11, // Back-end Renderer supports multiple viewports.
|
||||
ImGuiBackendFlags_HasMouseHoveredViewport=1 << 12 // Back-end Platform supports setting io.MouseHoveredViewport to the viewport directly under the mouse _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag and _REGARDLESS_ of whether another viewport is focused and may be capturing the mouse. This information is _NOT EASY_ to provide correctly with most high-level engines! Don't set this without studying how the examples/ back-end handle it!
|
||||
ImGuiBackendFlags_HasMouseHoveredViewport=1 << 11, // Back-end Platform supports setting io.MouseHoveredViewport to the viewport directly under the mouse _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag and _REGARDLESS_ of whether another viewport is focused and may be capturing the mouse. This information is _NOT EASY_ to provide correctly with most high-level engines! Don't set this without studying how the examples/ back-end handle it!
|
||||
ImGuiBackendFlags_RendererHasViewports = 1 << 12, // Back-end Renderer supports multiple viewports.
|
||||
};
|
||||
|
||||
// Enumeration for PushStyleColor() / PopStyleColor()
|
||||
@ -1108,12 +1108,12 @@ struct ImGuiStyle
|
||||
struct ImGuiIO
|
||||
{
|
||||
//------------------------------------------------------------------
|
||||
// Settings (fill once) // Default value:
|
||||
// Configuration (fill once) // Default value:
|
||||
//------------------------------------------------------------------
|
||||
|
||||
ImGuiConfigFlags ConfigFlags; // = 0 // See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc.
|
||||
ImGuiBackendFlags BackendFlags; // = 0 // Set ImGuiBackendFlags_ enum. Set by imgui_impl_xxx files or custom back-end to communicate features supported by the back-end.
|
||||
ImVec2 DisplaySize; // <unset> // Main display size. Used e.g. to clamp windows positions. This is the default viewport. Use BeginViewport() for other viewports.
|
||||
ImVec2 DisplaySize; // <unset> // Main display size, in pixels. Used e.g. to clamp windows positions. This is the default viewport. Use BeginViewport() for other viewports.
|
||||
float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds.
|
||||
float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds.
|
||||
const char* IniFilename; // = "imgui.ini" // Path to .ini file. Set NULL to disable automatic .ini loading/saving, if e.g. you want to manually load/save from memory.
|
||||
@ -1133,8 +1133,9 @@ struct ImGuiIO
|
||||
ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
|
||||
|
||||
// Miscellaneous configuration options
|
||||
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by back-end implementations.
|
||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl (was called io.OptMacOSXBehaviors prior to 1.63)
|
||||
bool ConfigCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63)
|
||||
bool ConfigInputTextCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63)
|
||||
bool ConfigResizeWindowsFromEdges; // = false // [BETA] Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be the ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@ -1165,7 +1166,6 @@ struct ImGuiIO
|
||||
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
|
||||
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends.
|
||||
ImGuiID MouseHoveredViewport; // (Optional) When using multiple viewports: viewport the OS mouse cursor is hovering _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag, and _REGARDLESS_ of whether another viewport is focused. Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info. If you don't imgui will use a decent heuristic instead.
|
||||
bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
||||
bool KeyCtrl; // Keyboard modifier pressed: Control
|
||||
bool KeyShift; // Keyboard modifier pressed: Shift
|
||||
bool KeyAlt; // Keyboard modifier pressed: Alt
|
||||
|
109
imgui_demo.cpp
109
imgui_demo.cpp
@ -247,11 +247,91 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::Spacing();
|
||||
if (ImGui::CollapsingHeader("Help"))
|
||||
{
|
||||
ImGui::TextWrapped("This window is being created by the ShowDemoWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n");
|
||||
ImGui::Text("PROGRAMMER GUIDE:");
|
||||
ImGui::BulletText("Please see the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!");
|
||||
ImGui::BulletText("Please see the comments in imgui.cpp.");
|
||||
ImGui::BulletText("Please see the examples/ in application.");
|
||||
ImGui::BulletText("Enable 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls.");
|
||||
ImGui::BulletText("Enable 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls.");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("USER GUIDE:");
|
||||
ImGui::ShowUserGuide();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Configuration"))
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if (ImGui::TreeNode("Configuration##2"))
|
||||
{
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);
|
||||
ImGui::SameLine(); ShowHelpMarker("Required back-end to feed in gamepad inputs in io.NavInputs[] and set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\n\nRead instructions in imgui.cpp for details.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouse", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouse);
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_NoMouse) // Create a way to restore this flag otherwise we could be stuck completely!
|
||||
{
|
||||
if (fmodf((float)ImGui::GetTime(), 0.40f) < 0.20f)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("<<PRESS SPACE TO DISABLE>>");
|
||||
}
|
||||
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))
|
||||
io.ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
|
||||
}
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: ViewportsEnable", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_ViewportsEnable);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: ViewportsNoTaskBarIcons", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_ViewportsNoTaskBarIcons);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: ViewportsNoMerge", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_ViewportsNoMerge);
|
||||
ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink);
|
||||
ImGui::SameLine(); ShowHelpMarker("Set to false to disable blinking cursor, for users who consider it distracting");
|
||||
ImGui::Checkbox("io.ConfigResizeWindowsFromEdges [beta]", &io.ConfigResizeWindowsFromEdges);
|
||||
ImGui::SameLine(); ShowHelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
|
||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct Dear ImGui to render a mouse cursor for you. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Backend Flags"))
|
||||
{
|
||||
ImGuiBackendFlags backend_flags = io.BackendFlags; // Make a local copy to avoid modifying the back-end flags.
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasGamepad);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasSetMousePos);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: PlatformHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_PlatformHasViewports);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseHoveredViewport", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseHoveredViewport);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_RendererHasViewports);
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Style"))
|
||||
{
|
||||
ImGui::ShowStyleEditor();
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Capture/Logging"))
|
||||
{
|
||||
ImGui::TextWrapped("The logging API redirects all text output so you can easily capture the content of a window or a block. Tree nodes can be automatically expanded.");
|
||||
ShowHelpMarker("Try opening any of the contents below in this window and then click one of the \"Log To\" button.");
|
||||
ImGui::LogButtons();
|
||||
ImGui::TextWrapped("You can also call ImGui::LogText() to output directly to the log without a visual output.");
|
||||
if (ImGui::Button("Copy \"Hello, world!\" to clipboard"))
|
||||
{
|
||||
ImGui::LogToClipboard();
|
||||
ImGui::LogText("Hello, world!");
|
||||
ImGui::LogFinish();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Window options"))
|
||||
{
|
||||
ImGui::Checkbox("No titlebar", &no_titlebar); ImGui::SameLine(150);
|
||||
@ -262,19 +342,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::Checkbox("No collapse", &no_collapse);
|
||||
ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150);
|
||||
ImGui::Checkbox("No nav", &no_nav);
|
||||
|
||||
if (ImGui::TreeNode("Style"))
|
||||
{
|
||||
ImGui::ShowStyleEditor();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Capture/Logging"))
|
||||
{
|
||||
ImGui::TextWrapped("The logging API redirects all text output so you can easily capture the content of a window or a block. Tree nodes can be automatically expanded. You can also call ImGui::LogText() to output directly to the log without a visual output.");
|
||||
ImGui::LogButtons();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Widgets"))
|
||||
@ -2166,20 +2233,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos);
|
||||
ImGui::Text("NavActive: %d, NavVisible: %d", io.NavActive, io.NavVisible);
|
||||
|
||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad [beta]", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard [beta]", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.");
|
||||
ImGui::Checkbox("io.ConfigCursorBlink", &io.ConfigCursorBlink);
|
||||
ImGui::SameLine(); ShowHelpMarker("Set to false to disable blinking cursor, for users who consider it distracting");
|
||||
ImGui::Checkbox("io.ConfigResizeWindowsFromEdges [beta]", &io.ConfigResizeWindowsFromEdges);
|
||||
ImGui::SameLine(); ShowHelpMarker("Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
|
||||
|
||||
if (ImGui::TreeNode("Keyboard, Mouse & Navigation State"))
|
||||
{
|
||||
if (ImGui::IsMousePosValid())
|
||||
|
@ -3517,7 +3517,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + buf_display_len, 0.0f, is_multiline ? NULL : &clip_rect);
|
||||
|
||||
// Draw blinking cursor
|
||||
bool cursor_is_visible = (!g.IO.ConfigCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || ImFmod(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
||||
bool cursor_is_visible = (!g.IO.ConfigInputTextCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || ImFmod(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
||||
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
||||
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f);
|
||||
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
||||
|
Loading…
Reference in New Issue
Block a user