Lysa  0.0
Lysa 3D Engine
Input Class Reference

Detailed Description

Static input helper responsible for keyboard, mouse and gamepad state.

Responsibilities:

  • Polling and edge-detection for keys, mouse buttons and gamepad buttons
  • Normalized joystick vectors with deadzone handling
  • Action mapping utilities (InputAction)

Notes:

  • All methods are static; there is no instance to create.
  • On Windows, the implementation integrates with Win32 messages, XInput and/or DirectInput to keep states updated.

Static Public Member Functions

static bool isKeyPressed (Key key)
 
static bool isKeyJustPressed (Key key)
 
static bool isKeyJustReleased (Key key)
 
static float2 getKeyboardVector (Key negX, Key posX, Key negY, Key posY)
 
static bool isMouseButtonPressed (MouseButton mouseButton)
 
static bool isMouseButtonJustPressed (MouseButton mouseButton)
 
static bool isMouseButtonJustReleased (MouseButton mouseButton)
 
static uint32 getConnectedJoypads ()
 
static bool isGamepad (uint32 index)
 
static std::string getJoypadName (uint32 index)
 
static float2 getGamepadVector (uint32 index, GamepadAxisJoystick axisJoystick)
 
static bool isGamepadButtonPressed (uint32 index, GamepadButton gamepadButton)
 
static bool isGamepadButtonJustReleased (GamepadButton button)
 
static bool isGamepadButtonJustPressed (GamepadButton button)
 
static void addAction (const InputAction &action)
 
static bool isAction (const std::string &actionName, const InputEvent &inputEvent)
 

Member Function Documentation

static void addAction ( const InputAction action)
static

Register a high-level input action that can be matched against events. If an action with the same name exists, it is replaced.

static uint32 getConnectedJoypads ( )
static

Returns the number of connected joypads (gamepads included).

Returns
Count of currently connected devices.
static float2 getGamepadVector ( uint32  index,
GamepadAxisJoystick  axisJoystick 
)
static

Returns the 2D vector for a gamepad joystick axis pair. Deadzone is applied internally and output is normalized to [-1, 1].

Parameters
indexIndex in range [0 .. getConnectedJoypads()).
axisJoystickJoystick selector (e.g., left or right stick).
Returns
A float2 with x/y in [-1, 1] after deadzone.
static std::string getJoypadName ( uint32  index)
static

Returns a human-readable name for the joypad at index.

Parameters
indexIndex in range [0 .. getConnectedJoypads()).
Returns
UTF-8 device name or an empty string if unavailable.
static float2 getKeyboardVector ( Key  negX,
Key  posX,
Key  negY,
Key  posY 
)
static

Builds a 2D vector from four directional keys. The result is not normalized; its components are in {-1, 0, 1}.

Parameters
negXKey for negative X (left).
posXKey for positive X (right).
negYKey for negative Y (down).
posYKey for positive Y (up).
Returns
A float2 with x and y components in [-1, 1].
static bool isAction ( const std::string &  actionName,
const InputEvent inputEvent 
)
static

Checks whether the given input event matches the named action.

Parameters
actionNameName of a previously registered action.
inputEventConcrete input event to test.
Returns
True if inputEvent satisfies any entry of the action.
static bool isGamepad ( uint32  index)
static

Returns true if the device at index is recognized as a gamepad.

Parameters
indexIndex in range [0 .. getConnectedJoypads()).
Returns
True if the device is a gamepad; false otherwise.
static bool isGamepadButtonJustPressed ( GamepadButton  button)
static

Returns true on the frame the specified gamepad button is pressed.

static bool isGamepadButtonJustReleased ( GamepadButton  button)
static

Returns true on the frame the specified gamepad button is released.

static bool isGamepadButtonPressed ( uint32  index,
GamepadButton  gamepadButton 
)
static

Returns true while the given gamepad button is currently held down.

Parameters
indexIndex in range [0 .. getConnectedJoypads()).
gamepadButtonButton identifier.
Returns
True if the button is down; false otherwise.
static bool isKeyJustPressed ( Key  key)
static

Returns true only on the frame the user starts pressing the key. Subsequent frames while held return false until released and pressed again.

Parameters
keyLogical key code.
Returns
True on the rising edge (down transition) for this key.
static bool isKeyJustReleased ( Key  key)
static

Returns true only on the frame the user releases the key.

Parameters
keyLogical key code.
Returns
True on the falling edge (up transition) for this key.
static bool isKeyPressed ( Key  key)
static

Returns true while the given key is currently held down.

Parameters
keyLogical key code.
Returns
True if the key is down; false otherwise.
static bool isMouseButtonJustPressed ( MouseButton  mouseButton)
static

Returns true only on the frame the user starts pressing the mouse button.

Parameters
mouseButtonMouse button identifier.
Returns
True on the rising edge (down transition) for this button.
static bool isMouseButtonJustReleased ( MouseButton  mouseButton)
static

Returns true only on the frame the user releases the mouse button.

Parameters
mouseButtonMouse button identifier.
Returns
True on the falling edge (up transition) for this button.
static bool isMouseButtonPressed ( MouseButton  mouseButton)
static

Returns true while the given mouse button is currently held down.

Parameters
mouseButtonMouse button identifier.
Returns
True if the button is down; false otherwise.

Friends And Related Function Documentation

friend class Application
friend
friend class Window
friend