Jump to content
  • Advertisement

Archived

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

IFooBar

globals

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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!