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