summaryrefslogtreecommitdiff
path: root/kon/konassets.h
diff options
context:
space:
mode:
authorKonAki <konaki@anokonaki.org>2026-10-11 16:44:17 +0800
committerKonAki <konaki@anokonaki.org>2026-10-11 16:44:17 +0800
commite3f48813fc53057ebd04084b2f71b526c6df80d3 (patch)
tree660891f040be1dea5d2eb04e082b82e74658379c /kon/konassets.h
parente7ab646556188582af37b3064bb765daef3c9aa9 (diff)
assets: queue an array of names, unload one from a group
Diffstat (limited to 'kon/konassets.h')
-rw-r--r--kon/konassets.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/kon/konassets.h b/kon/konassets.h
index 4a25f15..7050f22 100644
--- a/kon/konassets.h
+++ b/kon/konassets.h
@@ -126,6 +126,12 @@ kon_assetGroup_t *kon_assetGroupCreate(kon_assets_t *assets);
/* adds a name to the waiting list, nothing is loaded yet. returns 0 if there was no memory */
int kon_assetGroupQueue(kon_assetGroup_t *group, const char *name);
+/* queues count names from an array, or all of them up to a NULL at the end if count is -1. returns how many it queued, or -1 on no memory.
+ static const char *const level1[] = { "wall.png", "floor.png", "door.wav", NULL };
+ kon_assetGroupQueueArray(group, level1, -1);
+ once they are loaded kon_assetImage and friends find them again, or use kon_assetFind to look at one without counting a use */
+int kon_assetGroupQueueArray(kon_assetGroup_t *group, const char *const *names, int count);
+
/* queues every name in a text asset, one per line. empty lines and lines starting with # are skipped.
returns how many it queued, or -1 if the list can't be read */
int kon_assetGroupQueueList(kon_assetGroup_t *group, const char *listName);
@@ -139,6 +145,10 @@ int kon_assetGroupLoadAll(kon_assetGroup_t *group);
/* loaded counts the assets that are in, total also counts the ones waiting and the ones that failed */
void kon_assetGroupProgress(const kon_assetGroup_t *group, int *loaded, int *total);
+/* takes one name out of the group and frees it if nothing else uses it, the rest stay loaded. returns 1 if it was freed,
+ 0 if it is still used somewhere else or was not in the group */
+int kon_assetGroupUnload(kon_assetGroup_t *group, const char *name);
+
/* gives back every use the group holds and frees what nothing else uses. the group is gone after this */
void kon_assetGroupFree(kon_assetGroup_t *group);