mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-04 22:28:15 +08:00
Nav: pressing gamepad north button activates context menus.
+ update ShowUserGuide().
This commit is contained in:
@@ -103,6 +103,7 @@ Other Changes:
|
|||||||
- Popups: Shift+F10 or Menu key can now open popups menus when using
|
- Popups: Shift+F10 or Menu key can now open popups menus when using
|
||||||
BeginPopupContextItem(), BeginPopupContextWindow() or OpenPopupOnItemClick().
|
BeginPopupContextItem(), BeginPopupContextWindow() or OpenPopupOnItemClick().
|
||||||
(#8803, #9270) [@exelix11, @ocornut]
|
(#8803, #9270) [@exelix11, @ocornut]
|
||||||
|
- Popups: pressing North button (PS4/PS5 triangle, SwitchX, Xbox Y) also open popups menus.
|
||||||
- Clipper:
|
- Clipper:
|
||||||
- Clear `DisplayStart`/`DisplayEnd` fields when `Step()` returns false.
|
- Clear `DisplayStart`/`DisplayEnd` fields when `Step()` returns false.
|
||||||
- Added `UserIndex` helper storage. This is solely a convenience for cases where
|
- Added `UserIndex` helper storage. This is solely a convenience for cases where
|
||||||
|
|||||||
@@ -14252,10 +14252,13 @@ static void ImGui::NavUpdateContextMenuRequest()
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.NavOpenContextMenuItemId = g.NavOpenContextMenuWindowId = 0;
|
g.NavOpenContextMenuItemId = g.NavOpenContextMenuWindowId = 0;
|
||||||
const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
if (!nav_keyboard_active || g.NavWindow == NULL)
|
const bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
|
if ((!nav_keyboard_active && !nav_gamepad_active) || g.NavWindow == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool request = IsKeyReleased(ImGuiKey_Menu, ImGuiKeyOwner_NoOwner) || (IsKeyPressed(ImGuiKey_F10, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner) && g.IO.KeyMods == ImGuiMod_Shift);
|
bool request = false;
|
||||||
|
request |= nav_keyboard_active && (IsKeyReleased(ImGuiKey_Menu, ImGuiKeyOwner_NoOwner) || (IsKeyPressed(ImGuiKey_F10, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner) && g.IO.KeyMods == ImGuiMod_Shift));
|
||||||
|
request |= nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadContextMenu, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner);
|
||||||
if (!request)
|
if (!request)
|
||||||
return;
|
return;
|
||||||
g.NavOpenContextMenuItemId = g.NavId;
|
g.NavOpenContextMenuItemId = g.NavId;
|
||||||
|
|||||||
@@ -1618,10 +1618,10 @@ enum ImGuiKey : int
|
|||||||
// // XBOX | SWITCH | PLAYSTA. | -> ACTION
|
// // XBOX | SWITCH | PLAYSTA. | -> ACTION
|
||||||
ImGuiKey_GamepadStart, // Menu | + | Options |
|
ImGuiKey_GamepadStart, // Menu | + | Options |
|
||||||
ImGuiKey_GamepadBack, // View | - | Share |
|
ImGuiKey_GamepadBack, // View | - | Share |
|
||||||
ImGuiKey_GamepadFaceLeft, // X | Y | Square | Tap: Toggle Menu. Hold: Windowing mode (Focus/Move/Resize windows)
|
ImGuiKey_GamepadFaceLeft, // X | Y | Square | Toggle Menu. Hold for Windowing mode (Focus/Move/Resize windows)
|
||||||
ImGuiKey_GamepadFaceRight, // B | A | Circle | Cancel / Close / Exit
|
ImGuiKey_GamepadFaceRight, // B | A | Circle | Cancel / Close / Exit
|
||||||
ImGuiKey_GamepadFaceUp, // Y | X | Triangle |
|
ImGuiKey_GamepadFaceUp, // Y | X | Triangle | Open Context Menu
|
||||||
ImGuiKey_GamepadFaceDown, // A | B | Cross | Activate / Open / Toggle / Tweak. Hold for 0.60f to Activate in Text Input mode (e.g. wired to an on-screen keyboard).
|
ImGuiKey_GamepadFaceDown, // A | B | Cross | Activate / Open / Toggle. Hold for 0.60f to Activate in Text Input mode (e.g. wired to an on-screen keyboard).
|
||||||
ImGuiKey_GamepadDpadLeft, // D-pad Left | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
ImGuiKey_GamepadDpadLeft, // D-pad Left | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadDpadRight, // D-pad Right | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
ImGuiKey_GamepadDpadRight, // D-pad Right | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadDpadUp, // D-pad Up | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
ImGuiKey_GamepadDpadUp, // D-pad Up | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
||||||
|
|||||||
+10
-1
@@ -8731,7 +8731,7 @@ void ImGui::ShowUserGuide()
|
|||||||
BulletText("Ctrl+Z to undo, Ctrl+Y/Ctrl+Shift+Z to redo.");
|
BulletText("Ctrl+Z to undo, Ctrl+Y/Ctrl+Shift+Z to redo.");
|
||||||
BulletText("Escape to revert.");
|
BulletText("Escape to revert.");
|
||||||
Unindent();
|
Unindent();
|
||||||
BulletText("With keyboard navigation enabled:");
|
BulletText("With Keyboard controls enabled:");
|
||||||
Indent();
|
Indent();
|
||||||
BulletText("Arrow keys or Home/End/PageUp/PageDown to navigate.");
|
BulletText("Arrow keys or Home/End/PageUp/PageDown to navigate.");
|
||||||
BulletText("Space to activate a widget.");
|
BulletText("Space to activate a widget.");
|
||||||
@@ -8740,6 +8740,15 @@ void ImGui::ShowUserGuide()
|
|||||||
BulletText("Alt to jump to the menu layer of a window.");
|
BulletText("Alt to jump to the menu layer of a window.");
|
||||||
BulletText("Menu or Shift+F10 to open a context menu.");
|
BulletText("Menu or Shift+F10 to open a context menu.");
|
||||||
Unindent();
|
Unindent();
|
||||||
|
BulletText("With Gamepad controls enabled:");
|
||||||
|
Indent();
|
||||||
|
BulletText("D-Pad: Navigate / Tweak / Resize (in Windowing mode).");
|
||||||
|
BulletText("%s Face button: Activate / Open / Toggle. Hold: activate with text input.", io.ConfigNavSwapGamepadButtons ? "East" : "South");
|
||||||
|
BulletText("%s Face button: Cancel / Close / Exit.", io.ConfigNavSwapGamepadButtons ? "South" : "East");
|
||||||
|
BulletText("West Face button: Toggle Menu. Hold for Windowing mode (Focus/Move/Resize windows).");
|
||||||
|
BulletText("North Face button: Open Context Menu.");
|
||||||
|
BulletText("L1/R1: Tweak Slower/Faster, Focus Previous/Next (in Windowing Mode).");
|
||||||
|
Unindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
+2
-2
@@ -1508,8 +1508,8 @@ typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitAr
|
|||||||
#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1
|
#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1
|
||||||
#define ImGuiKey_NavGamepadActivate (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceRight : ImGuiKey_GamepadFaceDown)
|
#define ImGuiKey_NavGamepadActivate (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceRight : ImGuiKey_GamepadFaceDown)
|
||||||
#define ImGuiKey_NavGamepadCancel (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceDown : ImGuiKey_GamepadFaceRight)
|
#define ImGuiKey_NavGamepadCancel (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceDown : ImGuiKey_GamepadFaceRight)
|
||||||
#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft
|
#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft // Toggle menu layer. Hold to enable Windowing.
|
||||||
//#define ImGuiKey_NavGamepadInput ImGuiKey_GamepadFaceUp
|
#define ImGuiKey_NavGamepadContextMenu ImGuiKey_GamepadFaceUp // Open context menu (same as Shift+F10)
|
||||||
|
|
||||||
enum ImGuiInputEventType
|
enum ImGuiInputEventType
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user