summaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/game.c b/src/game.c
index df904d7..e4e2907 100644
--- a/src/game.c
+++ b/src/game.c
@@ -98,7 +98,7 @@ void DrawEntitySprite(const Entity* e, int spriteIndex) {
srcRect.width = -srcRect.width;
if (drawnSprite->flipY)
- srcRect.height = -srcRect.width;
+ srcRect.height = -srcRect.height;
DrawTexturePro(drawnSprite->texture, srcRect, destRect, origin, rotation, WHITE);
}
@@ -128,14 +128,17 @@ void DrawEntitiesInLayer(Entity* drawOrder[], int layer) {
}
}
-void DrawGame() {
- Entity* drawOrder[MAX_ENTITY_COUNT];
-
+static inline void FillDrawOrder(Entity* drawOrder[]) {
for (int i = 0; i < MAX_ENTITY_COUNT; i++) {
drawOrder[i] = &game.entities[i];
}
qsort(drawOrder, MAX_ENTITY_COUNT, sizeof(Entity*), compare);
+}
+
+void DrawGame() {
+ Entity* drawOrder[MAX_ENTITY_COUNT];
+ FillDrawOrder(drawOrder);
BeginDrawing();
ClearBackground(RAYWHITE);