MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / handleWindowEvents

Method handleWindowEvents

src/Core/Engine/Engine.cpp:180–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

updateMethod · 0.95

Calls 3

pollEventMethod · 0.80
requireRefreshMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected