Sleeping Wombat GUI  0.100
swGUI
Public Member Functions | Private Attributes | List of all members
sw::input::KeyboardDevice Class Reference

Keyboard state and events. More...

#include <KeyboardDevice.h>

Inheritance diagram for sw::input::KeyboardDevice:
sw::input::Device

Public Member Functions

 KeyboardDevice ()=default
 
 ~KeyboardDevice ()=default
 
const InputDeviceInfoGetInfo () const
 
const KeyboardStateGetState () const
 
EventQueue< DeviceEvent > & GetEventsQueue ()
 
void ApplyAllEvents ()
 
DeviceEvent ApplyNextEvent ()
 
Timestamp GetNextEvtTimestamp ()
 
void RemoveEvents ()
 
Functions for setting state (only for IInput)
void AddEvent (const DeviceEvent &event)
 Add event to event queue. This function doesn't change KeyboardState. More...
 
- Public Member Functions inherited from sw::input::Device
 Device ()=default
 
virtual ~Device ()=default
 

Private Attributes

InputDeviceInfo m_info
 
KeyboardState m_state
 
EventQueue< DeviceEventm_events
 

Detailed Description

Keyboard state and events.

There are 2 types of events for keyboard.

Although character events depend on physical input, there's no one to one relationship between them. Operating system processes characters in different manner. For example when you hold keyboard button with letter, it will be repeated multiple times, despite of the fact that it was clicked only once. Another examples are keys that give special meaning to buttons like shift or alt.

When you apply events to current KeyboardState only KeyEvents are processed and CharacterEvents are ignored. m_characters vector is usefull in case of GUI systems and text fields, where you don't want to translate keyboard state to letters by yourself.

Constructor & Destructor Documentation

sw::input::KeyboardDevice::KeyboardDevice ( )
explicitdefault
sw::input::KeyboardDevice::~KeyboardDevice ( )
default

Member Function Documentation

void sw::input::KeyboardDevice::AddEvent ( const DeviceEvent event)
inline

Add event to event queue. This function doesn't change KeyboardState.

void sw::input::KeyboardDevice::ApplyAllEvents ( )
inline
DeviceEvent sw::input::KeyboardDevice::ApplyNextEvent ( )
inline
EventQueue< DeviceEvent >& sw::input::KeyboardDevice::GetEventsQueue ( )
inline
const InputDeviceInfo& sw::input::KeyboardDevice::GetInfo ( ) const
inline
Timestamp sw::input::KeyboardDevice::GetNextEvtTimestamp ( )
inline
const KeyboardState& sw::input::KeyboardDevice::GetState ( ) const
inline
void sw::input::KeyboardDevice::RemoveEvents ( )
inline

Member Data Documentation

EventQueue< DeviceEvent > sw::input::KeyboardDevice::m_events
private
InputDeviceInfo sw::input::KeyboardDevice::m_info
private
KeyboardState sw::input::KeyboardDevice::m_state
private

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