feat: nuked placeholder resources module
This commit is contained in:
parent
9f3d52c1d4
commit
14e2885271
|
@ -5,35 +5,6 @@
|
|||
|
||||
char const *RESOURCE_DIRECTORY = "resources";
|
||||
|
||||
typedef enum ResourceType {
|
||||
MODEL_RESOURCE = 0, TEXTURE_RESOURCE
|
||||
} ResourceType;
|
||||
|
||||
typedef struct ResourceContainer {
|
||||
uint32_t rid;
|
||||
char const *resource_name;
|
||||
ResourceType type;
|
||||
union {
|
||||
Model model;
|
||||
Texture texture;
|
||||
};
|
||||
} ResourceContainer;
|
||||
|
||||
static Dictionary g_resources = {};
|
||||
|
||||
static inline
|
||||
void Internal_CleanResourceContainer(ResourceContainer *container) {
|
||||
switch(container->type) {
|
||||
case MODEL_RESOURCE:
|
||||
UnloadModel(container->model);
|
||||
return;
|
||||
case TEXTURE_RESOURCE:
|
||||
UnloadTexture(container->texture);
|
||||
return;
|
||||
}
|
||||
UNREACHABLE("CleanResourceContainer: Cleanup function not defined for %u", container->type);
|
||||
}
|
||||
|
||||
static inline
|
||||
void InitializeResourceDirectory() {
|
||||
// if there is a resource directory in the working directory, prioritize that for debugging
|
||||
|
@ -53,12 +24,8 @@ void InitializeResourceDirectory() {
|
|||
|
||||
void InitializeResourceSubsystem() {
|
||||
InitializeResourceDirectory();
|
||||
g_resources = dictionary_from_type(ResourceContainer);
|
||||
}
|
||||
|
||||
void CleanResourceSubsystem() {
|
||||
list_foreach(ResourceContainer *,container, &g_resources.list)
|
||||
Internal_CleanResourceContainer(container);
|
||||
dictionary_empty(&g_resources);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,4 @@ extern void InitializeResourceSubsystem();
|
|||
//! Clean and shut down resource subsystem, all resource calls are invalid after this
|
||||
extern void CleanResourceSubsystem();
|
||||
|
||||
//! Load a model resource from disk, path is relative to the resource folder
|
||||
extern Model *ResourcesLoadModel(char const *res_path);
|
||||
//! Load a texture resource from disk, path is relative to the resource folder
|
||||
extern Texture *ResourcesLoadTexture(char const *res_path);
|
||||
|
||||
#endif // !RESOURCES_H
|
||||
|
|
Loading…
Reference in a new issue