Restructure/refactor of main.c

This commit is contained in:
2023-11-12 16:14:30 +01:00
parent df911c65b7
commit 8edb7b7ea9
13 changed files with 280 additions and 159 deletions

View File

@@ -0,0 +1,14 @@
#include "systems.h"
void renderEntities(ecs_iter_t *it) {
Position *p = ecs_field(it, Position, 1);
Size *s = ecs_field(it, Size, 2);
Rotation *r = ecs_field(it, Rotation, 3);
TextureRegion *t = ecs_field(it, TextureRegion, 4);
for (i32 i = 0; i < it->count; i++) {
Rectangle dst = {p[i].x, p[i].y, s[i].x, s[i].y};
Vector2 origin = {dst.width * 0.5f, dst.height * 0.5f};
DrawTexturePro(t[i].texture, t[i].rec, dst, origin, r[i], WHITE);
}
}