draw and erase all entities

This commit is contained in:
Tobin
2026-04-25 14:46:02 -04:00
parent d944a57d23
commit 6bd50b041c
+7 -4
View File
@@ -186,14 +186,16 @@ void draw_entity(struct entity* e)
void erase_entities(void) void erase_entities(void)
{ {
/* TODO more than just player entity */ struct entity* head;
erase_entity(get_player()); for (head = first_entity; head != NULL; head = head->next)
erase_entity(head);
} }
void draw_entities(void) void draw_entities(void)
{ {
/* TODO more than just player entity */ struct entity* head;
draw_entity(get_player()); for (head = first_entity; head != NULL; head = head->next)
draw_entity(head);
} }
static long last_sec = 0; static long last_sec = 0;
@@ -253,6 +255,7 @@ int main(int argc, char** argv)
/* layer, visibility, x, y, width, height, r, g, b */ /* layer, visibility, x, y, width, height, r, g, b */
cat_fill(0, 1, 0, 0, screen_width - 1, screen_height - 1, 132, 155, 132); cat_fill(0, 1, 0, 0, screen_width - 1, screen_height - 1, 132, 155, 132);
/* create the player */ add_entity(1, 0, 0, 0, 50, 50, 100, 50, 0, 0, 0, 0, 0); /* create the player */ add_entity(1, 0, 0, 0, 50, 50, 100, 50, 0, 0, 0, 0, 0);
/* create a random entity */ add_entity(0, 0, 20, 20, 50, 50, 100, 100, 50, 0, 0, 0, 0);
while (1) game_loop(); while (1) game_loop();
return 0; return 0;
} }