Sign in to follow this  
  • entries
    223
  • comments
    165
  • views
    79183

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

Sign in to follow this  
Stephen R

77 views

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_Managers

public:
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.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now