____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"#include <sdlinput.h>

Public Member Functions | |
| SDLInput () | |
| virtual void | pushInput (SDL_Event event) |
| virtual void | _pollInput () |
| virtual bool | isKeyQueueEmpty () |
| virtual KeyInput | dequeueKeyInput () |
| virtual bool | isMouseQueueEmpty () |
| virtual MouseInput | dequeueMouseInput () |
| virtual void | processKeyRepeat () |
Static Public Member Functions | |
| static Key | convertKeyCharacter (SDL_keysym key) |
Protected Member Functions | |
| int | convertMouseButton (int button) |
Protected Attributes | |
| std::queue< KeyInput > | mKeyInputQueue |
| std::queue< MouseInput > | mMouseInputQueue |
| bool | mMouseDown |
| bool | mMouseInWindow |
| Key | mLastKey |
| bool | mIsRepeating |
Definition at line 73 of file sdlinput.h.
| gcn::SDLInput::SDLInput | ( | ) |
Constructor.
Definition at line 64 of file sdlinput.cpp.
References mIsRepeating, mMouseDown, and mMouseInWindow.
| 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 122 of file sdlinput.cpp.
References convertKeyCharacter(), convertMouseButton(), gcn::MouseInput::EMPTY, mIsRepeating, mKeyInputQueue, mLastKey, mMouseDown, mMouseInputQueue, mMouseInWindow, gcn::MouseInput::MOTION, gcn::MouseInput::PRESS, gcn::KeyInput::PRESS, gcn::MouseInput::RELEASE, gcn::KeyInput::RELEASE, gcn::MouseInput::setButton(), gcn::KeyInput::setKey(), gcn::MouseInput::setTimeStamp(), gcn::MouseInput::setType(), gcn::KeyInput::setType(), gcn::MouseInput::x, and gcn::MouseInput::y.
Referenced by handleInput().
| 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 95 of file sdlinput.h.
| bool gcn::SDLInput::isKeyQueueEmpty | ( | ) | [virtual] |
Checks whether the key queue is empty or not.
Implements gcn::Input.
Definition at line 71 of file sdlinput.cpp.
References mKeyInputQueue.
| KeyInput gcn::SDLInput::dequeueKeyInput | ( | ) | [virtual] |
Dequeues the key input queue.
Implements gcn::Input.
Definition at line 76 of file sdlinput.cpp.
References GCN_EXCEPTION, and mKeyInputQueue.
| bool gcn::SDLInput::isMouseQueueEmpty | ( | ) | [virtual] |
Checks whether the mouse queue is empyt or not.
Implements gcn::Input.
Definition at line 91 of file sdlinput.cpp.
References mMouseInputQueue.
| MouseInput gcn::SDLInput::dequeueMouseInput | ( | ) | [virtual] |
Dequeues the mouse input queue.
Implements gcn::Input.
Definition at line 96 of file sdlinput.cpp.
References GCN_EXCEPTION, and mMouseInputQueue.
| void gcn::SDLInput::processKeyRepeat | ( | ) | [virtual] |
Definition at line 111 of file sdlinput.cpp.
References mIsRepeating, mKeyInputQueue, mLastKey, gcn::KeyInput::PRESS, gcn::KeyInput::setKey(), and gcn::KeyInput::setType().
Referenced by MenuHandleKeyRepeat().
| Key gcn::SDLInput::convertKeyCharacter | ( | SDL_keysym | key | ) | [static] |
Converts an SDL keysym to a Key object.
| key | an SDL keysym |
Definition at line 229 of file sdlinput.cpp.
References gcn::Key::ALT_GR, gcn::Key::BACKSPACE, gcn::Key::CAPS_LOCK, gcn::Key::DELETE, gcn::Key::DOWN, gcn::Key::END, gcn::Key::ENTER, gcn::Key::ESCAPE, gcn::Key::F1, gcn::Key::F10, gcn::Key::F11, gcn::Key::F12, gcn::Key::F13, gcn::Key::F14, gcn::Key::F15, gcn::Key::F2, gcn::Key::F3, gcn::Key::F4, gcn::Key::F5, gcn::Key::F6, gcn::Key::F7, gcn::Key::F8, gcn::Key::F9, gcn::Key::HOME, gcn::Key::INSERT, int(), gcn::Key::LEFT, gcn::Key::LEFT_ALT, gcn::Key::LEFT_CONTROL, gcn::Key::LEFT_META, gcn::Key::LEFT_SHIFT, gcn::Key::LEFT_SUPER, gcn::Key::NUM_LOCK, gcn::Key::PAGE_DOWN, gcn::Key::PAGE_UP, gcn::Key::PAUSE, gcn::Key::PRINT_SCREEN, gcn::Key::RIGHT, gcn::Key::RIGHT_ALT, gcn::Key::RIGHT_CONTROL, gcn::Key::RIGHT_META, gcn::Key::RIGHT_SHIFT, gcn::Key::RIGHT_SUPER, gcn::Key::SCROLL_LOCK, gcn::Key::setAltPressed(), gcn::Key::setControlPressed(), gcn::Key::setMetaPressed(), gcn::Key::setNumericPad(), gcn::Key::setShiftPressed(), gcn::Key::setValue(), gcn::Key::SPACE, gcn::Key::TAB, and gcn::Key::UP.
Referenced by convertKey(), CButtonPanel::DoKey(), and 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 203 of file sdlinput.cpp.
References GCN_EXCEPTION, gcn::MouseInput::LEFT, gcn::MouseInput::MIDDLE, gcn::MouseInput::RIGHT, gcn::MouseInput::WHEEL_DOWN, and gcn::MouseInput::WHEEL_UP.
Referenced by pushInput().
std::queue<KeyInput> gcn::SDLInput::mKeyInputQueue [protected] |
Definition at line 128 of file sdlinput.h.
Referenced by dequeueKeyInput(), isKeyQueueEmpty(), processKeyRepeat(), and pushInput().
std::queue<MouseInput> gcn::SDLInput::mMouseInputQueue [protected] |
Definition at line 129 of file sdlinput.h.
Referenced by dequeueMouseInput(), isMouseQueueEmpty(), and pushInput().
bool gcn::SDLInput::mMouseDown [protected] |
bool gcn::SDLInput::mMouseInWindow [protected] |
Key gcn::SDLInput::mLastKey [protected] |
bool gcn::SDLInput::mIsRepeating [protected] |
Definition at line 134 of file sdlinput.h.
Referenced by processKeyRepeat(), pushInput(), and SDLInput().
1.5.6