Anybody see what is going wrong here? i am compiling using codeblocks, when i try to make the ResetState class inherit from the StateEngine class i get error
"expected unqualified-id before "public"
|
||=== Build finished: 1 errors, 0 warnings ===|
other classes are working fine as inherited, and the project has been built ok,
its only when i add the text to make resetstate inherit that the problem occurs
i have cleaned and done rebuild also.
i cant see what i am doing wrong,
below is the base class, resetstate class and resetstate constructor
Base Class in header Globals.h >
ResetState Class in header reset.h >Code:#ifndef GLOBALS_H_INCLUDED #define GLOBALS_H_INCLUDED #include <SDL/SDL_events.h> #include <SDL/SDL_image.h> extern SDL_Surface* screen; extern SDL_Surface* temp; extern SDL_Event event; class StateEngine //Base class { public: virtual void HandleEvents() = 0; virtual void Do_Logic() = 0; virtual void Render() = 0; virtual ~StateEngine(){}; }; #endif // GLOBALS_H_INCLUDED
The Constructor for ResetState in source file of same name >Code:#ifndef RESET_H_INCLUDED #define RESET_H_INCLUDED #include <SDL/SDL.h> #include <SDL/SDL_events.h> #include <SDL/SDL_image.h> #include "Constants.h" #include "Globals.h" class ResetState public : StateEngine { private: SDL_Surface* Resetsourcemsg; SDL_Surface* Buttonsource; SDL_Rect resetmsg; SDL_Rect resetclip; SDL_Rect optionbutton[2]; SDL_Rect optionclip[2]; int count; int anim_count; int testX, testY; public: void HandleEvents(); void Do_Logic(); void Render(); ResetState(); ~ResetState(); }; #endif // RESET_H_INCLUDED
Code:#include <SDL/SDL.h> #include <SDL/SDL_events.h> #include <SDL/SDL_image.h> #include "Utilities.h" #include "Constants.h" #include "Globals.h" #include "reset.h" ResetState::ResetState() { temp = NULL; //this is global Resetsourcemsg = NULL; Buttonsource = NULL; temp = SDL_LoadBMP("Gameinfo.bmp"); Resetsourcemsg = SDL_DisplayFormat(temp); SDL_FreeSurface(temp); temp = SDL_LoadBMP("Buttonsheet.bmp"); Buttonsource = SDL_DisplayFormat(temp); SDL_FreeSurface(temp); testX = 0, testY = 0; anim_count = 0; resetmsg.x = 330; //the reset game yes/no? message box resetmsg.y = 580; resetmsg.w = 500; resetmsg.h = 100; //for the sake of brevity i have removed the rest of the constructor, it just // initialises the remaining SDL_Rect objects as in above resetmsg.x = etc. }



LinkBack URL
About LinkBacks


