change keyboard demo to event listener
This commit is contained in:
@ -8,8 +8,8 @@
|
||||
* Autor: Michael Schoettner, HHU, 26.10.2018 *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "lib/Input.h"
|
||||
#include "user/demo/KeyboardDemo.h"
|
||||
#include "lib/Input.h"
|
||||
|
||||
void KeyboardDemo::run() {
|
||||
|
||||
@ -18,7 +18,9 @@ void KeyboardDemo::run() {
|
||||
kout << "Keyboard Demo: " << endl;
|
||||
|
||||
while (true) {
|
||||
kout << getch();
|
||||
kout << listener.waitForKeyEvent();
|
||||
|
||||
// kout << getch();
|
||||
kout.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,14 +13,18 @@
|
||||
|
||||
#include "kernel/Globals.h"
|
||||
#include "kernel/threads/Thread.h"
|
||||
#include "user/KeyEventListener.h"
|
||||
|
||||
class KeyboardDemo : public Thread {
|
||||
private:
|
||||
KeyboardDemo(const KeyboardDemo& copy) = delete;
|
||||
|
||||
KeyEventListener listener;
|
||||
|
||||
public:
|
||||
KeyboardDemo() {
|
||||
KeyboardDemo() : listener(*this) {
|
||||
kout << "Initialized KeyboardDemo" << endl;
|
||||
kevman.subscribe(listener);
|
||||
}
|
||||
|
||||
void run() override;
|
||||
|
||||
Reference in New Issue
Block a user