mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Removed io.NavInputs[] and ImGuiNavInput enum. Kept inline redirection code. (#4921, #4858, #787, #1599, #323)
This commit is contained in:
94
imgui.h
94
imgui.h
@ -65,7 +65,7 @@ Index of this file:
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.89 WIP"
|
||||
#define IMGUI_VERSION_NUM 18803
|
||||
#define IMGUI_VERSION_NUM 18804
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
@ -171,7 +171,6 @@ typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A
|
||||
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
||||
typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction
|
||||
typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier
|
||||
typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation
|
||||
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle)
|
||||
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
|
||||
typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending)
|
||||
@ -1396,27 +1395,28 @@ enum ImGuiKey_
|
||||
ImGuiKey_KeypadEnter,
|
||||
ImGuiKey_KeypadEqual,
|
||||
|
||||
// Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION action
|
||||
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS) // --
|
||||
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS) // --
|
||||
ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square (PS) // -> ImGuiNavInput_Menu
|
||||
ImGuiKey_GamepadFaceRight, // B (Xbox) A (Switch) Circle (PS) // -> ImGuiNavInput_Cancel
|
||||
ImGuiKey_GamepadFaceUp, // Y (Xbox) X (Switch) Triangle (PS) // -> ImGuiNavInput_Input
|
||||
ImGuiKey_GamepadFaceDown, // A (Xbox) B (Switch) Cross (PS) // -> ImGuiNavInput_Activate
|
||||
ImGuiKey_GamepadDpadLeft, // D-pad Left // -> ImGuiNavInput_DpadLeft
|
||||
ImGuiKey_GamepadDpadRight, // D-pad Right // -> ImGuiNavInput_DpadRight
|
||||
ImGuiKey_GamepadDpadUp, // D-pad Up // -> ImGuiNavInput_DpadUp
|
||||
ImGuiKey_GamepadDpadDown, // D-pad Down // -> ImGuiNavInput_DpadDown
|
||||
ImGuiKey_GamepadL1, // L Bumper (Xbox) L (Switch) L1 (PS) // -> ImGuiNavInput_FocusPrev + ImGuiNavInput_TweakSlow
|
||||
ImGuiKey_GamepadR1, // R Bumper (Xbox) R (Switch) R1 (PS) // -> ImGuiNavInput_FocusNext + ImGuiNavInput_TweakFast
|
||||
ImGuiKey_GamepadL2, // L Trigger (Xbox) ZL (Switch) L2 (PS) [Analog]
|
||||
ImGuiKey_GamepadR2, // R Trigger (Xbox) ZR (Switch) R2 (PS) [Analog]
|
||||
ImGuiKey_GamepadL3, // L Thumbstick (Xbox) L3 (Switch) L3 (PS)
|
||||
ImGuiKey_GamepadR3, // R Thumbstick (Xbox) R3 (Switch) R3 (PS)
|
||||
ImGuiKey_GamepadLStickLeft, // [Analog] // -> ImGuiNavInput_LStickLeft
|
||||
ImGuiKey_GamepadLStickRight, // [Analog] // -> ImGuiNavInput_LStickRight
|
||||
ImGuiKey_GamepadLStickUp, // [Analog] // -> ImGuiNavInput_LStickUp
|
||||
ImGuiKey_GamepadLStickDown, // [Analog] // -> ImGuiNavInput_LStickDown
|
||||
// Gamepad (some of those are analog values, 0.0f to 1.0f) // GAME NAVIGATION ACTION
|
||||
// (download controller mapping PNG/PSD at http://dearimgui.org/controls_sheets)
|
||||
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS)
|
||||
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS)
|
||||
ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square (PS) // Tap: Toggle Menu. Hold: Windowing mode (Focus/Move/Resize windows)
|
||||
ImGuiKey_GamepadFaceRight, // B (Xbox) A (Switch) Circle (PS) // Cancel / Close / Exit
|
||||
ImGuiKey_GamepadFaceUp, // Y (Xbox) X (Switch) Triangle (PS) // Text Input / On-screen Keyboard
|
||||
ImGuiKey_GamepadFaceDown, // A (Xbox) B (Switch) Cross (PS) // Activate / Open / Toggle / Tweak
|
||||
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_GamepadDpadUp, // D-pad Up // Move / Tweak / Resize Window (in Windowing mode)
|
||||
ImGuiKey_GamepadDpadDown, // D-pad Down // Move / Tweak / Resize Window (in Windowing mode)
|
||||
ImGuiKey_GamepadL1, // L Bumper (Xbox) L (Switch) L1 (PS) // Tweak Slower / Focus Previous (in Windowing mode)
|
||||
ImGuiKey_GamepadR1, // R Bumper (Xbox) R (Switch) R1 (PS) // Tweak Faster / Focus Next (in Windowing mode)
|
||||
ImGuiKey_GamepadL2, // L Trig. (Xbox) ZL (Switch) L2 (PS) [Analog]
|
||||
ImGuiKey_GamepadR2, // R Trig. (Xbox) ZR (Switch) R2 (PS) [Analog]
|
||||
ImGuiKey_GamepadL3, // L Stick (Xbox) L3 (Switch) L3 (PS)
|
||||
ImGuiKey_GamepadR3, // R Stick (Xbox) R3 (Switch) R3 (PS)
|
||||
ImGuiKey_GamepadLStickLeft, // [Analog] // Move Window (in Windowing mode)
|
||||
ImGuiKey_GamepadLStickRight, // [Analog] // Move Window (in Windowing mode)
|
||||
ImGuiKey_GamepadLStickUp, // [Analog] // Move Window (in Windowing mode)
|
||||
ImGuiKey_GamepadLStickDown, // [Analog] // Move Window (in Windowing mode)
|
||||
ImGuiKey_GamepadRStickLeft, // [Analog]
|
||||
ImGuiKey_GamepadRStickRight, // [Analog]
|
||||
ImGuiKey_GamepadRStickUp, // [Analog]
|
||||
@ -1463,46 +1463,24 @@ enum ImGuiModFlags_
|
||||
ImGuiModFlags_Super = 1 << 3, // Cmd/Super/Windows key
|
||||
};
|
||||
|
||||
// Gamepad/Keyboard navigation
|
||||
// Since >= 1.87 backends you generally don't need to care about this enum since io.NavInputs[] is setup automatically. This might become private/internal some day.
|
||||
// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.AddKeyEvent() calls.
|
||||
// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: 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://dearimgui.org/controls_sheets.
|
||||
enum ImGuiNavInput_
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
// OBSOLETED in 1.88 (from July 2022): ImGuiNavInput and io.NavInputs[].
|
||||
// Official backends between 1.60 and 1.86: will keep working and feed gamepad inputs as long as IMGUI_DISABLE_OBSOLETE_KEYIO is not set.
|
||||
// Custom backends: feed gamepad inputs via io.AddKeyEvent() and ImGuiKey_GamepadXXX enums.
|
||||
enum ImGuiNavInput
|
||||
{
|
||||
// Gamepad Mapping
|
||||
ImGuiNavInput_Activate, // Activate / Open / Toggle / Tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard)
|
||||
ImGuiNavInput_Cancel, // Cancel / Close / Exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
|
||||
ImGuiNavInput_Input, // Text input / On-Screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
|
||||
ImGuiNavInput_Menu, // Tap: Toggle menu / Hold: Focus, Move, Resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
|
||||
ImGuiNavInput_DpadLeft, // Move / Tweak / Resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
|
||||
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, // Focus Next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
|
||||
ImGuiNavInput_FocusNext, // Focus Prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
||||
ImGuiNavInput_TweakSlow, // Slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
|
||||
ImGuiNavInput_TweakFast, // Faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
||||
|
||||
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
||||
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from keyboard keys instead of io.NavInputs[].
|
||||
ImGuiNavInput_KeyLeft_, // Move left // = Arrow keys
|
||||
ImGuiNavInput_KeyRight_, // Move right
|
||||
ImGuiNavInput_KeyUp_, // Move up
|
||||
ImGuiNavInput_KeyDown_, // Move down
|
||||
ImGuiNavInput_COUNT
|
||||
ImGuiNavInput_Activate, ImGuiNavInput_Cancel, ImGuiNavInput_Input, ImGuiNavInput_Menu, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_DpadDown,
|
||||
ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight, ImGuiNavInput_LStickUp, ImGuiNavInput_LStickDown, ImGuiNavInput_FocusPrev, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakSlow, ImGuiNavInput_TweakFast,
|
||||
ImGuiNavInput_COUNT,
|
||||
};
|
||||
#endif
|
||||
|
||||
// Configuration flags stored in io.ConfigFlags. Set by user/application.
|
||||
enum ImGuiConfigFlags_
|
||||
{
|
||||
ImGuiConfigFlags_None = 0,
|
||||
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.AddKeyEvent() calls
|
||||
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad.
|
||||
ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag.
|
||||
ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. Backend also needs to set ImGuiBackendFlags_HasGamepad.
|
||||
ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth.
|
||||
ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set.
|
||||
ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend.
|
||||
@ -2011,6 +1989,7 @@ struct ImGuiIO
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
int KeyMap[ImGuiKey_COUNT]; // [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using ImGuiKey_ indices which are always >512.
|
||||
bool KeysDown[ImGuiKey_COUNT]; // [LEGACY] Input: Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[GetKeyIndex(...)] to work without an overflow.
|
||||
float NavInputs[ImGuiNavInput_COUNT]; // [LEGACY] Since 1.88, NavInputs[] was removed. Backends from 1.60 to 1.86 won't build. Feed gamepad inputs via io.AddKeyEvent() and ImGuiKey_GamepadXXX enums.
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@ -2028,7 +2007,6 @@ struct ImGuiIO
|
||||
bool KeyShift; // Keyboard modifier down: Shift
|
||||
bool KeyAlt; // Keyboard modifier down: Alt
|
||||
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
||||
float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame().
|
||||
|
||||
// Other state maintained from data above + IO function calls
|
||||
ImGuiModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
||||
@ -2047,8 +2025,6 @@ struct ImGuiIO
|
||||
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds)
|
||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
||||
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
||||
bool AppFocusLost; // Only modify via AddFocusEvent()
|
||||
bool AppAcceptingEvents; // Only modify via SetAppAcceptingEvents()
|
||||
|
Reference in New Issue
Block a user