diff options
| author | Aldrik Ramaekers <aldrik.ramaekers@protonmail.com> | 2020-06-17 17:34:54 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik.ramaekers@protonmail.com> | 2020-06-17 17:34:54 +0200 |
| commit | 2f552b15aa9e0aa80488c00c2190e9a25b578f87 (patch) | |
| tree | 784db7ef5c91c1f5ff03d7be4aa749b1d25f01c1 /src/assets.c | |
| parent | db24b566ba1be51255b98aafc34a117aaec65f39 (diff) | |
refactoring
Diffstat (limited to 'src/assets.c')
| -rw-r--r-- | src/assets.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/assets.c b/src/assets.c index e693d7f..e2452fb 100644 --- a/src/assets.c +++ b/src/assets.c @@ -33,8 +33,38 @@ inline static bool is_big_endian() return !((*((uint8_t*)(&i))) == 0x67);
}
+void assets_stop_if_done()
+{
+ if (global_asset_collection.queue.queue.length == 0 && !global_asset_collection.done_loading_assets)
+ {
+ global_asset_collection.done_loading_assets = true;
+
+#ifdef MODE_TIMESTARTUP
+ abort();
+#endif
+
+#if defined(MODE_DEBUGMEM) && !defined(MODE_TEST)
+ printf("allocated at startup: %dkb\n", __total_allocated/1000);
+ printf("reallocated at startup: %dkb\n", __total_reallocated/1000);
+#endif
+
+#if defined(MODE_DEVELOPER) && !defined(MODE_TEST)
+ printf("frames drawn with missing assets: %d\n", __frames_drawn_with_missing_assets);
+#endif
+ }
+
+#ifdef MODE_DEVELOPER
+ if (global_asset_collection.queue.queue.length != 0 && !global_asset_collection.done_loading_assets)
+ {
+ __frames_drawn_with_missing_assets++;
+ }
+#endif
+}
+
bool assets_do_post_process()
{
+ assets_stop_if_done();
+
bool result = false;
mutex_lock(&asset_mutex);
|
