gcn::SDLInput Class Reference

#include <sdlinput.hpp>

Inheritance diagram for gcn::SDLInput:

gcn::Input List of all members.

Detailed Description

SDL implementation of Input.

Definition at line 76 of file sdlinput.hpp.

Public Member Functions

 SDLInput ()
 Constructor.
virtual void pushInput (SDL_Event event)
 Pushes an SDL event.
virtual void _pollInput ()
 Polls all input.
virtual bool isKeyQueueEmpty ()
 Checks whether the key queue is empty or not.
virtual KeyInput dequeueKeyInput ()
 Dequeues the key input queue.
virtual bool isMouseQueueEmpty ()
 Checks whether the mouse queue is empyt or not.
virtual MouseInput dequeueMouseInput ()
 Dequeues the mouse input queue.

Protected Member Functions

int convertMouseButton (int button)
 Converts a mouse button from SDL to a Guichan mouse button representation.
Key convertKeyCharacter (SDL_keysym key)
 Converts an SDL keysym to a Key object.

Protected Attributes

std::queue< KeyInputmKeyInputQueue
std::queue< MouseInputmMouseInputQueue
bool mMouseDown
bool mMouseInWindow


Member Function Documentation

virtual void gcn::SDLInput::_pollInput (  )  [inline, virtual]

Polls all input.

It exists for input driver compatibility. If you only use SDL and plan sticking with SDL you can safely ignore this function as it in the SDL case does nothing.

Implements gcn::Input.

Definition at line 98 of file sdlinput.hpp.

Key gcn::SDLInput::convertKeyCharacter ( SDL_keysym  key  )  [protected]

Converts an SDL keysym to a Key object.

Parameters:
key an SDL keysym
Returns:
a Key object.

Definition at line 217 of file sdlinput.cpp.

References gcn::Key::setAltPressed(), gcn::Key::setControlPressed(), gcn::Key::setMetaPressed(), gcn::Key::setNumericPad(), gcn::Key::setShiftPressed(), and gcn::Key::setValue().

Referenced by pushInput().

int gcn::SDLInput::convertMouseButton ( int  button  )  [protected]

Converts a mouse button from SDL to a Guichan mouse button representation.

Parameters:
button an SDL mouse button.
Returns:
a Guichan mouse button.

Definition at line 191 of file sdlinput.cpp.

Referenced by pushInput().

KeyInput gcn::SDLInput::dequeueKeyInput (  )  [virtual]

Dequeues the key input queue.

Returns:
key input.

Implements gcn::Input.

Definition at line 78 of file sdlinput.cpp.

References mKeyInputQueue.

MouseInput gcn::SDLInput::dequeueMouseInput (  )  [virtual]

Dequeues the mouse input queue.

Returns:
mouse input.

Implements gcn::Input.

Definition at line 98 of file sdlinput.cpp.

References mMouseInputQueue.

bool gcn::SDLInput::isKeyQueueEmpty (  )  [virtual]

Checks whether the key queue is empty or not.

Returns:
true if the key queue is empty.

Implements gcn::Input.

Definition at line 73 of file sdlinput.cpp.

References mKeyInputQueue.

bool gcn::SDLInput::isMouseQueueEmpty (  )  [virtual]

Checks whether the mouse queue is empyt or not.

Returns:
true if the mouse queue is empty.

Implements gcn::Input.

Definition at line 93 of file sdlinput.cpp.

References mMouseInputQueue.

void gcn::SDLInput::pushInput ( SDL_Event  event  )  [virtual]

Pushes an SDL event.

It should be called at least once per frame to update input with user input.

Parameters:
event an event from SDL.

Definition at line 113 of file sdlinput.cpp.

References convertKeyCharacter(), convertMouseButton(), mKeyInputQueue, mMouseDown, mMouseInputQueue, mMouseInWindow, gcn::MouseInput::setButton(), gcn::KeyInput::setKey(), gcn::MouseInput::setTimeStamp(), gcn::MouseInput::setType(), gcn::KeyInput::setType(), gcn::MouseInput::x, and gcn::MouseInput::y.


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:49 2006 for Guichan by  doxygen 1.4.7