#include <ArKeyHandler.h>
Public Types | |
enum | KEY { UP = 256, DOWN, LEFT, RIGHT, ESCAPE, SPACE, TAB, ENTER, BACKSPACE, F1, F2, F3, F4 } |
These are enums for the non-ascii keys. More... | |
Public Methods | |
ArKeyHandler (bool blocking=false) | |
Constructor. More... | |
~ArKeyHandler (void) | |
Destructor. | |
bool | addKeyHandler (int keyToHandle, ArFunctor *functor) |
This adds a keyhandler, when the keyToHandle is hit, functor will fire. More... | |
bool | remKeyHandler (int keyToHandler) |
This removes a key handler, by key. More... | |
bool | remKeyHandler (ArFunctor *functor) |
This removes a key handler, by key. More... | |
void | restore (void) |
Sets stdin back to its original settings, if its been restored it won't read anymore. | |
void | checkKeys (void) |
intnernal, use addKeyHandler, Checks for keys and handles them. | |
int | getKey (void) |
internal, use addKeyHandler instead... Gets a key from the stdin if ones available, -1 if there aren't any available. |
This class is for handling input from the keyboard, you just addKeyHandler the keys you want to deal with.
You should also register the keyhandler with Aria::setKeyHandler, and before you create a key handler you should see if one is already there with Aria::getKeyHandler.
You can attach a key handler to a robot with ArRobot::attachKeyHandler which will put a task into the robots list of tasks so that it'll get checked every cycle or you can just call checkKeys yourself (like in its own thread or in the main thread). You should only attach a key handler to one robot, even if you're using multiple robots.
|
These are enums for the non-ascii keys.
|
|
Constructor.
|
|
This adds a keyhandler, when the keyToHandle is hit, functor will fire.
|
|
This removes a key handler, by key.
|
|
This removes a key handler, by key.
|