#include <src/core/input/InputBuffer.h>
Public Member Functions | |
void | clear (bool update=true) |
void | decreaseCursor () |
const std::string & | get () const |
unsigned int | getCursorPosition () const |
unsigned int | getSize () const |
void | increaseCursor () |
InputBuffer (const std::string &allowedChars) | |
InputBuffer () | |
void | insert (const char &input, bool update=true) |
void | insert (const std::string &input, bool update=true) |
template<class T> | |
void | registerListener (T *listener, void(T::*function)() const, KeyCode::ByEnum key) |
template<class T> | |
void | registerListener (T *listener, void(T::*function)(), KeyCode::ByEnum key) |
template<class T> | |
void | registerListener (T *listener, void(T::*function)() const, char _char, bool bOnlySingleInput) |
template<class T> | |
void | registerListener (T *listener, void(T::*function)(), char _char, bool bOnlySingleInput) |
template<class T> | |
void | registerListener (T *listener, void(T::*function)() const, bool bOnlySingleInput) |
template<class T> | |
void | registerListener (T *listener, void(T::*function)(), bool bOnlySingleInput) |
void | removeAtCursor (bool update=true) |
void | removeBehindCursor (bool update=true) |
void | set (const std::string &input, bool update=true) |
void | setConfigValues () |
Function to collect the SetConfigValue-macro calls. | |
void | setCursorPosition (unsigned int cursor) |
void | setCursorToBegin () |
void | setCursorToEnd () |
template<class T> | |
void | unregisterListener (T *listener) |
void | updated (const char &update, bool bSingleInput) |
void | updated () |
~InputBuffer () | |
Private Member Functions | |
bool | charIsAllowed (const char &input) |
void | keyHeld (const KeyEvent &evt) |
void | keyPressed (const KeyEvent &evt) |
void | keyReleased (const KeyEvent &evt) |
void | processKey (const KeyEvent &e) |
void | updateInput (float dt) |
This update() function is called by the InputManager if the InputBuffer is active. | |
void | updateKey (float dt) |
Private Attributes | |
std::string | allowedChars_ |
std::string | buffer_ |
unsigned int | cursor_ |
float | keyRepeatDeleay_ |
float | keyRepeatTime_ |
int | keysToRepeat_ |
KeyCode::ByEnum | lastKey_ |
std::list < BaseInputBufferListenerTuple * > | listeners_ |
float | timeSinceKeyPressed_ |
float | timeSinceKeyRepeated_ |
orxonox::InputBuffer::InputBuffer | ( | ) |
orxonox::InputBuffer::~InputBuffer | ( | ) |
References listeners_.
orxonox::InputBuffer::InputBuffer | ( | const std::string & | allowedChars | ) |
bool orxonox::InputBuffer::charIsAllowed | ( | const char & | input | ) | [private] |
void orxonox::InputBuffer::clear | ( | bool | update = true |
) |
References buffer_, cursor_, and updated().
Referenced by orxonox::Shell::clear(), processKey(), and set().
void orxonox::InputBuffer::decreaseCursor | ( | ) | [inline] |
Referenced by orxonox::Shell::cursor_left().
const std::string& orxonox::InputBuffer::get | ( | ) | const [inline] |
Referenced by orxonox::Shell::execute(), and orxonox::Shell::hintandcomplete().
unsigned int orxonox::InputBuffer::getCursorPosition | ( | ) | const [inline] |
Referenced by orxonox::InGameConsole::print().
unsigned int orxonox::InputBuffer::getSize | ( | ) | const [inline] |
Referenced by orxonox::Shell::exit().
void orxonox::InputBuffer::increaseCursor | ( | ) | [inline] |
Referenced by orxonox::Shell::cursor_right().
void orxonox::InputBuffer::insert | ( | const char & | input, | |
bool | update = true | |||
) |
References buffer_, charIsAllowed(), cursor_, and updated().
void orxonox::InputBuffer::insert | ( | const std::string & | input, | |
bool | update = true | |||
) |
void orxonox::InputBuffer::keyHeld | ( | const KeyEvent & | evt | ) | [private, virtual] |
Implements orxonox::KeyHandler.
References orxonox::KeyEvent::key, keysToRepeat_, lastKey_, and processKey().
void orxonox::InputBuffer::keyPressed | ( | const KeyEvent & | evt | ) | [private, virtual] |
Implements orxonox::KeyHandler.
References orxonox::KeyEvent::key, keyRepeatDeleay_, keysToRepeat_, lastKey_, processKey(), timeSinceKeyPressed_, and timeSinceKeyRepeated_.
void orxonox::InputBuffer::keyReleased | ( | const KeyEvent & | evt | ) | [inline, private, virtual] |
Implements orxonox::KeyHandler.
void orxonox::InputBuffer::processKey | ( | const KeyEvent & | e | ) | [private] |
References orxonox::KeyboardModifier::Alt, buffer_, orxonox::KeyCode::C, clear(), orxonox::KeyboardModifier::Ctrl, orxonox::KeyCode::Delete, orxonox::fromClipboard(), orxonox::KeyCode::Insert, insert(), orxonox::KeyEvent::isModifierDown(), orxonox::KeyEvent::key, listeners_, orxonox::KeyboardModifier::Shift, orxonox::KeyCode::Tab, orxonox::KeyEvent::text, orxonox::toClipboard(), orxonox::KeyCode::V, and orxonox::KeyCode::X.
Referenced by keyHeld(), and keyPressed().
void orxonox::InputBuffer::registerListener | ( | T * | listener, | |
void(T::*)() const | function, | |||
KeyCode::ByEnum | key | |||
) | [inline] |
References orxonox::KeyCode::T.
void orxonox::InputBuffer::registerListener | ( | T * | listener, | |
void(T::*)() | function, | |||
KeyCode::ByEnum | key | |||
) | [inline] |
References orxonox::KeyCode::T.
void orxonox::InputBuffer::registerListener | ( | T * | listener, | |
void(T::*)() const | function, | |||
char | _char, | |||
bool | bOnlySingleInput | |||
) | [inline] |
References orxonox::KeyCode::T, and orxonox::KeyCode::Unassigned.
void orxonox::InputBuffer::registerListener | ( | T * | listener, | |
void(T::*)() | function, | |||
char | _char, | |||
bool | bOnlySingleInput | |||
) | [inline] |
References orxonox::KeyCode::T, and orxonox::KeyCode::Unassigned.
void orxonox::InputBuffer::registerListener | ( | T * | listener, | |
void(T::*)() const | function, | |||
bool | bOnlySingleInput | |||
) | [inline] |
References orxonox::KeyCode::T, and orxonox::KeyCode::Unassigned.
void orxonox::InputBuffer::registerListener | ( | T * | listener, | |
void(T::*)() | function, | |||
bool | bOnlySingleInput | |||
) | [inline] |
References orxonox::KeyCode::T, and orxonox::KeyCode::Unassigned.
Referenced by orxonox::Shell::configureInputBuffer(), and orxonox::InputManager::initialise().
void orxonox::InputBuffer::removeAtCursor | ( | bool | update = true |
) |
void orxonox::InputBuffer::removeBehindCursor | ( | bool | update = true |
) |
void orxonox::InputBuffer::set | ( | const std::string & | input, | |
bool | update = true | |||
) |
References clear(), and insert().
Referenced by orxonox::Shell::hintandcomplete(), orxonox::Shell::history_down(), orxonox::Shell::history_up(), and orxonox::Shell::setInput().
void orxonox::InputBuffer::setConfigValues | ( | ) |
Function to collect the SetConfigValue-macro calls.
Reimplemented from orxonox::OrxonoxClass.
References keyRepeatDeleay_, keyRepeatTime_, ResetConfigValue, and SetConfigValue.
Referenced by InputBuffer().
void orxonox::InputBuffer::setCursorPosition | ( | unsigned int | cursor | ) | [inline] |
Referenced by orxonox::Shell::setCursorPosition().
void orxonox::InputBuffer::setCursorToBegin | ( | ) | [inline] |
Referenced by orxonox::Shell::cursor_home().
void orxonox::InputBuffer::setCursorToEnd | ( | ) | [inline] |
Referenced by orxonox::Shell::cursor_end().
void orxonox::InputBuffer::unregisterListener | ( | T * | listener | ) | [inline] |
void orxonox::InputBuffer::updated | ( | const char & | update, | |
bool | bSingleInput | |||
) |
References listeners_.
void orxonox::InputBuffer::updated | ( | ) |
void orxonox::InputBuffer::updateInput | ( | float | dt | ) | [private, virtual] |
This update() function is called by the InputManager if the InputBuffer is active.
dt | Delta time |
Implements orxonox::InputHandler.
References keyRepeatDeleay_, keyRepeatTime_, keysToRepeat_, timeSinceKeyPressed_, and timeSinceKeyRepeated_.
void orxonox::InputBuffer::updateKey | ( | float | dt | ) | [inline, private, virtual] |
Implements orxonox::KeyHandler.
Referenced by charIsAllowed(), and InputBuffer().
std::string orxonox::InputBuffer::buffer_ [private] |
Referenced by clear(), InputBuffer(), insert(), processKey(), removeAtCursor(), and removeBehindCursor().
unsigned int orxonox::InputBuffer::cursor_ [private] |
Referenced by clear(), InputBuffer(), insert(), removeAtCursor(), and removeBehindCursor().
float orxonox::InputBuffer::keyRepeatDeleay_ [private] |
Referenced by keyPressed(), setConfigValues(), and updateInput().
float orxonox::InputBuffer::keyRepeatTime_ [private] |
Referenced by setConfigValues(), and updateInput().
int orxonox::InputBuffer::keysToRepeat_ [private] |
Referenced by InputBuffer(), keyHeld(), keyPressed(), and updateInput().
Referenced by InputBuffer(), keyHeld(), and keyPressed().
std::list<BaseInputBufferListenerTuple*> orxonox::InputBuffer::listeners_ [private] |
Referenced by processKey(), updated(), and ~InputBuffer().
float orxonox::InputBuffer::timeSinceKeyPressed_ [private] |
Referenced by InputBuffer(), keyPressed(), and updateInput().
float orxonox::InputBuffer::timeSinceKeyRepeated_ [private] |
Referenced by InputBuffer(), keyPressed(), and updateInput().