Colobot
Loading...
Searching...
No Matches
CInput Class Reference

Management of mouse, keyboard and joystick. More...

#include <src/app/input.h>

Inheritance diagram for CInput:

Public Member Functions

 CInput ()
 Constructor.
void EventProcess (Event &event)
 Process an incoming event, also sets .kmodState, .mousePos, .mouseButtonsState and .key.slot.
void MouseMove (Math::IntPoint pos)
 Called by CApplication on SDL MOUSE_MOTION event.
bool GetKeyState (InputSlot key) const
 Returns whether the key is pressed.
bool GetMouseButtonState (int index) const
 Returns whether the mouse button is pressed.
void ResetKeyStates ()
 Resets tracked key states and modifiers.
Math::Point GetMousePos () const
 Returns the position of mouse cursor (in interface coords).
void SetDefaultInputBindings ()
 Sets the default input bindings (keys and joystick axes).
void SetInputBinding (InputSlot slot, InputBinding binding)
 Management of input bindings.
const InputBindingGetInputBinding (InputSlot slot)
void SetJoyAxisBinding (JoyAxisSlot slot, JoyAxisBinding binding)
 Management of joystick axis bindings.
const JoyAxisBindingGetJoyAxisBinding (JoyAxisSlot slot)
void SetJoystickDeadzone (float zone)
 Management of joystick deadzone.
float GetJoystickDeadzone ()
InputSlot FindBinding (unsigned int key)
 Get binding slot for given key.
void SaveKeyBindings ()
 Saving/loading key bindings to colobot.ini.
void LoadKeyBindings ()
InputSlot SearchKeyById (std::string id)
 Seeks a InputSlot by id. Returns INPUT_SLOT_MAX if not found.
std::string GetKeysString (InputBinding binding)
 Returns string describing keys to be pressed.
std::string GetKeysString (InputSlot slot)

Additional Inherited Members

Static Public Member Functions inherited from CSingleton< CInput >
static CInputGetInstance ()
static CInputGetInstancePointer ()
static bool IsCreated ()
Static Protected Attributes inherited from CSingleton< CInput >
static CInputm_instance

Detailed Description

Management of mouse, keyboard and joystick.

Constructor & Destructor Documentation

◆ CInput()

CInput::CInput ( )

Constructor.

Member Function Documentation

◆ EventProcess()

void CInput::EventProcess ( Event & event)

Process an incoming event, also sets .kmodState, .mousePos, .mouseButtonsState and .key.slot.

◆ MouseMove()

void CInput::MouseMove ( Math::IntPoint pos)

Called by CApplication on SDL MOUSE_MOTION event.

◆ GetKeyState()

bool CInput::GetKeyState ( InputSlot key) const

Returns whether the key is pressed.

◆ GetMouseButtonState()

bool CInput::GetMouseButtonState ( int index) const

Returns whether the mouse button is pressed.

◆ ResetKeyStates()

void CInput::ResetKeyStates ( )

Resets tracked key states and modifiers.

◆ GetMousePos()

Math::Point CInput::GetMousePos ( ) const

Returns the position of mouse cursor (in interface coords).

◆ SetDefaultInputBindings()

void CInput::SetDefaultInputBindings ( )

Sets the default input bindings (keys and joystick axes).

◆ SetInputBinding()

void CInput::SetInputBinding ( InputSlot slot,
InputBinding binding )

Management of input bindings.

◆ SetJoyAxisBinding()

void CInput::SetJoyAxisBinding ( JoyAxisSlot slot,
JoyAxisBinding binding )

Management of joystick axis bindings.

◆ SetJoystickDeadzone()

void CInput::SetJoystickDeadzone ( float zone)

Management of joystick deadzone.

◆ FindBinding()

InputSlot CInput::FindBinding ( unsigned int key)

Get binding slot for given key.

◆ SaveKeyBindings()

void CInput::SaveKeyBindings ( )

Saving/loading key bindings to colobot.ini.

◆ SearchKeyById()

InputSlot CInput::SearchKeyById ( std::string id)

Seeks a InputSlot by id. Returns INPUT_SLOT_MAX if not found.

◆ GetKeysString()

std::string CInput::GetKeysString ( InputBinding binding)

Returns string describing keys to be pressed.


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