]> git.localhorst.tv Git - orbi.git/blobdiff - src/app/Application.cpp
some cleanup
[orbi.git] / src / app / Application.cpp
index cbfafd374537935625dbaad63955d4d7edacbcd6..b6a08f115cc48b66d57367297380afad1b1a43a4 100644 (file)
@@ -148,15 +148,15 @@ void Application::OnKeyUp(const SDL_KeyboardEvent &e) {
 
 void Application::Update(int dt) {
        const float delta = dt / 1e3;
-       ctrl.Update(delta);
+       for (int i = 0; i < dt; ++i) {
+               ctrl.Update(1e-3);
+               world.Update(1e-3);
+       }
        target.Update(delta);
        focus = ctrl.Controlling()
                ? ctrl.Controlled().bounds.Center()
                : target.Pos();
        cam.Update(delta);
-       for (int i = 0; i < dt; ++i) {
-               world.Update(1e-3);
-       }
 }
 
 
@@ -169,9 +169,13 @@ void Application::Render() {
 
 void Application::RenderBackground() {
        constexpr Color background(0x00, 0x00, 0x00);
+       constexpr Color outlineColor(0x00, 0x00, 0xFA);
 
        canvas.SetColor(background);
        canvas.Fill();
+
+       canvas.SetColor(outlineColor);
+       canvas.Grid(cam.ToScreen(Vector<int>(0, 0)), cam.ToScale(world.Size()), cam.ToScale(Vector<float>(1, 1)));
 }
 
 void Application::RenderWorld() {
@@ -197,12 +201,8 @@ void Application::RenderEntities() {
 }
 
 void Application::RenderUI() {
-       constexpr Color outlineColor(0x00, 0x00, 0xFA);
        constexpr Color targetColor(0xFA, 0xFA, 0x00);
 
-       canvas.SetColor(outlineColor);
-       canvas.Grid(cam.ToScreen(Vector<int>(0, 0)), cam.ToScale(world.Size()), cam.ToScale(Vector<float>(1, 1)));
-
        canvas.SetColor(targetColor);
        canvas.Cross(cam.ToScreen(target.Pos()), 15);
 }