| 178 | } |
| 179 | |
| 180 | void Engine::handleWindowEvents() const |
| 181 | { |
| 182 | sf::Event event; |
| 183 | while (m_window->pollEvent(event)) |
| 184 | { |
| 185 | switch (event.type) |
| 186 | { |
| 187 | case sf::Event::Closed: |
| 188 | m_window->close(); |
| 189 | break; |
| 190 | case sf::Event::MouseButtonPressed: |
| 191 | [[fallthrough]]; |
| 192 | case sf::Event::MouseButtonReleased: |
| 193 | [[fallthrough]]; |
| 194 | case sf::Event::JoystickButtonPressed: |
| 195 | [[fallthrough]]; |
| 196 | case sf::Event::JoystickButtonReleased: |
| 197 | [[fallthrough]]; |
| 198 | case sf::Event::JoystickMoved: |
| 199 | [[fallthrough]]; |
| 200 | case sf::Event::KeyReleased: |
| 201 | [[fallthrough]]; |
| 202 | case sf::Event::KeyPressed: |
| 203 | m_input->requireRefresh(); |
| 204 | if (event.key.code == sf::Keyboard::Escape) |
| 205 | m_window->close(); |
| 206 | break; |
| 207 | default: |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | Engine::Engine() |
| 214 | { |
no test coverage detected