diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-10-20 20:21:45 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-10-20 20:21:45 +0300 |
| commit | a82b4f26df953ae20be5acd4c96665d7998b8c01 (patch) | |
| tree | 3d6d6d6109d7c02bbfe0967e6bbf5a9f933b6d42 | |
| parent | 506dcd63779e86baf2ac9d781061bd26d138cf40 (diff) | |
Support exit with ESC key.
| -rw-r--r-- | src/live.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/live.cpp b/src/live.cpp index 641eb7d..0120bd7 100644 --- a/src/live.cpp +++ b/src/live.cpp @@ -59,8 +59,11 @@ LiveOutput::HandleEvents() { sf::Event event; while (this->window_.pollEvent(event)) { - if (event.type == sf::Event::Closed) + if ((event.type == sf::Event::Closed) + || (event.type == sf::Event::KeyPressed + && event.key.code == sf::Keyboard::Escape)) { this->window_.close(); + } } return this->window_.isOpen(); } |
