mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Nav: Toward automatically mapping keyboard input. Renamed ImGuiNavInput_PadXXX to ImGuiNavInput_XXX. Renamed ImGuiNavInput_KeyXXX to ImGuiNavInput_KeyXXX_ (internal). (#787)
This commit is contained in:
		| @@ -444,22 +444,22 @@ void ImGui_ImplGlfwGL3_NewFrame() | ||||
|         int axes_count = 0, buttons_count = 0; | ||||
|         const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count); | ||||
|         const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count); | ||||
|         MAP_BUTTON(ImGuiNavInput_PadActivate,   0);     // Cross / A | ||||
|         MAP_BUTTON(ImGuiNavInput_PadCancel,     1);     // Circle / B | ||||
|         MAP_BUTTON(ImGuiNavInput_PadMenu,       2);     // Square / X | ||||
|         MAP_BUTTON(ImGuiNavInput_PadInput,      3);     // Triangle / Y | ||||
|         MAP_BUTTON(ImGuiNavInput_PadDpadLeft,   13);    // D-Pad Left | ||||
|         MAP_BUTTON(ImGuiNavInput_PadDpadRight,  11);    // D-Pad Right | ||||
|         MAP_BUTTON(ImGuiNavInput_PadDpadUp,     10);    // D-Pad Up | ||||
|         MAP_BUTTON(ImGuiNavInput_PadDpadDown,   12);    // D-Pad Down | ||||
|         MAP_BUTTON(ImGuiNavInput_PadFocusPrev,  4);     // L Trigger | ||||
|         MAP_BUTTON(ImGuiNavInput_PadFocusNext,  5);     // R Trigger | ||||
|         MAP_BUTTON(ImGuiNavInput_PadTweakSlow,  4);     // L Trigger | ||||
|         MAP_BUTTON(ImGuiNavInput_PadTweakFast,  5);     // R Trigger | ||||
|         MAP_ANALOG(ImGuiNavInput_PadLStickLeft, 0,  -0.3f,  -0.9f); | ||||
|         MAP_ANALOG(ImGuiNavInput_PadLStickRight,0,  +0.3f,  +0.9f); | ||||
|         MAP_ANALOG(ImGuiNavInput_PadLStickUp,   1,  +0.3f,  +0.9f); | ||||
|         MAP_ANALOG(ImGuiNavInput_PadLStickDown, 1,  -0.3f,  -0.9f); | ||||
|         MAP_BUTTON(ImGuiNavInput_Activate,   0);     // Cross / A | ||||
|         MAP_BUTTON(ImGuiNavInput_Cancel,     1);     // Circle / B | ||||
|         MAP_BUTTON(ImGuiNavInput_Menu,       2);     // Square / X | ||||
|         MAP_BUTTON(ImGuiNavInput_Input,      3);     // Triangle / Y | ||||
|         MAP_BUTTON(ImGuiNavInput_DpadLeft,   13);    // D-Pad Left | ||||
|         MAP_BUTTON(ImGuiNavInput_DpadRight,  11);    // D-Pad Right | ||||
|         MAP_BUTTON(ImGuiNavInput_DpadUp,     10);    // D-Pad Up | ||||
|         MAP_BUTTON(ImGuiNavInput_DpadDown,   12);    // D-Pad Down | ||||
|         MAP_BUTTON(ImGuiNavInput_FocusPrev,  4);     // L Trigger | ||||
|         MAP_BUTTON(ImGuiNavInput_FocusNext,  5);     // R Trigger | ||||
|         MAP_BUTTON(ImGuiNavInput_TweakSlow,  4);     // L Trigger | ||||
|         MAP_BUTTON(ImGuiNavInput_TweakFast,  5);     // R Trigger | ||||
|         MAP_ANALOG(ImGuiNavInput_LStickLeft, 0,  -0.3f,  -0.9f); | ||||
|         MAP_ANALOG(ImGuiNavInput_LStickRight,0,  +0.3f,  +0.9f); | ||||
|         MAP_ANALOG(ImGuiNavInput_LStickUp,   1,  +0.3f,  +0.9f); | ||||
|         MAP_ANALOG(ImGuiNavInput_LStickDown, 1,  -0.3f,  -0.9f); | ||||
|         #undef MAP_BUTTON | ||||
|         #undef MAP_ANALOG | ||||
|     } | ||||
|   | ||||
							
								
								
									
										42
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -2739,14 +2739,14 @@ ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInput | ||||
| { | ||||
|     ImVec2 delta(0.0f, 0.0f); | ||||
|     if (dir_sources & ImGuiNavDirSourceFlags_Keyboard) | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight, mode)       - GetNavInputAmount(ImGuiNavInput_KeyLeft,       mode), GetNavInputAmount(ImGuiNavInput_KeyDown,       mode) - GetNavInputAmount(ImGuiNavInput_KeyUp,       mode)); | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight_, mode)   - GetNavInputAmount(ImGuiNavInput_KeyLeft_,   mode), GetNavInputAmount(ImGuiNavInput_KeyDown_,   mode) - GetNavInputAmount(ImGuiNavInput_KeyUp_,   mode)); | ||||
|     if (dir_sources & ImGuiNavDirSourceFlags_PadDPad) | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_PadDpadRight, mode)   - GetNavInputAmount(ImGuiNavInput_PadDpadLeft,   mode), GetNavInputAmount(ImGuiNavInput_PadDpadDown,   mode) - GetNavInputAmount(ImGuiNavInput_PadDpadUp,   mode)); | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_DpadRight, mode)   - GetNavInputAmount(ImGuiNavInput_DpadLeft,   mode), GetNavInputAmount(ImGuiNavInput_DpadDown,   mode) - GetNavInputAmount(ImGuiNavInput_DpadUp,   mode)); | ||||
|     if (dir_sources & ImGuiNavDirSourceFlags_PadLStick) | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_PadLStickRight, mode) - GetNavInputAmount(ImGuiNavInput_PadLStickLeft, mode), GetNavInputAmount(ImGuiNavInput_PadLStickDown, mode) - GetNavInputAmount(ImGuiNavInput_PadLStickUp, mode)); | ||||
|     if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_PadTweakSlow)) | ||||
|         delta += ImVec2(GetNavInputAmount(ImGuiNavInput_LStickRight, mode) - GetNavInputAmount(ImGuiNavInput_LStickLeft, mode), GetNavInputAmount(ImGuiNavInput_LStickDown, mode) - GetNavInputAmount(ImGuiNavInput_LStickUp, mode)); | ||||
|     if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakSlow)) | ||||
|         delta *= slow_factor; | ||||
|     if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_PadTweakFast)) | ||||
|     if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakFast)) | ||||
|         delta *= fast_factor; | ||||
|     return delta; | ||||
| } | ||||
| @@ -2773,7 +2773,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|     ImGuiWindow* apply_focus_window = NULL; | ||||
|     bool apply_toggle_layer = false; | ||||
|  | ||||
|     bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_PadMenu, ImGuiInputReadMode_Pressed); | ||||
|     bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed); | ||||
|     bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.NavFlags & ImGuiNavFlags_EnableKeyboard); | ||||
|     if (start_windowing_with_gamepad || start_windowing_with_keyboard) | ||||
|         if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavigable(g.Windows.Size - 1, -INT_MAX, -1)) | ||||
| @@ -2792,7 +2792,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|         g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingHighlightTimer - 0.20f) / 0.05f)); | ||||
|  | ||||
|         // Select window to focus | ||||
|         const int focus_change_dir = (int)IsNavInputPressed(ImGuiNavInput_PadFocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputPressed(ImGuiNavInput_PadFocusNext, ImGuiInputReadMode_RepeatSlow); | ||||
|         const int focus_change_dir = (int)IsNavInputPressed(ImGuiNavInput_FocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputPressed(ImGuiNavInput_FocusNext, ImGuiInputReadMode_RepeatSlow); | ||||
|         if (focus_change_dir != 0) | ||||
|         { | ||||
|             NavUpdateWindowingHighlightWindow(focus_change_dir); | ||||
| @@ -2800,7 +2800,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|         } | ||||
|  | ||||
|         // Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered front-most) | ||||
|         if (!IsNavInputDown(ImGuiNavInput_PadMenu)) | ||||
|         if (!IsNavInputDown(ImGuiNavInput_Menu)) | ||||
|         { | ||||
|             g.NavWindowingToggleLayer &= (g.NavWindowingHighlightAlpha < 1.0f); // Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore. | ||||
|             if (g.NavWindowingToggleLayer && g.NavWindow) | ||||
| @@ -2824,7 +2824,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|  | ||||
|     // Keyboard: Press and Release ALT to toggle menu layer | ||||
|     // FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of back-end clearing releases all keys on ALT-TAB | ||||
|     if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && IsNavInputPressed(ImGuiNavInput_KeyMenu, ImGuiInputReadMode_Released)) | ||||
|     if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released)) | ||||
|         if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev)) | ||||
|             apply_toggle_layer = true; | ||||
|  | ||||
| @@ -3003,7 +3003,7 @@ static void ImGui::NavUpdate() | ||||
|     g.IO.NavVisible = (g.IO.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL) || g.NavInitRequest; | ||||
|  | ||||
|     // Process NavCancel input (to close a popup, get back to parent, clear focus) | ||||
|     if (IsNavInputPressed(ImGuiNavInput_PadCancel, ImGuiInputReadMode_Pressed)) | ||||
|     if (IsNavInputPressed(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed)) | ||||
|     { | ||||
|         if (g.ActiveId != 0) | ||||
|         { | ||||
| @@ -3045,15 +3045,15 @@ static void ImGui::NavUpdate() | ||||
|     g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavInputId = 0; | ||||
|     if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) | ||||
|     { | ||||
|         bool activate_down = IsNavInputDown(ImGuiNavInput_PadActivate); | ||||
|         bool activate_pressed = activate_down && IsNavInputPressed(ImGuiNavInput_PadActivate, ImGuiInputReadMode_Pressed); | ||||
|         bool activate_down = IsNavInputDown(ImGuiNavInput_Activate); | ||||
|         bool activate_pressed = activate_down && IsNavInputPressed(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed); | ||||
|         if (g.ActiveId == 0 && activate_pressed) | ||||
|             g.NavActivateId = g.NavId; | ||||
|         if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down) | ||||
|             g.NavActivateDownId = g.NavId; | ||||
|         if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed) | ||||
|             g.NavActivatePressedId = g.NavId; | ||||
|         if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && IsNavInputPressed(ImGuiNavInput_PadInput, ImGuiInputReadMode_Pressed)) | ||||
|         if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && IsNavInputPressed(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed)) | ||||
|             g.NavInputId = g.NavId; | ||||
|     } | ||||
|     if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) | ||||
| @@ -3074,10 +3074,10 @@ static void ImGui::NavUpdate() | ||||
|         g.NavMoveDir = ImGuiDir_None; | ||||
|         if (g.NavWindow && !g.NavWindowingTarget && allowed_dir_flags && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) | ||||
|         { | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Left))  && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadDpadLeft, ImGuiNavInput_KeyLeft, ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Left; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Right)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadDpadRight,ImGuiNavInput_KeyRight,ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Right; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Up))    && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadDpadUp,   ImGuiNavInput_KeyUp,   ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Up; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Down))  && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadDpadDown, ImGuiNavInput_KeyDown, ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Down; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Left))  && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadLeft, ImGuiNavInput_KeyLeft_, ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Left; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Right)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadRight,ImGuiNavInput_KeyRight_,ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Right; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Up))    && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadUp,   ImGuiNavInput_KeyUp_,   ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Up; | ||||
|             if ((allowed_dir_flags & (1<<ImGuiDir_Down))  && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadDown, ImGuiNavInput_KeyDown_, ImGuiInputReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Down; | ||||
|         } | ||||
|     } | ||||
|     else | ||||
| @@ -7478,7 +7478,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool | ||||
|     if (g.NavActivateDownId == id) | ||||
|     { | ||||
|         bool nav_activated_by_code = (g.NavActivateId == id); | ||||
|         bool nav_activated_by_inputs = IsNavInputPressed(ImGuiNavInput_PadActivate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiInputReadMode_Repeat : ImGuiInputReadMode_Pressed); | ||||
|         bool nav_activated_by_inputs = IsNavInputPressed(ImGuiNavInput_Activate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiInputReadMode_Repeat : ImGuiInputReadMode_Pressed); | ||||
|         if (nav_activated_by_code || nav_activated_by_inputs) | ||||
|             pressed = true; | ||||
|         if (nav_activated_by_code || nav_activated_by_inputs || g.ActiveId == id) | ||||
| @@ -8548,7 +8548,7 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v | ||||
|                 clicked_t = SliderBehaviorCalcRatioFromValue(*v, v_min, v_max, power, linear_zero_pos); | ||||
|                 if (decimal_precision == 0 && !is_non_linear) | ||||
|                 { | ||||
|                     if (fabsf(v_max - v_min) <= 100.0f || IsNavInputDown(ImGuiNavInput_PadTweakSlow)) | ||||
|                     if (fabsf(v_max - v_min) <= 100.0f || IsNavInputDown(ImGuiNavInput_TweakSlow)) | ||||
|                         delta = ((delta < 0.0f) ? -1.0f : +1.0f) / (v_max - v_min); // Gamepad/keyboard tweak speeds in integer steps | ||||
|                     else | ||||
|                         delta /= 100.0f; | ||||
| @@ -8556,10 +8556,10 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v | ||||
|                 else | ||||
|                 { | ||||
|                     delta /= 100.0f;    // Gamepad/keyboard tweak speeds in % of slider bounds | ||||
|                     if (IsNavInputDown(ImGuiNavInput_PadTweakSlow)) | ||||
|                     if (IsNavInputDown(ImGuiNavInput_TweakSlow)) | ||||
|                         delta /= 10.0f; | ||||
|                 } | ||||
|                 if (IsNavInputDown(ImGuiNavInput_PadTweakFast)) | ||||
|                 if (IsNavInputDown(ImGuiNavInput_TweakFast)) | ||||
|                     delta *= 10.0f; | ||||
|                 set_new_value = true; | ||||
|                 if ((clicked_t >= 1.0f && delta > 0.0f) || (clicked_t <= 0.0f && delta < 0.0f)) // This is to avoid applying the saturation when already past the limits | ||||
|   | ||||
							
								
								
									
										42
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -710,30 +710,30 @@ enum ImGuiKey_ | ||||
| enum ImGuiNavInput_ | ||||
| { | ||||
|     // Gamepad Mapping | ||||
|     ImGuiNavInput_PadActivate,      // activate / open / toggle / tweak value         // e.g. Circle (PS4), A (Xbox), B (Switch) | ||||
|     ImGuiNavInput_PadCancel,        // cancel / close / exit                          // e.g. Cross  (PS4), B (Xbox), A (Switch) | ||||
|     ImGuiNavInput_PadInput,         // text input / on-screen keyboard                // e.g. Triang.(PS4), Y (Xbox), X (Switch) | ||||
|     ImGuiNavInput_PadMenu,          // tap: toggle menu / hold: focus, move, resize   // e.g. Square (PS4), X (Xbox), Y (Switch) | ||||
|     ImGuiNavInput_PadDpadLeft,      // move / tweak / resize window (w/ PadMenu)      // e.g. D-pad Left/Right/Up/Down | ||||
|     ImGuiNavInput_PadDpadRight,     //  | ||||
|     ImGuiNavInput_PadDpadUp,        //  | ||||
|     ImGuiNavInput_PadDpadDown,      //  | ||||
|     ImGuiNavInput_PadLStickLeft,    // scroll / move window (w/ PadMenu)              // e.g. Left Analog Stick Left/Right/Up/Down | ||||
|     ImGuiNavInput_PadLStickRight,   //  | ||||
|     ImGuiNavInput_PadLStickUp,      //  | ||||
|     ImGuiNavInput_PadLStickDown,    //  | ||||
|     ImGuiNavInput_PadFocusPrev,     // next window (w/ PadMenu)                       // e.g. L1 (PS4), LB (Xbox), L (Switch) | ||||
|     ImGuiNavInput_PadFocusNext,     // prev window (w/ PadMenu)                       // e.g. R1 (PS4), RB (Xbox), R (Switch)  | ||||
|     ImGuiNavInput_PadTweakSlow,     // slower tweaks                                  // e.g. L2 (PS4), LT (Xbox), ZL (Switch), Analog | ||||
|     ImGuiNavInput_PadTweakFast,     // faster tweaks                                  // e.g. R2 (PS4), RT (Xbox), ZR (Switch), Analog | ||||
|     ImGuiNavInput_Activate,      // activate / open / toggle / tweak value         // e.g. Circle (PS4), A (Xbox), B (Switch) | ||||
|     ImGuiNavInput_Cancel,        // cancel / close / exit                          // e.g. Cross  (PS4), B (Xbox), A (Switch) | ||||
|     ImGuiNavInput_Input,         // text input / on-screen keyboard                // e.g. Triang.(PS4), Y (Xbox), X (Switch) | ||||
|     ImGuiNavInput_Menu,          // tap: toggle menu / hold: focus, move, resize   // e.g. Square (PS4), X (Xbox), Y (Switch) | ||||
|     ImGuiNavInput_DpadLeft,      // move / tweak / resize window (w/ PadMenu)      // e.g. D-pad Left/Right/Up/Down | ||||
|     ImGuiNavInput_DpadRight,     //  | ||||
|     ImGuiNavInput_DpadUp,        //  | ||||
|     ImGuiNavInput_DpadDown,      //  | ||||
|     ImGuiNavInput_LStickLeft,    // scroll / move window (w/ PadMenu)              // e.g. Left Analog Stick Left/Right/Up/Down | ||||
|     ImGuiNavInput_LStickRight,   //  | ||||
|     ImGuiNavInput_LStickUp,      //  | ||||
|     ImGuiNavInput_LStickDown,    //  | ||||
|     ImGuiNavInput_FocusPrev,     // next window (w/ PadMenu)                       // e.g. L1 (PS4), LB (Xbox), L (Switch) | ||||
|     ImGuiNavInput_FocusNext,     // prev window (w/ PadMenu)                       // e.g. R1 (PS4), RB (Xbox), R (Switch)  | ||||
|     ImGuiNavInput_TweakSlow,     // slower tweaks                                  // e.g. L2 (PS4), LT (Xbox), ZL (Switch), Analog | ||||
|     ImGuiNavInput_TweakFast,     // faster tweaks                                  // e.g. R2 (PS4), RT (Xbox), ZR (Switch), Analog | ||||
|     // Keyboard Mapping | ||||
|     // [BETA] To use keyboard control you currently need to map keys to those gamepad inputs: PadActivate (Enter), PadCancel (Escape), PadInput (Enter).  | ||||
|     // Will add specialized keyboard mappings as we add features and clarify the input interface.  | ||||
|     ImGuiNavInput_KeyMenu,          // toggle menu                                    // e.g. Alt | ||||
|     ImGuiNavInput_KeyLeft,          // move left                                      // e.g. Arrow keys | ||||
|     ImGuiNavInput_KeyRight,         // move right | ||||
|     ImGuiNavInput_KeyUp,            // move up | ||||
|     ImGuiNavInput_KeyDown,          // move down | ||||
|     ImGuiNavInput_KeyMenu_,      // toggle menu                                    // e.g. Alt | ||||
|     ImGuiNavInput_KeyLeft_,      // move left                                      // e.g. Arrow keys | ||||
|     ImGuiNavInput_KeyRight_,     // move right | ||||
|     ImGuiNavInput_KeyUp_,        // move up | ||||
|     ImGuiNavInput_KeyDown_,      // move down | ||||
|     ImGuiNavInput_COUNT, | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -616,10 +616,10 @@ struct ImGuiContext | ||||
|     // Navigation data (for gamepad/keyboard) | ||||
|     ImGuiWindow*            NavWindow;                          // Focused window for navigation. Could be called 'FocusWindow' | ||||
|     ImGuiID                 NavId;                              // Focused item for navigation | ||||
|     ImGuiID                 NavActivateId;                      // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_PadActivate) ? NavId : 0, also set when calling ActivateItem() | ||||
|     ImGuiID                 NavActivateDownId;                  // ~~ IsNavInputDown(ImGuiNavInput_PadActivate) ? NavId : 0 | ||||
|     ImGuiID                 NavActivatePressedId;               // ~~ IsNavInputPressed(ImGuiNavInput_PadActivate) ? NavId : 0 | ||||
|     ImGuiID                 NavInputId;                         // ~~ IsNavInputPressed(ImGuiNavInput_PadInput) ? NavId : 0 | ||||
|     ImGuiID                 NavActivateId;                      // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem() | ||||
|     ImGuiID                 NavActivateDownId;                  // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0 | ||||
|     ImGuiID                 NavActivatePressedId;               // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0 | ||||
|     ImGuiID                 NavInputId;                         // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0 | ||||
|     ImGuiID                 NavJustTabbedId;                    // Just tabbed to this id. | ||||
|     ImGuiID                 NavNextActivateId;                  // Set by ActivateItem(), queued until next frame | ||||
|     ImGuiID                 NavJustMovedToId;                   // Just navigated to this id (result of a successfully MoveRequest) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user