Archived

This topic is now archived and is closed to further replies.

Code design

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For my game I''m using the current structure at the moment: CDraw - Gains full control over hardware, sets resolution, loads bitmaps to surfaces. CAnimation - Contains 1 surface which it loads using CDraw, holds information about animationspeed, framecount etc. CObject - Has indices to several animations, all game objects players, items etc. will be derived from this baseclass. CAnimation has to use CDraw, and CObject has to use CAnimation, CInput, CTime etc. At the moment I''ve solved this by giving each CAnimation class a pointer to CDraw, by giving each CObject class several pointers to CAnimation classes, 1 to CInput etc. This doesn''t seem like the ideal solution. All those pointers to the same class. Does anyone have a suggestion to solve this? Thanks, Tristan

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I would recommend you to read
"Design Patterns" (GOF gang of four),
this book covers a lot of design-problems
and how to solve them.
Just a thought...

Share this post


Link to post
Share on other sites