| 59 | } |
| 60 | |
| 61 | void 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 | |
| 100 | void GameEngine::drawFrame(uint16_t width, uint16_t height) |
| 101 | { |
nothing calls this directly
no test coverage detected