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

Mainly more improvements in CPreGame

This commit is contained in:
Michał W. Urbańczyk 2007-08-25 04:56:25 +00:00
parent ad68aa3dea
commit ab3a06bf69
7 changed files with 80 additions and 6 deletions

View File

@ -5,7 +5,10 @@ extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
using namespace boost::logic; using namespace boost::logic;
using namespace CSDL_Ext; using namespace CSDL_Ext;
CDefHandler * CHeroList::arrdo = NULL;
CDefHandler * CHeroList::arrup = NULL;
CDefHandler * CTownList::arrdo = NULL;
CDefHandler * CTownList::arrup = NULL;
CAdvMapInt::~CAdvMapInt() CAdvMapInt::~CAdvMapInt()
{ {
SDL_FreeSurface(bg); SDL_FreeSurface(bg);
@ -125,6 +128,45 @@ void CList::deactivate()
void CList::clickLeft(tribool down) void CList::clickLeft(tribool down)
{ {
}; };
CHeroList::CHeroList()
{
pos = genRect(192,64,609,196);
}
void CHeroList::select(int which)
{
}
void CHeroList::clickLeft(tribool down)
{
}
void CHeroList::clickRight(tribool down)
{
}
void CHeroList::hover (bool on)
{
}
void CHeroList::keyPressed (SDL_KeyboardEvent & key)
{
}
CTownList::CTownList()
{
pos = genRect(192,48,747,196);
arrdo = NULL;
}
void CTownList::select(int which)
{
}
void CTownList::clickLeft(tribool down)
{
}
void CTownList::clickRight(tribool down)
{
}
void CTownList::hover (bool on)
{
}
void CTownList::keyPressed (SDL_KeyboardEvent & key)
{
}
CStatusBar::CStatusBar(int x, int y) CStatusBar::CStatusBar(int x, int y)
{ {
bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp"); bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp");

View File

@ -34,6 +34,7 @@ public:
class CList class CList
: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject : public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject
{ {
public:
SDL_Surface * bg; SDL_Surface * bg;
//arrow up, arrow down //arrow up, arrow down
int posw, posh; //position width/height int posw, posh; //position width/height
@ -46,14 +47,28 @@ class CList
class CHeroList class CHeroList
: public CList : public CList
{ {
public:
static CDefHandler *arrup, *arrdo;
CHeroList();
void select(int which); void select(int which);
void clickLeft(tribool down);
void clickRight(tribool down); void clickRight(tribool down);
void hover (bool on);
void keyPressed (SDL_KeyboardEvent & key);
}; };
class CTownList class CTownList
: public CList : public CList
{ {
public:
static CDefHandler *arrup, *arrdo;
CTownList();
void select(int which); void select(int which);
void clickLeft(tribool down);
void clickRight(tribool down); void clickRight(tribool down);
void hover (bool on);
void keyPressed (SDL_KeyboardEvent & key);
}; };
class CResourceBar class CResourceBar
:public ClickableR, public CIntObject :public ClickableR, public CIntObject
@ -161,6 +176,9 @@ public:
CStatusBar statusbar; CStatusBar statusbar;
CHeroList heroList;
CTownList townList;
//fuctions binded to buttons //fuctions binded to buttons
void fshowOverview(); void fshowOverview();
void fswitchLevel(); void fswitchLevel();

View File

@ -28,6 +28,10 @@ void CButtonBase::show()
} }
} }
ClickableL::ClickableL()
{
pressedL=false;
}
void ClickableL::clickLeft(tribool down) void ClickableL::clickLeft(tribool down)
{ {
if (down) if (down)
@ -44,6 +48,10 @@ void ClickableL::deactivate()
LOCPLINT->lclickable.erase LOCPLINT->lclickable.erase
(std::find(LOCPLINT->lclickable.begin(),LOCPLINT->lclickable.end(),this)); (std::find(LOCPLINT->lclickable.begin(),LOCPLINT->lclickable.end(),this));
} }
ClickableR::ClickableR()
{
pressedR=false;
}
void ClickableR::activate() void ClickableR::activate()
{ {
LOCPLINT->rclickable.push_back(this); LOCPLINT->rclickable.push_back(this);

View File

@ -34,6 +34,7 @@ class ClickableL : public virtual CIntObject //for left-clicks
{ {
public: public:
bool pressedL; bool pressedL;
ClickableL();
virtual void clickLeft (tribool down)=0; virtual void clickLeft (tribool down)=0;
virtual void activate()=0; virtual void activate()=0;
virtual void deactivate()=0; virtual void deactivate()=0;
@ -42,6 +43,7 @@ class ClickableR : public virtual CIntObject //for right-clicks
{ {
public: public:
bool pressedR; bool pressedR;
ClickableR();
virtual void clickRight (tribool down)=0; virtual void clickRight (tribool down)=0;
virtual void activate()=0; virtual void activate()=0;
virtual void deactivate()=0; virtual void deactivate()=0;
@ -70,7 +72,7 @@ public:
virtual void yourTurn()=0{}; virtual void yourTurn()=0{};
}; };
class CGlobalAI : public CGameInterface // callback for AI class CGlobalAI : public CGameInterface // AI class (to derivate)
{ {
public: public:
virtual void yourTurn(){}; virtual void yourTurn(){};

View File

@ -59,7 +59,7 @@ const char * NAME = "VCMI 0.3";
version of the library linked do not match, or Z_ERRNO if there is version of the library linked do not match, or Z_ERRNO if there is
an error reading or writing the files. */ an error reading or writing the files. */
SDL_Surface * ekran, * screen, * screen2; SDL_Surface * ekran, * screen, * screen2;
TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
int _tmain(int argc, _TCHAR* argv[]) int _tmain(int argc, _TCHAR* argv[])
{ {
@ -86,6 +86,7 @@ int _tmain(int argc, _TCHAR* argv[])
//TNR = TTF_OpenFont("Fonts\\tnr.ttf",10); //TNR = TTF_OpenFont("Fonts\\tnr.ttf",10);
GEOR13 = TTF_OpenFont("Fonts\\georgia.ttf",13); GEOR13 = TTF_OpenFont("Fonts\\georgia.ttf",13);
GEORXX = TTF_OpenFont("Fonts\\tnrb.ttf",22); GEORXX = TTF_OpenFont("Fonts\\tnrb.ttf",22);
GEORM = TTF_OpenFont("Fonts\\georgia.ttf",10);
//initializing audio //initializing audio
CMusicHandler * mush = new CMusicHandler; CMusicHandler * mush = new CMusicHandler;

Binary file not shown.

View File

@ -177,12 +177,13 @@ class MapSel : public PreGameTab
public: public:
ESortBy sortBy; ESortBy sortBy;
SDL_Surface * bg; SDL_Surface * bg;
int selected; int selected; //selected map
CDefHandler * Dtypes, * Dvic; CDefHandler * Dtypes, * Dvic;
CDefHandler *Dsizes, * Dloss; CDefHandler *Dsizes, * Dloss,
* sFlags;
std::vector<Mapa*> scenList; std::vector<Mapa*> scenList;
std::vector<SDL_Surface*> scenImgs; std::vector<SDL_Surface*> scenImgs;
int current; //int current;
std::vector<CMapInfo> ourMaps; std::vector<CMapInfo> ourMaps;
IntBut<> small, medium, large, xlarge, all; IntBut<> small, medium, large, xlarge, all;
SetrButton<> nrplayer, mapsize, type, name, viccon, loscon; SetrButton<> nrplayer, mapsize, type, name, viccon, loscon;
@ -198,6 +199,7 @@ public:
void select(int which, bool updateMapsList=true); void select(int which, bool updateMapsList=true);
void moveByOne(bool up); void moveByOne(bool up);
void printSelectedInfo(); void printSelectedInfo();
void printFlags();
MapSel(); MapSel();
~MapSel(); ~MapSel();
}; };
@ -224,6 +226,7 @@ class CPreGame
{ {
public: public:
std::string playerName; std::string playerName;
int playerColor;
HighButton * highlighted; HighButton * highlighted;
PreGameTab* currentTab; PreGameTab* currentTab;
StartInfo ret; StartInfo ret;