Enabled SDL_image's support for PNG and TIFF files and improved the

AssetManager with a hashing function, a linked list structure to store
the hashes as well as a reference counter to support multiple users
sharing the same asset.
This commit is contained in:
abdelrahman committed 2022-09-24 04:17:16 +01:00
1 parent 3f71cf0f3f
commit dfee36ffe9
12 files changed
+292 -60

No files matched your search

+7 -3
View File
@@ -49,7 +49,7 @@ ObjectID add_object_to_store(ObjectStore *os, void *object, EventHandlerPtr eh,
printf("Failed to add object\n");
#endif /* DEBUG_ENGINE */
return -1;
return INVALID_ID;
}
// TODO (Abdelrahman): Need to figure out a way to check that the object
@@ -78,11 +78,15 @@ ObjectID add_object_to_store(ObjectStore *os, void *object, EventHandlerPtr eh,
return id;
}
void remove_object_from_store(ObjectStore *os, ObjectID id) {
if (!os || os->count == 0 || !(os->object_ptrs[id])) {
void remove_object_from_store(ObjectStore *os, ObjectID *id_ptr) {
ObjectID id = *id_ptr;
if (!os || os->count == 0 || id == INVALID_ID || !(os->object_ptrs[id])) {
return;
}
*id_ptr = INVALID_ID;
os->object_ptrs[id] = NULL;
os->event_handlers[id] = NULL;
os->update_funcs[id] = NULL;