nCine  2025.04.r498-9d36345
A cross-platform 2D game engine
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
ncine::IInputManager Class Referenceabstract

The interface class for parsing and dispatching input events. More...

#include <IInputManager.h>

Collaboration diagram for ncine::IInputManager:
Collaboration graph
[legend]

Public Types

enum class  MouseCursorMode { NORMAL , HIDDEN , DISABLED }
 

Public Member Functions

virtual const MouseStatemouseState () const =0
 Returns current mouse state.
 
virtual const KeyboardStatekeyboardState () const =0
 Returns current keyboard state.
 
virtual bool isJoyPresent (int joyId) const =0
 Returns true if the specified joystick is connected.
 
virtual const char * joyName (int joyId) const =0
 Returns the name of the specified joystick.
 
virtual const char * joyGuid (int joyId) const =0
 Returns the GUID of the specified joystick.
 
virtual int joyNumButtons (int joyId) const =0
 Returns the number of available buttons for the specified joystick.
 
virtual int joyNumHats (int joyId) const =0
 Returns the number of available hats for the specified joystick.
 
virtual int joyNumAxes (int joyId) const =0
 Returns the number of available axes for the specified joystick.
 
virtual const JoystickStatejoystickState (int joyId) const =0
 Returns the state of the joystick.
 
bool isJoyMapped (int joyId) const
 Returns true if the joystick has a valid mapping configuration. More...
 
const JoyMappedStatejoyMappedState (int joyId) const
 Returns the state of the mapped joystick.
 
void deadZoneNormalize (Vector2f &joyVector, float deadZoneValue) const
 Modifies the joystick axis vector to account for a dead zone.
 
void addJoyMappingsFromFile (const char *filename)
 Adds joystick mapping configurations from a text file.
 
void addJoyMappingsFromStrings (const char **mappingStrings)
 Adds joystick mapping configurations from a strings array terminated by a nullptr
 
unsigned int numJoyMappings () const
 Returns the current number of valid joystick mappings.
 
virtual bool hasJoyVibration (int joyId) const =0
 Returns true if the specified joystick supports vibration.
 
virtual void joyVibrate (int joyId, float lowFreqIntensity, float highFreqIntensity, unsigned int duration) const =0
 Vibrates the low (left) and high (right) frequency motors for the specified number of milliseconds. More...
 
MouseCursorMode mouseCursorMode () const
 Returns current mouse cursor mode.
 
virtual void setMouseCursorMode (MouseCursorMode mode)
 Sets the mouse cursor mode.
 

Static Public Member Functions

static IInputEventHandlerhandler ()
 Gets the current input event handler for the manager.
 
static void setHandler (IInputEventHandler *inputEventHandler)
 Sets the input event handler for the manager.
 

Static Public Attributes

static const int MaxNumJoysticks = 4
 
static const short int MaxAxisValue = 32767
 
static const unsigned short int MaxVibrationValue = 255
 The maximum vibration value supported by the backend. More...
 
static const float LeftStickDeadZone = 7849 / 32767.0f
 
static const float RightStickDeadZone = 8689 / 32767.0f
 
static const float TriggerDeadZone = 30 / 32767.0f
 

Static Protected Attributes

static IInputEventHandlerinputEventHandler_ = nullptr
 
static MouseCursorMode mouseCursorMode_ = IInputManager::MouseCursorMode::NORMAL
 
static JoyMapping joyMapping_
 
static DropEvent dropEvent_
 

Detailed Description

The interface class for parsing and dispatching input events.

Member Enumeration Documentation

◆ MouseCursorMode

Enumerator
NORMAL 

Mouse cursor behaves normally.

HIDDEN 

Mouse cursor is hidden but behaves normally.

DISABLED 

Mouse cursor is hidden and locked to the window.

Note
Mouse movement will be relative if supported (with no acceleration and no scaling)

Member Function Documentation

◆ isJoyMapped()

bool ncine::IInputManager::isJoyMapped ( int  joyId) const

Returns true if the joystick has a valid mapping configuration.

Note
Joystick will stay mapped in theonJoyConnected() and onJoyDisconnected() callbacks

◆ joyVibrate()

virtual void ncine::IInputManager::joyVibrate ( int  joyId,
float  lowFreqIntensity,
float  highFreqIntensity,
unsigned int  duration 
) const
pure virtual

Vibrates the low (left) and high (right) frequency motors for the specified number of milliseconds.

Note
Intensity goes from 0 to 1. Each call to this function cancels any previous vibration effect, and calling it with zero intensity stops any vibrations.

Member Data Documentation

◆ MaxVibrationValue

const unsigned short int ncine::IInputManager::MaxVibrationValue = 255
static

The maximum vibration value supported by the backend.

Note
The reciprocal of this number can be used as the vibration resolution value.

The documentation for this class was generated from the following files: