I'm trying to create a game for my own entertainement, and for some reason, it gives me an error.
I'm posting the entire thing so far.
Main.cpp
main.hCode://Inculde the main header file #include "main.h" //Incude the global variable allocation header #include "globalvar.h" //Game initialization function. Gets the game ready to run. int functMainStartGame() { global.exitgame = false; } //Step function, for the main program. All main program code executed here. int functMainStep() { //while(global.exitgame == false) //{ ////put code for game here. //} } //Game ending function. Ends classes, closes rendering system, ect. int functMainEndGame() { } int main() { functMainStartGame(); functMainStep(); functMainEndGame(); return 0; }
Code://todo: Add header files to declare here. //create global variable container. struct globalStruct { int exitgame; int *entities[0]; int numbofentities; }; extern globalStruct global;//declare it
And globalvar.h
EDIT: Oh, entites.cpp too.Code:globalStruct global;
http://img170.imageshack.us/img170/9614/whatdk4.pngCode:#include "globalvar.h" class entMain { public: int myx; int myy; float xspeed; float yspeed; entMain(int x, int y) { global.instances[global.numbofentities] = &this; global.numbofentities += 1; } ~entMain() { } int entRepeatMe() { } };
I'm,using Dev C++ v4.9.9.2.
Please note I am just beginning at C++, so it may have been something simple.
Thanks
-CornJer



LinkBack URL
About LinkBacks



tr_vector<> for this job. It will automatically call destructors for your objects as they're removed, and it will automatically call destructors when your program ends.