Archived

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

IFooBar

globals

Recommended Posts

IFooBar    906
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
amish1234    104
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