IInputManager class
#include <nCine/Input/IInputManager.h>
Interface for querying input state and dispatching input events.
Provides access to mouse, keyboard and joystick state, manages the active IInputEventHandler and exposes the joystick mapping layer. Backends derive from it to supply platform-specific input.
Derived classes
- class AndroidInputManager
- Parses and dispatches Android input events.
- class GlfwInputManager
- GLFW-based input manager.
- class Qt5InputManager
- Parses and dispatches Qt5 input events.
- class SdlInputManager
- SDL2-based input manager.
- class UwpInputManager
- Class for dispatching UWP input events.
Public types
- enum class Cursor { Arrow, Hidden, HiddenLocked }
- Mouse cursor mode.
Public static functions
- static auto handler() -> IInputEventHandler*
- Returns the current input event handler.
- static void setHandler(IInputEventHandler* inputEventHandler)
- Sets the input event handler.
Constructors, destructors, conversion operators
- IInputManager()
- ~IInputManager() virtual
Public functions
- auto mouseState() const -> const MouseState& pure virtual
- Returns the current mouse state.
- auto keyboardState() const -> const KeyboardState& pure virtual
- Returns the current keyboard state.
- auto getClipboardText() const -> String virtual
- Returns the clipboard text, or empty if none.
- auto setClipboardText(StringView text) -> bool virtual
- Sets the clipboard text.
- auto getKeyName(Keys key) const -> StringView virtual
- Returns the display name of the specified key.
- auto isJoyPresent(int joyId) const -> bool pure virtual
- Returns
trueif the specified joystick is connected. - auto joyName(int joyId) const -> const char* pure virtual
- Returns the name of the specified joystick.
- auto joyGuid(int joyId) const -> const JoystickGuid pure virtual
- Returns the GUID of the specified joystick.
- auto joyNumButtons(int joyId) const -> int pure virtual
- Returns the number of buttons of the specified joystick.
- auto joyNumHats(int joyId) const -> int pure virtual
- Returns the number of hats of the specified joystick.
- auto joyNumAxes(int joyId) const -> int pure virtual
- Returns the number of axes of the specified joystick.
- auto joystickState(int joyId) const -> const JoystickState& pure virtual
- Returns the raw state of the specified joystick.
- auto joystickRumble(int joyId, float lowFreqIntensity, float highFreqIntensity, uint32_t durationMs) -> bool pure virtual
- Starts a low/high frequency rumble effect for the specified duration in milliseconds.
- auto joystickRumbleTriggers(int joyId, float left, float right, uint32_t durationMs) -> bool pure virtual
- Starts a left/right trigger rumble effect for the specified duration in milliseconds.
- auto isJoyMapped(int joyId) const -> bool
- Returns
trueif the joystick has a valid mapping configuration. - auto joyMappedState(int joyId) const -> const JoyMappedState&
- Returns the unified mapped state of the specified joystick.
- void deadZoneNormalize(Vector2f& joyVector, float deadZoneValue) const
- Normalizes a joystick axis vector, clamping values within the dead zone to zero.
- void addJoyMappingsFromFile(StringView path)
- Adds joystick mapping configurations from a text file.
- void addJoyMappingsFromString(StringView mappingStrings)
- Adds joystick mapping configurations from a string.
- auto numJoyMappings() const -> unsigned int
- Returns the current number of valid joystick mappings.
- auto hasMappingByGuid(const JoystickGuid& guid) const -> bool
- Returns
trueif a mapping exists for the specified joystick GUID. - auto hasMappingByName(const char* name) const -> bool
- Returns
trueif a mapping exists for the specified joystick name. - auto cursor() const -> Cursor
- Returns the current mouse cursor mode.
- void setCursor(Cursor cursor) virtual
- Sets the mouse cursor mode.
Constants
-
static const std::
int32_t MaxNumJoysticks - Maximum number of joysticks.
- static float LeftStickDeadZone constexpr
- Dead zone radius applied to the left analog stick.
- static float RightStickDeadZone constexpr
- Dead zone radius applied to the right analog stick.
- static float TriggerDeadZone constexpr
- Dead zone applied to analog triggers.
- static float AnalogInButtonDeadZone constexpr
- Threshold above which an analog input is reported as a pressed button.
- static float AnalogOutButtonDeadZone constexpr
- Threshold below which an analog input is reported as a released button.
- static float TriggerButtonDeadZone constexpr
- Threshold above which an analog trigger is reported as a pressed button.
Enum documentation
enum class nCine:: IInputManager:: Cursor
Mouse cursor mode.
| Enumerators | |
|---|---|
| Arrow |
Cursor is shown and behaves normally |
| Hidden |
Cursor is hidden but behaves normally |
| HiddenLocked |
Cursor is hidden and locked to the window; movement is relative if supported (no acceleration or scaling) |
Function documentation
bool nCine:: IInputManager:: isJoyMapped(int joyId) const
Returns true if the joystick has a valid mapping configuration.