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?
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.
extern tells all the .cpp files that the variable may be declared in another .cpp.
Proceeding on a brutal rampage is the obvious choice.
This has been debated to death a couple of times. Click the search button and enter "globals" to read it.
Take care,
Bill
Take care,
Bill
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement