mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +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:
parent
bbbfce798c
commit
99c3b11d96
8
CMT.cpp
8
CMT.cpp
@ -463,7 +463,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
}//keyup end
|
}//keyup end
|
||||||
else if(sEvent.type==SDL_MOUSEMOTION)
|
else if(sEvent.type==SDL_MOUSEMOTION)
|
||||||
{
|
{
|
||||||
if(sEvent.motion.x<5)
|
if(sEvent.motion.x<15)
|
||||||
{
|
{
|
||||||
scrollingLeft = true;
|
scrollingLeft = true;
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
{
|
{
|
||||||
scrollingLeft = false;
|
scrollingLeft = false;
|
||||||
}
|
}
|
||||||
if(sEvent.motion.x>screen->w-5)
|
if(sEvent.motion.x>screen->w-15)
|
||||||
{
|
{
|
||||||
scrollingRight = true;
|
scrollingRight = true;
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
{
|
{
|
||||||
scrollingRight = false;
|
scrollingRight = false;
|
||||||
}
|
}
|
||||||
if(sEvent.motion.y<5)
|
if(sEvent.motion.y<15)
|
||||||
{
|
{
|
||||||
scrollingUp = true;
|
scrollingUp = true;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
{
|
{
|
||||||
scrollingUp = false;
|
scrollingUp = false;
|
||||||
}
|
}
|
||||||
if(sEvent.motion.y>screen->h-5)
|
if(sEvent.motion.y>screen->h-15)
|
||||||
{
|
{
|
||||||
scrollingDown = true;
|
scrollingDown = true;
|
||||||
}
|
}
|
||||||
|
20
CMessage.h
20
CMessage.h
@ -20,15 +20,23 @@ struct OverButton
|
|||||||
virtual void show() ;
|
virtual void show() ;
|
||||||
virtual void press(bool down=true);
|
virtual void press(bool down=true);
|
||||||
};
|
};
|
||||||
template <class T=ttt> struct Button: public OverButton
|
struct HighButton: public OverButton
|
||||||
{
|
{
|
||||||
T fun;
|
HighButton( SDL_Rect Pos, CDefHandler* Imgs, bool Sel=false, int id=-1)
|
||||||
CGroup<T> * ourGroup;
|
{type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
|
||||||
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
|
HighButton(){}
|
||||||
:fun(Fun),ourGroup(gr){type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
|
|
||||||
Button(){ourGroup=NULL;};
|
|
||||||
bool selectable, selected;
|
bool selectable, selected;
|
||||||
bool highlightable, highlighted;
|
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 hover(bool on=true);
|
||||||
virtual void select(bool on=true);
|
virtual void select(bool on=true);
|
||||||
};
|
};
|
||||||
|
BIN
CPreGame.cpp
BIN
CPreGame.cpp
Binary file not shown.
26
CPreGame.h
26
CPreGame.h
@ -32,23 +32,39 @@ class RanSel
|
|||||||
};
|
};
|
||||||
class Options
|
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
|
struct PlayerOptions
|
||||||
{
|
{
|
||||||
|
PlayerOptions(int serial, int player);
|
||||||
Ecolor color;
|
Ecolor color;
|
||||||
//SDL_Surface * bg;
|
//SDL_Surface * bg;
|
||||||
Button<> left, right;
|
OptionSwitch left, right;
|
||||||
int nr;
|
int nr;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
Slider<> * turnLength;
|
Slider<> * turnLength;
|
||||||
SDL_Surface * bg;
|
SDL_Surface * bg,
|
||||||
|
* rHero, * rCastle, * nHero, * nCastle;
|
||||||
std::vector<SDL_Surface*> bgs;
|
std::vector<SDL_Surface*> bgs;
|
||||||
CDefHandler //* castles, * heroes, * bonus,
|
CDefHandler //* castles, * heroes, * bonus,
|
||||||
* left, * right;
|
* left, * right;
|
||||||
std::vector<PlayerOptions> poptions;
|
std::vector<PlayerOptions*> poptions;
|
||||||
void show();
|
void show();
|
||||||
void init();
|
void init();
|
||||||
//Options();
|
Options(){inited=showed=false;};
|
||||||
~Options();
|
~Options();
|
||||||
};
|
};
|
||||||
class MapSel
|
class MapSel
|
||||||
@ -107,7 +123,7 @@ public:
|
|||||||
std::vector<Slider<> *> interested;
|
std::vector<Slider<> *> interested;
|
||||||
CMusicHandler * mush;
|
CMusicHandler * mush;
|
||||||
CSemiLodHandler * slh ;
|
CSemiLodHandler * slh ;
|
||||||
std::vector<Button<> *> btns;
|
std::vector<HighButton *> btns;
|
||||||
CPreGameTextHandler * preth ;
|
CPreGameTextHandler * preth ;
|
||||||
SDL_Rect * currentMessage;
|
SDL_Rect * currentMessage;
|
||||||
SDL_Surface * behindCurMes;
|
SDL_Surface * behindCurMes;
|
||||||
|
3
nodrze.h
3
nodrze.h
@ -16,9 +16,6 @@
|
|||||||
#define CLOG(a) (std::cout<<a)
|
#define CLOG(a) (std::cout<<a)
|
||||||
#endif
|
#endif
|
||||||
const bool CZERWONY=true, CZARNY=false;
|
const bool CZERWONY=true, CZARNY=false;
|
||||||
class TTAICore;
|
|
||||||
extern TTAICore * C;
|
|
||||||
|
|
||||||
template <typename T> class wezel
|
template <typename T> class wezel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user