Day 3 - The resources, they're all around me!

posted in Perpetual Alpha
Published November 21, 2004
Advertisement
More work done today. I got the window creation code in yesterday night, just tested it out today. A few small bug fixes in the singleton, base object, and smart pointer classes. I got the game-state system finished. It's an important component of the engine but it didn't take me that long to put together.

Most of what I was working on today is my resource manager system. I figured out how to load / manage different resource types. I came up with a structure like this :

class CGeneralResourceManger {protected:	std::map< int, CBaseResourceManager > m_Managerspublic:	CBaseResourceManager GetManager(int ID);	void AddManager(CBaseResourceManager Manager);	void LoadResources(char* FileName);};class CBaseResource {public:	virtual void Load(char* FileName);};class CBaseResourceManager {public:	virtual CBaseResource GetResource(std::string ID);	virtual void LoadResource(std::string FileName, std::string ID);};template <class Type>class CResourceManager : public CBaseResourceManager {protected:	std::map< std::string , Type > m_Resources;public:	CBaseResource GetResource(std::string ID);	void LoadResource(std::string FileName, std::string ID);};


The CGeneralResourceManager::LoadResources function will take a file that contains a list of file to be loaded along with their ids and resource type id. So once the resources are loaded the client can then get whatever they want. My current issue Wait, typing this poist just made something go click. The resource file will be loaded up into a seperate structure which will be stored by the client. It is passed to the ResourceManager to load all the resources into memory. Then to unload them the user passes this structure back to the ResourceManager again and it frees the stuff again. This will allow me to create these resource lists in code as well as in files.

Okay, I should be able to get that coded up tomorrow - I'm going to work on the game's design doc a bit. Once that section of code is going and integrated with the kernel I'll be able to get down to getting the input, gfx and GUI code together.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement