Skip to main content

article-not-yet-posted


sorry - article not yet posted...

Comments

Popular posts from this blog

Resource Manager - (Game Resource Management)

Resource Manager - (Game Development Resource Management)


#include "ResLoader.cpp"


Definition: MANAGER:

classManager{public:virtualvoidDestroy()=0;virtual~Manager(){}public:ds::astringname;};
Manager member variables:
ds::astring name;
nameis the name of the  resource manager.

Definition: RESOURCE-MANAGER:
template<classAsset>classResourceManager:publicManager{typedefbool(*DeleteAssetFuncPtr)(Asset*asset);DeleteAssetFuncPtrDeleteAssetFunc;public:typedefds::dlist<ResourceLoader<Asset>*>ResourceLoaders;typedefstd::map<ds::astring,ResourceLoaders*>ResourceLoaderMap;typedefds::dlist<Resource<Asset>*>AssetList;typedefstd::map<ds::astring,AssetList*>AssetMap;public:voidAddLoader(ResourceLoader<Asset>*resource_loader);ResourceLoader<Asset>*GetLoader(ds::astringconst&file_ext);AssetList*GetResourceList(ds::astringconst&name);Asset*A

Game Resource Management

Game Resource Manager
Requirements Sound understanding C++, pointer, and template.basic understanding of std::vector and std::map. 
Depending on your level of programming in C++ this tutorial maybe easy or hard to comprehend. I will try to explain things in a way that is simple to understand. Note that the resource manager here uses C++ template. If you don’t know what a template is in C++, it is highly recommend that you review and understand it before you read this article. This is a general-purpose resource manager; C++ templates will allow us to use the same class to create many different resource-manager to manage different objects of different type. The core resource manager will be used to create manage resource managers automatically, and manage them. 


@Noteds::dlist is my own custom linked list. std::vector can be used instead.  @Note ds::astring is my own custom string. std::string can be used instead.
Introduction
What is a Game Resource Manager? A game resource manager manages ob…

Using CoreResMgr and ResMgr and ResLoader - (Game Resource Management)

Using CoreResMgr and ResMgr and ResLoader

Implementing ResLoader. All that is needed to be done is inherit ResLoader and override the load method.

#include "ResourceManager"

classFontResLoader:publickege::res::ResLoader<gfx::FontSheet>{public:gfx::FontSheet*Load(constLoaderContext&info,kege::ds::astringconst&filename);FontResLoader();};
Overriding the load method is don't like so.


gfx::FontSheet*FontResLoader::Load(constLoaderContext&amp;context,kege::ds::astringconst&amp;filename){// use the resumer member var pointer to create the new a font resource assetgfx::FontSheet*font=resmgr-&gt;Create(context.name);if(!font)returnfont;// since my font class has a load function to i use it to load the filenameif(!font-&gt;Load(filename.c_str())){resmgr-&gt;Delete(context.name);returnnullptr;}// then i use the context data to set the font namefont-&gt;SetName(context.name);font-&gt;SetSID(context.name);returnfont;}FontResLoader::FontResLoader(…