CMakeTemplate/resource/resource.h
2016-04-22 17:31:30 +02:00

30 lines
965 B
C++

#ifndef RES_H
#define RES_H
#include <string>
#include <unordered_map>
#define RESOURCE_PACK(pack) namespace Resource {\
void getResourcePack_ ## pack(ResourceMap &resourceFilesData);\
}
/**
* To load an attached resource pack file, you must declare the pack with :
* RESOURCE_PACK(pack_name)
* it will allow you to use the function :
* getResourcePack_pack_name(ResourceMap &map)
* This function will give access the the embedded data through its original file name,
* using the provided map.
*
* example :
* RESOURCE_PACK(shaders) // declaring the resource pack function
* Resource::ResourceMap myShaders; // defining a resource map
* Resource::getResourcePack(myShaders); // putting the resources of the resource pack in the map
* string *shader = new string(myShaders["shaders/shaderFile.glsl"]); // getting a resource file
*/
namespace Resource {
typedef std::unordered_map<std::string, const char*> ResourceMap;
}
#endif // RES_H