Game architecture with directx

Started by
9 comments, last by moonshot 20 years, 6 months ago
I think you''re on the right track, the way I do things is similar:

pGraphics: Handles everything graphic-related
pObject: Just some object than can have a texture

/*
Loads the texture and add it to a vector of texture data,
that has at least the identifier and address, I keep the
size and color key too
*/
pGraphics->AddTexture("identifier", "path", ...);

/*
Assing a texture to an object, look for the texture in its
data vector
*/
pObject->SetTexture("texture identifier");

So pObject must have access to the graphic class, and it uses the identifier (which is an string, can be anything really) to find the appropiate one.

When you don''t need them anymore you can call something like:

pGraphics->ReleaseTextures();

That can just scan the vector releasing the texture, then it''s own space.

Hope that was clear.

This topic is closed to new replies.

Advertisement