]> git.localhorst.tv Git - space.git/blobdiff - src/app/Application.cpp
less sucky autopilot
[space.git] / src / app / Application.cpp
index e3c6a2b878bc1bb39c4294bd632192d8ebca40df..b69cc85a0cdb18578a3eee5e87472fe0196fc485 100644 (file)
@@ -12,6 +12,20 @@ Application::Application(Canvas &c)
 , focus(Vector<float>(500, 500), 500)
 , cam(c.Size(), focus.Pos())
 , controlled(univ.AddShip(Ship()))
+, linGauge(
+       Vector<int>(15, 100),
+       Vector<int>(10, 10),
+       Color(0xFF, 0xFF, 0xFF),
+       Color(0x00, 0x00, 0x00),
+       Color(0x00, 0xFF, 0x00),
+       Color(0xFF, 0x00, 0x00))
+, rotGauge(
+       Vector<int>(15, 100),
+       Vector<int>(27, 10),
+       Color(0xFF, 0xFF, 0xFF),
+       Color(0x00, 0x00, 0x00),
+       Color(0x33, 0x33, 0xFF),
+       Color(0x00, 0x00, 0xFF))
 , autopilot(*controlled, focus.Pos())
 , apEnabled(false)
 , last(SDL_GetTicks())
@@ -34,6 +48,11 @@ void Application::Run() {
 
 void Application::Loop(int delta) {
        HandleEvents();
+       if (delta == 0) {
+               SDL_Delay(1);
+               return;
+       }
+
        if (!paused) {
                Update(delta);
        }
@@ -200,6 +219,9 @@ void Application::Render() {
        }
 
        autopilot.Render(canvas, cam);
+
+       linGauge.Render(canvas, controlled->linThrottle);
+       rotGauge.Render(canvas, controlled->rotThrottle);
 }
 
 }