1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* removed post-TSI rubbish from nodrze

* HighButton is now main button class to inheriting
* more of advanced options screen 
* minor stuff
This commit is contained in:
Michał W. Urbańczyk 2007-07-20 23:37:12 +00:00
parent bbbfce798c
commit 99c3b11d96
5 changed files with 39 additions and 18 deletions

View File

@ -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;
}

View File

@ -20,15 +20,23 @@ struct OverButton
virtual void show() ;
virtual void press(bool down=true);
};
template <class T=ttt> struct Button: public OverButton
struct HighButton: public OverButton
{
T fun;
CGroup<T> * ourGroup;
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* 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 <class T=ttt> struct Button: public HighButton
{
CGroup<T> * ourGroup;
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* 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);
};

Binary file not shown.

View File

@ -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<SDL_Surface*> bgs;
CDefHandler //* castles, * heroes, * bonus,
* left, * right;
std::vector<PlayerOptions> poptions;
std::vector<PlayerOptions*> poptions;
void show();
void init();
//Options();
Options(){inited=showed=false;};
~Options();
};
class MapSel
@ -107,7 +123,7 @@ public:
std::vector<Slider<> *> interested;
CMusicHandler * mush;
CSemiLodHandler * slh ;
std::vector<Button<> *> btns;
std::vector<HighButton *> btns;
CPreGameTextHandler * preth ;
SDL_Rect * currentMessage;
SDL_Surface * behindCurMes;

View File

@ -16,9 +16,6 @@
#define CLOG(a) (std::cout<<a)
#endif
const bool CZERWONY=true, CZARNY=false;
class TTAICore;
extern TTAICore * C;
template <typename T> class wezel
{
public: