MCPcopy Create free account
hub / github.com/Hopson97/MineCraft-One-Week-Challenge / runLoop

Method runLoop

Source/Application.cpp:17–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15float g_timeElapsed = 0;
16
17void Application::runLoop()
18{
19 sf::Clock dtTimer;
20 sf::Clock dt;
21
22 sf::Time m;
23
24 while (m_context.window.isOpen() && !m_states.empty()) {
25 auto deltaTime = dtTimer.restart();
26 auto &state = *m_states.back();
27
28 state.handleInput();
29 state.update(deltaTime.asSeconds());
30 m_camera.update();
31
32 state.render(m_masterRenderer);
33 m_masterRenderer.finishRender(m_context.window, m_camera);
34
35 handleEvents();
36 if (m_isPopState) {
37 m_isPopState = false;
38 m_states.pop_back();
39 }
40
41 m = dt.restart();
42
43 g_timeElapsed += m.asSeconds();
44 }
45}
46
47void Application::handleEvents()
48{

Callers 1

mainFunction · 0.80

Calls 4

finishRenderMethod · 0.80
handleInputMethod · 0.45
updateMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected