diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-12-24 22:54:52 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-12-24 22:54:52 +0100 |
| commit | e2c44a3ac39b229dfef93833828be697cf104bba (patch) | |
| tree | cef3d0cacd4a5cceefb62fcad52ff668cb2145aa /src/objects.c | |
| parent | 2a85823f96ec4e9fa62905490ac93910187dfefc (diff) | |
only draw what is on screen
Diffstat (limited to 'src/objects.c')
| -rw-r--r-- | src/objects.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/objects.c b/src/objects.c index 46714a4..6715e0d 100644 --- a/src/objects.c +++ b/src/objects.c @@ -52,15 +52,14 @@ image* get_image_from_objecttype(object_type tile) { } } -void draw_objects_at_row(platform_window* window, int row) { +void draw_objects(platform_window* window) { map_info info = get_map_info(window); - for (int i = MAP_SIZE_X-1; i >= 0; i--) { - object o = get_object_at_tile(i, row); - + for (int i = 0; i < MAX_OBJECTS; i++) { + if (!loaded_map.objects[i].active) continue; + object o = loaded_map.objects[i]; OBJECT_RENDER_DEPTH((int)o.position.y); - if (!o.active) continue; box box = get_box_of_object(window, o); image* img = get_image_from_objecttype(o.type); |
