#pragma once

#include <stddef.h>
#include "entity.h"
#include "main.h" // struct entities

typedef char * name_T;

struct blob {
	void *data;
	size_t size;
};

struct funs {
	void *(*newfun)(struct entities *entities);
	int (*setfun)(void *const restrict self, char const *const restrict key, char const *const restrict value);
};

void res_free_texture(void);
struct blob res_get_texture(name_T const name);

void res_free_map(void);
struct blob res_get_map(name_T const name);

void res_free_collision(void);
struct blob res_get_collision(name_T const name);

void res_free_fun(void);
void res_push_fun(void *(*newfun)(struct entities *entities), int (*setfun)(void *const restrict self, char const *const restrict key, char const *const restrict value), name_T name);
struct funs res_get_fun(name_T const name);

int loadResources(char *filename);