Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
inexor::io::InputRouter Class Reference

Forwards input events to the subsystem they are needed. More...

#include <InputRouter.hpp>

Public Member Functions

 InputRouter ()
 
virtual ~InputRouter ()
 
void keyrepeat (bool on, int mask)
 Check if key was pressed repeatedly using bit masking technique. More...
 
void inputgrab ()
 Do grab the input depending on the current grab mode. More...
 
void set_grab_input (bool grab_input)
 Sets input grab mode for mouse and keyboard. More...
 
bool interceptkey (int sym)
 "abort" key to interrupt updating the masterlist, connecting to a server or computing lightmaps More...
 
void ignoremousemotion ()
 
void checkinput ()
 Periodically checking for new input. More...
 

Public Attributes

bool relativemouse
 

Private Member Functions

void pushevent (const SDL_Event &e)
 add a new event to event vector More...
 
bool filterevent (const SDL_Event &event)
 filter mouse motion events depending on operating system More...
 
bool pollevent (SDL_Event &event)
 poll and filter all events in the SDL (input) event queue More...
 
void resetmousemotion ()
 move mouse to screen center More...
 
void checkmousemotion (int &dx, int &dy)
 handle mouse motion coordinates More...
 

Private Attributes

std::vector< SDL_Event > events
 global vector for input events More...
 
bool shouldgrab
 controlling input devices using Simple DirectMedia Layer More...
 
bool grabinput
 
bool canrelativemouse
 
int keyrepeatmask
 key repetition is stored in bit masks More...
 
int textinputmask
 text input state is also stored in bit masks More...
 

Detailed Description

Forwards input events to the subsystem they are needed.

Constructor & Destructor Documentation

inexor::io::InputRouter::InputRouter ( )
inexor::io::InputRouter::~InputRouter ( )
virtual

Member Function Documentation

void inexor::io::InputRouter::checkinput ( )
void inexor::io::InputRouter::checkmousemotion ( int &  dx,
int &  dy 
)
private

handle mouse motion coordinates

Returns
deltax and deltay (the difference of the mouse coords)

References events, and pollevent().

Referenced by checkinput().

bool inexor::io::InputRouter::filterevent ( const SDL_Event &  event)
private
void inexor::io::InputRouter::ignoremousemotion ( )

pumps the event loop, gathering events from the input devices.

check the event queue for messages and optionally return them

Referenced by main().

void inexor::io::InputRouter::inputgrab ( )
bool inexor::io::InputRouter::interceptkey ( int  sym)

"abort" key to interrupt updating the masterlist, connecting to a server or computing lightmaps

ignore mouse motion events during loading processes

References events, pollevent(), and pushevent().

Referenced by check_calclight_canceled(), resolverwait(), and show_genpvs_progress().

void inexor::io::InputRouter::keyrepeat ( bool  on,
int  mask 
)

Check if key was pressed repeatedly using bit masking technique.

References keyrepeatmask.

Referenced by g3d_render(), inputcommand(), and toggleedit().

bool inexor::io::InputRouter::pollevent ( SDL_Event &  event)
private

poll and filter all events in the SDL (input) event queue

See Also
SDL_PollEvent
filterevent

References filterevent().

Referenced by checkinput(), checkmousemotion(), and interceptkey().

void inexor::io::InputRouter::pushevent ( const SDL_Event &  e)
private

add a new event to event vector

References events.

Referenced by interceptkey().

void inexor::io::InputRouter::resetmousemotion ( )
private
void inexor::io::InputRouter::set_grab_input ( bool  grab_input)

Sets input grab mode for mouse and keyboard.

References grabinput.

Referenced by checkinput(), and main().

Member Data Documentation

bool inexor::io::InputRouter::canrelativemouse
private

Referenced by inputgrab().

std::vector<SDL_Event> inexor::io::InputRouter::events
private

global vector for input events

Referenced by checkinput(), checkmousemotion(), interceptkey(), and pushevent().

bool inexor::io::InputRouter::grabinput
private
int inexor::io::InputRouter::keyrepeatmask
private

key repetition is stored in bit masks

Referenced by checkinput(), and keyrepeat().

bool inexor::io::InputRouter::relativemouse
bool inexor::io::InputRouter::shouldgrab
private

controlling input devices using Simple DirectMedia Layer

Referenced by checkinput(), and inputgrab().

int inexor::io::InputRouter::textinputmask
private

text input state is also stored in bit masks


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