55 lines
903 B
C++
55 lines
903 B
C++
#pragma once
|
|
#ifndef RESSOURCE
|
|
#define RESSOURCE
|
|
|
|
#include <vector>
|
|
|
|
enum ressourceType
|
|
{
|
|
xr_mesh_type,
|
|
xr_shader_type,
|
|
xr_texture_type
|
|
};
|
|
|
|
class Xr_Ressource
|
|
{
|
|
public:
|
|
Xr_Ressource();
|
|
Xr_Ressource(char*, ressourceType);
|
|
Xr_Ressource(ressourceType);
|
|
virtual ~Xr_Ressource();
|
|
|
|
char* const getName() const;
|
|
bool isLoaded() const;
|
|
ressourceType getType() const;
|
|
|
|
|
|
protected:
|
|
char *R_name;
|
|
bool R_isLoaded;
|
|
ressourceType R_type;
|
|
};
|
|
|
|
class Xr_RessourceManager
|
|
{
|
|
public:
|
|
Xr_RessourceManager();
|
|
~Xr_RessourceManager();
|
|
|
|
static bool instanced();
|
|
static Xr_RessourceManager* getInstance();
|
|
static void quitInstance();
|
|
|
|
bool load(ressourceType, char*);
|
|
void unload(ressourceType, char*);
|
|
void unloadAll();
|
|
|
|
Xr_Ressource* get(ressourceType, char*);
|
|
|
|
private:
|
|
static Xr_RessourceManager *R_instance;
|
|
std::vector<Xr_Ressource*> R_ressourcesList;
|
|
};
|
|
|
|
#endif
|