Jump to content
  • Advertisement

Archived

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

carb

Programming Structure - help?

This topic is 5485 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

I''m having quite a time figuring out how to lay out my classes in an engine I''m developing. I''ll lay out how I think it should work, but some problems which have arisen. One problem in particular eludes me ... It begins with an application class, which contains a variety of other classes ... right now, just a graphics one. See, I''m thinking of adding a "log" class, such that I can post problems to a log file. I want this kind of functionality in the graphics class as well, but not to a different file, to the same file. Does this mean I need to pass a pointer to the same instance of a log class to the graphics class? Or can I use extern in some silly way to accomplish this. Appreciate any help, - Ben

Share this post


Link to post
Share on other sites
Advertisement
Wouldn''t you want a different log file for each of the systems? However you have your log system set up, I would make sure that you can have separate logs so that you don''t have to filter through hundreds of lines of video system output to find the couple of lines of network system output.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Make Application a singleton and put your log object in Application as a static. Then you can access it from everywhere.

Just lookout if you are using threads, then you will have to synchronize your access to the log object.

\\Magnus

Share this post


Link to post
Share on other sites
I also suggest you read the "Enginuity" series of articles here at gamedev.net. They're very helpful for this kind of stuff.

[edited by - Erkki on August 16, 2003 8:39:25 AM]

Share this post


Link to post
Share on other sites
I''ve been reading about Singletons ... how exactly do you access them from everywhere? That''s the part that I''m confused about.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!