From a82b4f26df953ae20be5acd4c96665d7998b8c01 Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Wed, 20 Oct 2021 20:21:45 +0300 Subject: Support exit with ESC key. --- src/live.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); } -- cgit v1.2.3