30.11.2013 - New PICollection namespace, Android support, my own PIVector implementation
This commit is contained in:
@@ -20,6 +20,22 @@
|
||||
#include "pikbdlistener.h"
|
||||
|
||||
|
||||
/** \class PIKbdListener
|
||||
* \brief Keyboard console input listener
|
||||
* \details This class provide listening of console keyboard input.
|
||||
* There is two ways to receive pressed key:
|
||||
* * external static functionwith format "void func(char key, void * data)"
|
||||
* * event \a keyPressed()
|
||||
*
|
||||
* Also there is static variable \a exiting which by default is set to
|
||||
* \b false. If \a enableExitCapture() was called and listener was started
|
||||
* with function \a start(), this variable will be set to \b true if exit
|
||||
* key will be pressed. By default exit key is 'Q' = shift + 'q'.
|
||||
* To wait for this variable changes to \b true there is WAIT_FOR_EXIT macro
|
||||
* \snippet pikbdlistener.cpp main
|
||||
* */
|
||||
|
||||
|
||||
bool PIKbdListener::exiting;
|
||||
|
||||
PIKbdListener::PIKbdListener(KBFunc slot, void * data_): PIThread() {
|
||||
@@ -117,8 +133,10 @@ void PIKbdListener::run() {
|
||||
PIKbdListener::exiting = true;
|
||||
return;
|
||||
}
|
||||
keyPressed(lc, data);
|
||||
if (ret_func != 0 && ret > 0) ret_func(lc, data);
|
||||
if (ret > 0) {
|
||||
keyPressed(lc, data);
|
||||
if (ret_func != 0) ret_func(lc, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user