diff options
Diffstat (limited to 'src/editor.c')
| -rw-r--r-- | src/editor.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/editor.c b/src/editor.c index b10da62..d12d31b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -15,6 +15,24 @@ const char *EDITOR_MAIN_TABS[] = {"Build"}; const int EDITOR_MAIN_TABS_SIZE = sizeof(EDITOR_MAIN_TABS) / sizeof(EDITOR_MAIN_TABS[0]); +void removeNullTiles(Editor *editor) { + int i, j = 0; + EditorTile **tiles = editor->state.cache.tiles; + int *count = &editor->state.cache.tilesCount; + + for (i = 0; i < *count; i++) { + if (tiles[i] != NULL) { + tiles[j++] = tiles[i]; + } + } + + *count = j; + + for (i = j; i < *count; i++) { + tiles[i] = NULL; + } +} + void SE_DrawEditor(Editor *editor, Camera2D *camera) { Vector2 mousePos = GetScreenToWorld2D(GetMousePosition(), *camera); float zoom = camera->zoom; @@ -91,6 +109,8 @@ void SE_DrawEditor(Editor *editor, Camera2D *camera) { } } } + + removeNullTiles(editor); } void drawBuildTab(Editor *editor, int x, int y, int width, int height) { |
