summaryrefslogtreecommitdiff
path: root/src/editor.c
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-01-26 20:43:13 +0500
committerilotterytea <iltsu@alright.party>2025-01-26 20:43:13 +0500
commit8103af34f70cbb7747c232875fbbcfe3b0a8dc9f (patch)
treefc590c723cdf10271262c88189a5924426dcb031 /src/editor.c
parent8f07966ba585a42a0654f7dcaafc4d8e5cd481bc (diff)
upd: render placed tiles before the grid
Diffstat (limited to 'src/editor.c')
-rw-r--r--src/editor.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/editor.c b/src/editor.c
index ce5c5ae..8728564 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -22,10 +22,21 @@ void SE_DrawEditor(Editor *editor, Camera2D *camera) {
XdLevel *level = editor->data->levels[editor->state.currentLevel];
XdFloor *floor = level->floors[editor->state.currentLayer];
+ // rendering placed tiles
+ for (int i = 0; i < editor->state.cache.tilesCount; i++) {
+ EditorTile *t = editor->state.cache.tiles[i];
+ if (t == NULL) continue;
+
+ Rectangle s = {0, 0, 16, 16};
+ Rectangle d = {t->position.x * zoom, t->position.y * zoom, zoom, zoom};
+
+ DrawTexturePro(t->tile->texture, s, d, (Vector2){0, 0}, 0.0f, WHITE);
+ }
+
for (int x = 0; x < floor->width; x++) {
for (int y = 0; y < floor->height; y++) {
float rx = x * zoom, ry = y * zoom;
- DrawRectangleLines(rx, ry, zoom, zoom, LIGHTGRAY);
+ DrawRectangleLines(rx, ry, zoom, zoom, BLACK);
if ((rx < mousePos.x && mousePos.x < rx + zoom) &&
(ry < mousePos.y && mousePos.y < ry + zoom)) {
@@ -65,17 +76,6 @@ void SE_DrawEditor(Editor *editor, Camera2D *camera) {
}
}
}
-
- // rendering placed tiles
- for (int i = 0; i < editor->state.cache.tilesCount; i++) {
- EditorTile *t = editor->state.cache.tiles[i];
- if (t == NULL) continue;
-
- Rectangle s = {0, 0, 16, 16};
- Rectangle d = {t->position.x * zoom, t->position.y * zoom, zoom, zoom};
-
- DrawTexturePro(t->tile->texture, s, d, (Vector2){0, 0}, 0.0f, WHITE);
- }
}
void drawBuildTab(Editor *editor, int x, int y, int width, int height) {