diff options
author | ancarola <raffaele.ancarola@epfl.ch> | 2019-01-19 13:07:37 +0100 |
---|---|---|
committer | ancarola <raffaele.ancarola@epfl.ch> | 2019-01-19 13:07:37 +0100 |
commit | 3922c797671cdc23d9233ff76909489e45fd0006 (patch) | |
tree | d385754f00159b93a8966fb5080a51dc2d0eb4a0 /engine/flatwindow.cpp | |
parent | edas (diff) | |
download | flatland-3922c797671cdc23d9233ff76909489e45fd0006.tar.gz flatland-3922c797671cdc23d9233ff76909489e45fd0006.zip |
Test two completed successfully
Diffstat (limited to 'engine/flatwindow.cpp')
-rw-r--r-- | engine/flatwindow.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/engine/flatwindow.cpp b/engine/flatwindow.cpp index d1d444e..cbff905 100644 --- a/engine/flatwindow.cpp +++ b/engine/flatwindow.cpp @@ -3,6 +3,7 @@ #include <SDL2/SDL.h> #include <iostream> #include "flatlayer.h" +#include "flatsignal.h" using namespace std; @@ -155,17 +156,18 @@ void FlatWindow::setWindowStatus(window_status status) this->status = status; } -void FlatWindow::serial_cb(const SDL_Event &event) +void FlatWindow::key_cb(const SDL_KeyboardEvent *event) { // TODO Default escape exits - switch (event.type) + if (event->type == SDL_KEYDOWN && event->keysym.sym == SDLK_ESCAPE) { - case SDL_KEYDOWN: + /* Close window */ + close(); - if (event.key.keysym.sym == SDLK_ESCAPE) - close(); // TODO not enough - break; + /* Say flatland to quit */ + FlatSignal quit(this, 0, 0xff); + quit.emit("core"); } } |