From 99c3b11d96dc709425c02ec115d93740bf50be8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Fri, 20 Jul 2007 23:37:12 +0000 Subject: [PATCH] * removed post-TSI rubbish from nodrze * HighButton is now main button class to inheriting * more of advanced options screen * minor stuff --- CMT.cpp | 8 ++++---- CMessage.h | 20 ++++++++++++++------ CPreGame.cpp | Bin 95986 -> 99810 bytes CPreGame.h | 26 +++++++++++++++++++++----- nodrze.h | 3 --- 5 files changed, 39 insertions(+), 18 deletions(-) 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 749eaee7d6adf4de840d84ae10c14b0f6f7e6a03..29ef7b173079c8e816a671b91985168f27694beb 100644 GIT binary patch delta 2015 zcmb7FUu;ul6hB`!N6XeScGs$*R{lEEs&m^g8^?7!o7Y@LfH zYVZjmCXxeQ@qxrQ6JBI9Ug@!M&@%KzIziL?ouif4 zc6j-(oqKrpT%tY#A_}xrB2}dnBtc$38}^T)37e!3Qa>H1E;94aa^RBUQ)$zG5HwH1 z*Yw}r9o4mYQ7uMU{>?TEH{botJF-2Z)sAuGy0C#0vbq4~R7&Fxfzwvwt3#Gz2u{(6pifokF@6V3eXLp#WIB zg$lh|l25}|1Jx6f20arO9=;W?;x|4rf;dY-_`${cms9{oQHyjL2k=P%rI3IMo@9+O z2^HFRaL*V_=Velyd(n5&Vq?DKCu`rFBa4j#G)710RXR+)G(bm7#hC2KS?od#nTKjb zFk==BhD%xKV{uX6(1mu(B)gGh4CX;xswv~#C!SrVwh3CJMfz`fv5(&xuHdx`FEp6S zFyaLPBIn7R2e||Is3^^&C3R|B>@>Tb9&iYsQZ#thXb6yU zD2v$d)4w-h|09*QWcgI1!e=JB`SavAJ2obW*B9fi3^sZg=hP4#pbX!c^w`c3yZ$I0 zGxe)O9V=zF8e0G8+I0v3BN)64#;~7SdHuep(pD1(9x1FPBmc9DNjqDWTagk5lCA1( zkmAygCsVatle#ZE4kJ1-#$^tcY70x z&BNGD93y-_?X&d0$Gj~Id@r0b{_3^9vwwO*SoI||yND_^dKuv&6uzF02vLD`EN^^* y7K>7Z?Z#A6SU(&SE&D<^QJ%t>&&LDTzlsTW_*p#kY=p0DwAkJ@{^84ShH|MS_6~XNfeWYN#wJ#O1=b> zJUAKwD3h;GMF%bbZUAxsJ(C|#8Iu-JKmjh3Sx_spEK;E6r{XvP2A51T0TPp3HCDHN bKLHLYlY})cm#|O)1efeu0SLF?XaNEp_ueaM 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: