Added the destroy method for the polygons

This commit is contained in:
Karma Riuk 2023-05-19 10:18:49 +02:00
parent 00dad13b2f
commit 92e51a96be
3 changed files with 9 additions and 3 deletions

View File

@ -67,6 +67,7 @@ void game_init() {
void game_destroy() { void game_destroy() {
c_index_destroy(); c_index_destroy();
balls_destroy(); balls_destroy();
polygons_destroy();
} }
static guint animation_timeout_id = 0; static guint animation_timeout_id = 0;

View File

@ -277,13 +277,17 @@ void polygon::draw(cairo_t* cr) const {
draw_circle(cr, centroid, 1); draw_circle(cr, centroid, 1);
// draw speed // draw speed
(10 * delta * this->speed).draw(cr, centroid); (delta * this->speed).draw(cr, centroid);
} }
void polygons_draw(cairo_t* cr) { void polygons_draw(cairo_t* cr) {
draw_circle(cr, col.impact_point, 3); // tbd // draw_circle(cr, col.impact_point, 3); // tbd
col.n.draw(cr, col.impact_point); // tbd // col.n.draw(cr, col.impact_point); // tbd
for (const polygon* p = polygons; p != polygons + n_polygons; ++p) for (const polygon* p = polygons; p != polygons + n_polygons; ++p)
p->draw(cr); p->draw(cr);
} }
void polygons_destroy() {
delete[] (polygons);
}

View File

@ -114,5 +114,6 @@ extern uint n_polygons;
extern void polygons_init_state(); extern void polygons_init_state();
extern void polygons_update_state(); extern void polygons_update_state();
extern void polygons_draw(cairo_t* cr); extern void polygons_draw(cairo_t* cr);
extern void polygons_destroy();
#endif #endif