X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fstates.cpp;h=49ee8e23ac1793b88709cb6862fcb42d2d08a01c;hb=f5fc0c2bd1c0d1e2737d2b4ed49c3de16aa67c67;hp=ecba340312dd84a6fbca76c791c8cd7531c575e2;hpb=b9af958c3f80a966bd31c622a45d0f3375bf2c3a;p=blobs.git diff --git a/src/app/states.cpp b/src/app/states.cpp index ecba340..49ee8e2 100644 --- a/src/app/states.cpp +++ b/src/app/states.cpp @@ -21,7 +21,7 @@ MasterState::MasterState(Assets &assets, world::Simulation &sim) noexcept , cam(sim.Root()) , cam_dist(5.0) , cam_tgt_dist(5.0) -, cam_orient(PI * 0.125, 0.0, 0.0) +, cam_orient(PI * 0.375, PI * 0.25, 0.0) , cam_dragging(false) , cp(assets) , remain(0) @@ -50,8 +50,15 @@ void MasterState::OnResize(int w, int h) { void MasterState::OnUpdate(int dt) { remain += dt; - while (remain >= FrameMS()) { +#ifdef NDEBUG + int max_tick = 10; +#else + // one tick per frame when debugging so pausing execution doesn't result in more ticks + int max_tick = 1; +#endif + while (remain >= FrameMS() && max_tick > 0) { Tick(); + --max_tick; } } @@ -110,7 +117,7 @@ void MasterState::OnMouseWheel(const SDL_MouseWheelEvent &e) { constexpr double zoom_scale = -1.0; constexpr double zoom_base = 1.125; cam_orient.z = glm::clamp(cam_orient.z + double(e.x) * roll_scale, PI * -0.5, PI * 0.5); - cam_tgt_dist = std::max(1.0, cam_tgt_dist * std::pow(zoom_base, double(e.y) * zoom_scale)); + cam_tgt_dist = std::max(cp.GetCreature().Size() * 2.0, cam_tgt_dist * std::pow(zoom_base, double(e.y) * zoom_scale)); } void MasterState::OnRender(graphics::Viewport &viewport) {