• Advertisement

Archived

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

globals

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

hi whats the best way use globals for game development ? i mean like should the globals be in a struct and then just make an object of that struct wherever, or all in a class? or all on the main cpp file? anyone?

Share this post


Link to post
Share on other sites
Advertisement
I use classes for the D3D and DInput variables, like the devices and objects. The objects for these classes, along with some other variables are globals. I have a globals.h file that says "extern type name;" and then in the Init.cpp I declare them with "type name;"
extern tells all the .cpp files that the variable may be declared in another .cpp.

Proceeding on a brutal rampage is the obvious choice.

Share this post


Link to post
Share on other sites
This has been debated to death a couple of times. Click the search button and enter "globals" to read it.

Take care,
Bill

Share this post


Link to post
Share on other sites

  • Advertisement