globals

Started by
1 comment, last by IFooBar 21 years, 11 months ago
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?
[size=2]aliak.net
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.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
This has been debated to death a couple of times. Click the search button and enter "globals" to read it.

Take care,
Bill

This topic is closed to new replies.

Advertisement