MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / onFrameUpdate

Method onFrameUpdate

src/engine/GameEngine.cpp:61–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void GameEngine::onFrameUpdate(double dt, uint16_t width, uint16_t height)
62{
63 // Debug only
64 // static bool lastLogicDisableKeyState = false;
65 // static bool disableLogic = false;
66
67 // if(inputGetKeyState(entry::Key::Key2) != lastLogicDisableKeyState)
68 // {
69 // if(!lastLogicDisableKeyState)
70 // disableLogic = !disableLogic;
71
72 // lastLogicDisableKeyState = inputGetKeyState(entry::Key::Key2);
73 // }
74 if (!getSession().getWorldInstances().empty())
75 {
76 if (m_Paused)
77 {
78 getMainWorld().get().getCameraController()->onUpdate(dt);
79 }
80 else
81 {
82 // Get draw-distance from config
83 float drawDistanceMod = atof(Flags::drawDistance.getParam(0).c_str());
84 float drawDistanceTotal = DRAW_DISTANCE * drawDistanceMod;
85
86 getGameClock().update(dt);
87 for (auto& s : getSession().getWorldInstances())
88 {
89 // Update main-world after every other world, since the camera is in there
90 s->onFrameUpdate(dt, drawDistanceTotal * drawDistanceTotal, s->getCameraComp<Components::PositionComponent>().m_WorldMatrix);
91 }
92
93 // Finally, update main camera
94 getMainWorld().get().getCameraController()->onUpdateExplicit(dt);
95 }
96 }
97 drawFrame(width, height);
98}
99
100void GameEngine::drawFrame(uint16_t width, uint16_t height)
101{

Callers

nothing calls this directly

Calls 6

getCameraControllerMethod · 0.80
getMethod · 0.80
onUpdateExplicitMethod · 0.80
emptyMethod · 0.45
onUpdateMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected