diff --git a/CMT.cpp b/CMT.cpp index 20c9a2e88..9116b7ec9 100644 --- a/CMT.cpp +++ b/CMT.cpp @@ -463,7 +463,7 @@ int _tmain(int argc, _TCHAR* argv[]) }//keyup end else if(sEvent.type==SDL_MOUSEMOTION) { - if(sEvent.motion.x<5) + if(sEvent.motion.x<15) { scrollingLeft = true; } @@ -471,7 +471,7 @@ int _tmain(int argc, _TCHAR* argv[]) { scrollingLeft = false; } - if(sEvent.motion.x>screen->w-5) + if(sEvent.motion.x>screen->w-15) { scrollingRight = true; } @@ -479,7 +479,7 @@ int _tmain(int argc, _TCHAR* argv[]) { scrollingRight = false; } - if(sEvent.motion.y<5) + if(sEvent.motion.y<15) { scrollingUp = true; } @@ -487,7 +487,7 @@ int _tmain(int argc, _TCHAR* argv[]) { scrollingUp = false; } - if(sEvent.motion.y>screen->h-5) + if(sEvent.motion.y>screen->h-15) { scrollingDown = true; } diff --git a/CMessage.h b/CMessage.h index 574c16399..4d0adbcbb 100644 --- a/CMessage.h +++ b/CMessage.h @@ -20,15 +20,23 @@ struct OverButton virtual void show() ; virtual void press(bool down=true); }; -template struct Button: public OverButton +struct HighButton: public OverButton { - T fun; - CGroup * ourGroup; - Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup* gr=NULL, int id=-1) - :fun(Fun),ourGroup(gr){type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;}; - Button(){ourGroup=NULL;}; + HighButton( SDL_Rect Pos, CDefHandler* Imgs, bool Sel=false, int id=-1) + {type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;}; + HighButton(){} bool selectable, selected; bool highlightable, highlighted; + virtual void hover(bool on=true)=0; + virtual void select(bool on=true)=0; +}; +template struct Button: public HighButton +{ + CGroup * ourGroup; + Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup* gr=NULL, int id=-1) + :HighButton(Pos,Imgs,Sel,id),ourGroup(gr),fun(Fun){}; + Button(){ourGroup=NULL;}; + T fun; virtual void hover(bool on=true); virtual void select(bool on=true); }; diff --git a/CPreGame.cpp b/CPreGame.cpp index 749eaee7d..29ef7b173 100644 Binary files a/CPreGame.cpp and b/CPreGame.cpp differ diff --git a/CPreGame.h b/CPreGame.h index 3983db10f..d6849ab14 100644 --- a/CPreGame.h +++ b/CPreGame.h @@ -32,23 +32,39 @@ class RanSel }; class Options { + bool inited, showed; + struct OptionSwitch:public HighButton + { + void hover(bool on=true){}; + void select(bool on=true){}; + OptionSwitch( SDL_Rect Pos, CDefHandler* Imgs) + :HighButton(Pos,Imgs,false,7) + {selectable=false;highlightable=false;} + void press(bool down=true); + bool left; + int playerID; + int serialID; + int which; //-1=castle;0=hero;1=bonus + }; struct PlayerOptions { + PlayerOptions(int serial, int player); Ecolor color; //SDL_Surface * bg; - Button<> left, right; + OptionSwitch left, right; int nr; }; public: Slider<> * turnLength; - SDL_Surface * bg; + SDL_Surface * bg, + * rHero, * rCastle, * nHero, * nCastle; std::vector bgs; CDefHandler //* castles, * heroes, * bonus, * left, * right; - std::vector poptions; + std::vector poptions; void show(); void init(); - //Options(); + Options(){inited=showed=false;}; ~Options(); }; class MapSel @@ -107,7 +123,7 @@ public: std::vector *> interested; CMusicHandler * mush; CSemiLodHandler * slh ; - std::vector *> btns; + std::vector btns; CPreGameTextHandler * preth ; SDL_Rect * currentMessage; SDL_Surface * behindCurMes; diff --git a/nodrze.h b/nodrze.h index a6f8bcac5..efc3b5a92 100644 --- a/nodrze.h +++ b/nodrze.h @@ -16,9 +16,6 @@ #define CLOG(a) (std::cout< class wezel { public: