Browse Source

Add function to draw arrows.

Godzil 1 year ago
parent
commit
eec33af8a9
2 changed files with 7 additions and 0 deletions
  1. 6 0
      source/graphics.cpp
  2. 1 0
      source/include/graphics.h

+ 6 - 0
source/graphics.cpp

@@ -134,6 +134,12 @@ void graphics::draw::line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint32
     lineColor(graphics::renderer, x0, y0, x1, y1, color);
 }
 
+void graphics::draw::arrow(int16_t x, int16_t y, int16_t w, int16_t h, uint32_t color)
+{
+    line(x, y, x + w, y + h, color);
+    fillCircle(x + w, y + h, 4, color);
+}
+
 void graphics::draw::circle(int16_t x, int16_t y, int16_t radius, double angle, uint32_t color)
 {
     circleColor(graphics::renderer, x, y, radius, color);

+ 1 - 0
source/include/graphics.h

@@ -49,6 +49,7 @@ public:
     {
         static void line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint32_t color);
         static void circle(int16_t x, int16_t y, int16_t radius, double angle, uint32_t color);
+        static void arrow(int16_t x, int16_t y, int16_t w, int16_t h, uint32_t color);
         static void fillCircle(int16_t x, int16_t y, int16_t radius, uint32_t color);
         static void rect(int16_t x, int16_t y, int16_t width, int16_t height, uint32_t color);
         static void fillRect(int16_t x, int16_t y, int16_t width, int16_t height, uint32_t color);