]> git.localhorst.tv Git - space.git/blobdiff - src/graphics/Canvas.cpp
added autopilot that sucks
[space.git] / src / graphics / Canvas.cpp
index 93e3f212a9999fd3259c13df676aa4e85cfcd596..6241ab30dcb00844154406e5a753706fd8b1f2df 100644 (file)
@@ -95,6 +95,15 @@ void Canvas::Cross(Vector<int> pos, int extent) {
                Vector<int>(pos.x, pos.y + extent));
 }
 
+void Canvas::Arrow(Vector<int> from, Vector<int> to) {
+       Line(from, to);
+       Vector<float> delta(to - from);
+       delta = delta / Length(delta);
+
+       Line(to, to + Vector<int>(Rotate90(delta) * 5.0f - (delta * 5.0f)));
+       Line(to, to + Vector<int>(Rotate270(delta) * 5.0f - (delta * 5.0f)));
+}
+
 void Canvas::Triangle(Vector<int> v1, Vector<int> v2, Vector<int> v3) {
        SDL_Point points[4] = { v1, v2, v3, v1 };
        SDL_RenderDrawLines(canv, points, 4);