DDraceNetwork Docs
CInput Class Reference

#include <input.h>

Inheritance diagram for CInput:
[legend]
Collaboration diagram for CInput:
[legend]

Classes

class  CJoystick
 

Public Member Functions

 CInput ()
 
void Init () override
 
int Update () override
 
void Shutdown () override
 
void ConsumeEvents (std::function< void(const CEvent &Event)> Consumer) const override
 
void Clear () override
 
float GetUpdateTime () const override
 
bool ModifierIsPressed () const override
 
bool ShiftIsPressed () const override
 
bool AltIsPressed () const override
 
bool KeyIsPressed (int Key) const override
 
bool KeyPress (int Key, bool CheckCounter) const override
 
int FindKeyByName (const char *pKeyName) const override
 
size_t NumJoysticks () const override
 
CJoystickGetJoystick (size_t Index) override
 
CJoystickGetActiveJoystick () override
 
void SetActiveJoystick (size_t Index) override
 
bool MouseRelative (float *pX, float *pY) override
 
void MouseModeAbsolute () override
 
void MouseModeRelative () override
 
vec2 NativeMousePos () const override
 
bool NativeMousePressed (int Index) const override
 
const std::vector< CTouchFingerState > & TouchFingerStates () const override
 
std::string GetClipboardText () override
 
void SetClipboardText (const char *pText) override
 
void StartTextInput () override
 
void StopTextInput () override
 
const char * GetComposition () const override
 
bool HasComposition () const override
 
int GetCompositionCursor () const override
 
int GetCompositionLength () const override
 
const char * GetCandidate (int Index) const override
 
int GetCandidateCount () const override
 
int GetCandidateSelectedIndex () const override
 
void SetCompositionWindowPosition (float X, float Y, float H) override
 
bool GetDropFile (char *aBuf, int Len) override
 
virtual void Init ()=0
 
virtual void Shutdown () override=0
 
virtual int Update ()=0
 
- Public Member Functions inherited from IInput
virtual void ConsumeEvents (std::function< void(const CEvent &Event)> Consumer) const =0
 
virtual void Clear ()=0
 
virtual float GetUpdateTime () const =0
 
virtual bool ModifierIsPressed () const =0
 
virtual bool ShiftIsPressed () const =0
 
virtual bool AltIsPressed () const =0
 
virtual bool KeyIsPressed (int Key) const =0
 
virtual bool KeyPress (int Key, bool CheckCounter=false) const =0
 
const char * KeyName (int Key) const
 
virtual int FindKeyByName (const char *pKeyName) const =0
 
virtual size_t NumJoysticks () const =0
 
virtual IJoystickGetJoystick (size_t Index)=0
 
virtual IJoystickGetActiveJoystick ()=0
 
virtual void SetActiveJoystick (size_t Index)=0
 
virtual vec2 NativeMousePos () const =0
 
virtual bool NativeMousePressed (int Index) const =0
 
virtual void MouseModeRelative ()=0
 
virtual void MouseModeAbsolute ()=0
 
virtual bool MouseRelative (float *pX, float *pY)=0
 
virtual const std::vector< CTouchFingerState > & TouchFingerStates () const =0
 
virtual std::string GetClipboardText ()=0
 
virtual void SetClipboardText (const char *pText)=0
 
virtual void StartTextInput ()=0
 
virtual void StopTextInput ()=0
 
virtual const char * GetComposition () const =0
 
virtual bool HasComposition () const =0
 
virtual int GetCompositionCursor () const =0
 
virtual int GetCompositionLength () const =0
 
virtual const char * GetCandidate (int Index) const =0
 
virtual int GetCandidateCount () const =0
 
virtual int GetCandidateSelectedIndex () const =0
 
virtual void SetCompositionWindowPosition (float X, float Y, float H)=0
 
virtual bool GetDropFile (char *aBuf, int Len)=0
 
ECursorType CursorRelative (float *pX, float *pY)
 
- Public Member Functions inherited from IInterface
 IInterface ()
 
virtual void Shutdown ()
 
virtual ~IInterface ()
 

Private Member Functions

IEngineGraphicsGraphics () const
 
IConsoleConsole () const
 
void InitJoysticks ()
 
bool OpenJoystick (int JoystickIndex)
 
void CloseJoysticks ()
 
void UpdateActiveJoystick ()
 
float GetJoystickDeadzone ()
 
void AddKeyEvent (int Key, int Flags)
 
void AddTextEvent (const char *pText)
 
void UpdateMouseState ()
 
void UpdateJoystickState ()
 
void HandleJoystickAxisMotionEvent (const SDL_JoyAxisEvent &Event)
 
void HandleJoystickButtonEvent (const SDL_JoyButtonEvent &Event)
 
void HandleJoystickHatMotionEvent (const SDL_JoyHatEvent &Event)
 
void HandleJoystickAddedEvent (const SDL_JoyDeviceEvent &Event)
 
void HandleJoystickRemovedEvent (const SDL_JoyDeviceEvent &Event)
 
void HandleTouchDownEvent (const SDL_TouchFingerEvent &Event)
 
void HandleTouchUpEvent (const SDL_TouchFingerEvent &Event)
 
void HandleTouchMotionEvent (const SDL_TouchFingerEvent &Event)
 
void HandleTextEditingEvent (const char *pText, int Start, int Length)
 
bool KeyState (int Key) const
 
void ProcessSystemMessage (SDL_SysWMmsg *pMsg)
 

Static Private Member Functions

static void ConchainJoystickGuidChanged (IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
 

Private Attributes

IEngineGraphicsm_pGraphics
 
IConsolem_pConsole
 
IConfigManagerm_pConfigManager
 
std::vector< CJoystickm_vJoysticks
 
CJoystickm_pActiveJoystick = nullptr
 
bool m_InputGrabbed
 
bool m_MouseFocus
 
std::string m_CompositionString
 
int m_CompositionCursor
 
std::vector< std::string > m_vCandidates
 
int m_CandidateSelectedIndex
 
std::vector< CEventm_vInputEvents
 
int64_t m_LastUpdate
 
float m_UpdateTime
 
uint32_t m_aInputCount [g_MaxKeys]
 
unsigned char m_aInputState [g_MaxKeys]
 
uint32_t m_InputCounter
 
std::vector< CTouchFingerStatem_vTouchFingerStates
 
char m_aDropFile [IO_MAX_PATH_LENGTH]
 

Additional Inherited Members

- Public Types inherited from IInput
enum  { FLAG_PRESS = 1 << 0 , FLAG_RELEASE = 1 << 1 , FLAG_TEXT = 1 << 2 }
 
enum  ECursorType { CURSOR_NONE , CURSOR_MOUSE , CURSOR_JOYSTICK }
 
- Static Public Member Functions inherited from IEngineInput
static const char * InterfaceName ()
 
- Static Public Member Functions inherited from IInput
static const char * InterfaceName ()
 
- Protected Member Functions inherited from IInterface
IKernelKernel ()
 

Constructor & Destructor Documentation

◆ CInput()

CInput::CInput ( )

Member Function Documentation

◆ AddKeyEvent()

void CInput::AddKeyEvent ( int  Key,
int  Flags 
)
private

◆ AddTextEvent()

void CInput::AddTextEvent ( const char *  pText)
private

◆ AltIsPressed()

bool CInput::AltIsPressed ( ) const
inlineoverridevirtual

Implements IInput.

◆ Clear()

void CInput::Clear ( )
overridevirtual

Implements IInput.

◆ CloseJoysticks()

void CInput::CloseJoysticks ( )
private

◆ ConchainJoystickGuidChanged()

void CInput::ConchainJoystickGuidChanged ( IConsole::IResult pResult,
void *  pUserData,
IConsole::FCommandCallback  pfnCallback,
void *  pCallbackUserData 
)
staticprivate

◆ Console()

IConsole * CInput::Console ( ) const
inlineprivate

◆ ConsumeEvents()

void CInput::ConsumeEvents ( std::function< void(const CEvent &Event)>  Consumer) const
overridevirtual

Implements IInput.

◆ FindKeyByName()

int CInput::FindKeyByName ( const char *  pKeyName) const
overridevirtual

Implements IInput.

◆ GetActiveJoystick()

CJoystick * CInput::GetActiveJoystick ( )
inlineoverridevirtual

Implements IInput.

◆ GetCandidate()

const char * CInput::GetCandidate ( int  Index) const
inlineoverridevirtual

Implements IInput.

◆ GetCandidateCount()

int CInput::GetCandidateCount ( ) const
inlineoverridevirtual

Implements IInput.

◆ GetCandidateSelectedIndex()

int CInput::GetCandidateSelectedIndex ( ) const
inlineoverridevirtual

Implements IInput.

◆ GetClipboardText()

std::string CInput::GetClipboardText ( )
overridevirtual

Implements IInput.

◆ GetComposition()

const char * CInput::GetComposition ( ) const
inlineoverridevirtual

Implements IInput.

◆ GetCompositionCursor()

int CInput::GetCompositionCursor ( ) const
inlineoverridevirtual

Implements IInput.

◆ GetCompositionLength()

int CInput::GetCompositionLength ( ) const
inlineoverridevirtual

Implements IInput.

◆ GetDropFile()

bool CInput::GetDropFile ( char *  aBuf,
int  Len 
)
overridevirtual

Implements IInput.

◆ GetJoystick()

CJoystick * CInput::GetJoystick ( size_t  Index)
inlineoverridevirtual

Implements IInput.

◆ GetJoystickDeadzone()

float CInput::GetJoystickDeadzone ( )
private

◆ GetUpdateTime()

float CInput::GetUpdateTime ( ) const
overridevirtual
Returns
Rolling average of the time in seconds between calls of the Update function.

Implements IInput.

◆ Graphics()

IEngineGraphics * CInput::Graphics ( ) const
inlineprivate

◆ HandleJoystickAddedEvent()

void CInput::HandleJoystickAddedEvent ( const SDL_JoyDeviceEvent &  Event)
private

◆ HandleJoystickAxisMotionEvent()

void CInput::HandleJoystickAxisMotionEvent ( const SDL_JoyAxisEvent &  Event)
private

◆ HandleJoystickButtonEvent()

void CInput::HandleJoystickButtonEvent ( const SDL_JoyButtonEvent &  Event)
private

◆ HandleJoystickHatMotionEvent()

void CInput::HandleJoystickHatMotionEvent ( const SDL_JoyHatEvent &  Event)
private

◆ HandleJoystickRemovedEvent()

void CInput::HandleJoystickRemovedEvent ( const SDL_JoyDeviceEvent &  Event)
private

◆ HandleTextEditingEvent()

void CInput::HandleTextEditingEvent ( const char *  pText,
int  Start,
int  Length 
)
private

◆ HandleTouchDownEvent()

void CInput::HandleTouchDownEvent ( const SDL_TouchFingerEvent &  Event)
private

◆ HandleTouchMotionEvent()

void CInput::HandleTouchMotionEvent ( const SDL_TouchFingerEvent &  Event)
private

◆ HandleTouchUpEvent()

void CInput::HandleTouchUpEvent ( const SDL_TouchFingerEvent &  Event)
private

◆ HasComposition()

bool CInput::HasComposition ( ) const
inlineoverridevirtual

Implements IInput.

◆ Init()

void CInput::Init ( )
overridevirtual

Implements IEngineInput.

◆ InitJoysticks()

void CInput::InitJoysticks ( )
private

◆ KeyIsPressed()

bool CInput::KeyIsPressed ( int  Key) const
inlineoverridevirtual

Implements IInput.

◆ KeyPress()

bool CInput::KeyPress ( int  Key,
bool  CheckCounter 
) const
inlineoverridevirtual

Implements IInput.

◆ KeyState()

bool CInput::KeyState ( int  Key) const
private

◆ ModifierIsPressed()

bool CInput::ModifierIsPressed ( ) const
inlineoverridevirtual

Implements IInput.

◆ MouseModeAbsolute()

void CInput::MouseModeAbsolute ( )
overridevirtual

Implements IInput.

◆ MouseModeRelative()

void CInput::MouseModeRelative ( )
overridevirtual

Implements IInput.

◆ MouseRelative()

bool CInput::MouseRelative ( float *  pX,
float *  pY 
)
overridevirtual

Implements IInput.

◆ NativeMousePos()

vec2 CInput::NativeMousePos ( ) const
overridevirtual

Implements IInput.

◆ NativeMousePressed()

bool CInput::NativeMousePressed ( int  Index) const
overridevirtual

Implements IInput.

◆ NumJoysticks()

size_t CInput::NumJoysticks ( ) const
inlineoverridevirtual

Implements IInput.

◆ OpenJoystick()

bool CInput::OpenJoystick ( int  JoystickIndex)
private

◆ ProcessSystemMessage()

void CInput::ProcessSystemMessage ( SDL_SysWMmsg *  pMsg)
private

◆ SetActiveJoystick()

void CInput::SetActiveJoystick ( size_t  Index)
overridevirtual

Implements IInput.

◆ SetClipboardText()

void CInput::SetClipboardText ( const char *  pText)
overridevirtual

Implements IInput.

◆ SetCompositionWindowPosition()

void CInput::SetCompositionWindowPosition ( float  X,
float  Y,
float  H 
)
overridevirtual

Implements IInput.

◆ ShiftIsPressed()

bool CInput::ShiftIsPressed ( ) const
inlineoverridevirtual

Implements IInput.

◆ Shutdown()

void CInput::Shutdown ( )
overridevirtual

Implements IEngineInput.

◆ StartTextInput()

void CInput::StartTextInput ( )
overridevirtual

Implements IInput.

◆ StopTextInput()

void CInput::StopTextInput ( )
overridevirtual

Implements IInput.

◆ TouchFingerStates()

const std::vector< IInput::CTouchFingerState > & CInput::TouchFingerStates ( ) const
overridevirtual

Returns a vector of the states of all touch fingers currently being pressed down on touch devices. Note that this only contains fingers which are pressed down, i.e. released fingers are never stored. The order of the fingers in this vector is based on the order in which the fingers where pressed.

Returns
vector of all touch finger states

Implements IInput.

◆ Update()

int CInput::Update ( )
overridevirtual

Implements IEngineInput.

◆ UpdateActiveJoystick()

void CInput::UpdateActiveJoystick ( )
private

◆ UpdateJoystickState()

void CInput::UpdateJoystickState ( )
private

◆ UpdateMouseState()

void CInput::UpdateMouseState ( )
private

Member Data Documentation

◆ m_aDropFile

char CInput::m_aDropFile[IO_MAX_PATH_LENGTH]
private

◆ m_aInputCount

uint32_t CInput::m_aInputCount[g_MaxKeys]
private

◆ m_aInputState

unsigned char CInput::m_aInputState[g_MaxKeys]
private

◆ m_CandidateSelectedIndex

int CInput::m_CandidateSelectedIndex
private

◆ m_CompositionCursor

int CInput::m_CompositionCursor
private

◆ m_CompositionString

std::string CInput::m_CompositionString
private

◆ m_InputCounter

uint32_t CInput::m_InputCounter
private

◆ m_InputGrabbed

bool CInput::m_InputGrabbed
private

◆ m_LastUpdate

int64_t CInput::m_LastUpdate
private

◆ m_MouseFocus

bool CInput::m_MouseFocus
private

◆ m_pActiveJoystick

CJoystick* CInput::m_pActiveJoystick = nullptr
private

◆ m_pConfigManager

IConfigManager* CInput::m_pConfigManager
private

◆ m_pConsole

IConsole* CInput::m_pConsole
private

◆ m_pGraphics

IEngineGraphics* CInput::m_pGraphics
private

◆ m_UpdateTime

float CInput::m_UpdateTime
private

◆ m_vCandidates

std::vector<std::string> CInput::m_vCandidates
private

◆ m_vInputEvents

std::vector<CEvent> CInput::m_vInputEvents
private

◆ m_vJoysticks

std::vector<CJoystick> CInput::m_vJoysticks
private

◆ m_vTouchFingerStates

std::vector<CTouchFingerState> CInput::m_vTouchFingerStates
private

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