SimplyMinimal пре 3 година
родитељ
комит
da4cfe0917
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      app.c

+ 6 - 0
app.c

@@ -136,6 +136,8 @@ typedef struct Poly {
 /* Define the polygons we use. */
 Poly ShipPoly = {{-3, 0, 3}, {-3, 6, -3}, 3};
 
+Poly ShipFirePoly = {{-1.5, 0, 1.5}, {-3, -6, -3}, 3};
+
 /* Rotate the point of the poligon 'poly' and store the new rotated
  * polygon in 'rot'. The polygon is rotated by an angle 'a', with
  * center at 0,0. */
@@ -264,6 +266,10 @@ void render_callback(Canvas* const canvas, void* ctx) {
     /* Draw ship, asteroids, bullets. */
     draw_poly(canvas, &ShipPoly, app->ship.x, app->ship.y, app->ship.rot);
 
+    if(key_pressed_time(app, InputKeyUp) > 0) {
+        draw_poly(canvas, &ShipFirePoly, app->ship.x, app->ship.y, app->ship.rot);
+    }
+
     for(int j = 0; j < app->bullets_num; j++) draw_bullet(canvas, &app->bullets[j]);
 
     for(int j = 0; j < app->asteroids_num; j++) draw_asteroid(canvas, &app->asteroids[j]);