#include <sdlinput.hpp>
Inheritance diagram for gcn::SDLInput:
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< KeyInput > | mKeyInputQueue |
std::queue< MouseInput > | mMouseInputQueue |
bool | mMouseDown |
bool | mMouseInWindow |
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.
key | an SDL keysym |
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.
button | an SDL mouse button. |
Definition at line 191 of file sdlinput.cpp.
Referenced by pushInput().
KeyInput gcn::SDLInput::dequeueKeyInput | ( | ) | [virtual] |
Dequeues the key input queue.
Implements gcn::Input.
Definition at line 78 of file sdlinput.cpp.
References mKeyInputQueue.
MouseInput gcn::SDLInput::dequeueMouseInput | ( | ) | [virtual] |
Dequeues the mouse input queue.
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.
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.
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.
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.