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 CSDL_Ext;
CDefHandler * CHeroList::arrdo = NULL;
CDefHandler * CHeroList::arrup = NULL;
CDefHandler * CTownList::arrdo = NULL;
CDefHandler * CTownList::arrup = NULL;
CAdvMapInt::~CAdvMapInt()
{
SDL_FreeSurface(bg);
@ -125,6 +128,45 @@ void CList::deactivate()
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)
{
bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp");

View File

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

View File

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

View File

@ -34,6 +34,7 @@ class ClickableL : public virtual CIntObject //for left-clicks
{
public:
bool pressedL;
ClickableL();
virtual void clickLeft (tribool down)=0;
virtual void activate()=0;
virtual void deactivate()=0;
@ -42,6 +43,7 @@ class ClickableR : public virtual CIntObject //for right-clicks
{
public:
bool pressedR;
ClickableR();
virtual void clickRight (tribool down)=0;
virtual void activate()=0;
virtual void deactivate()=0;
@ -70,7 +72,7 @@ public:
virtual void yourTurn()=0{};
};
class CGlobalAI : public CGameInterface // callback for AI
class CGlobalAI : public CGameInterface // AI class (to derivate)
{
public:
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
an error reading or writing the files. */
SDL_Surface * ekran, * screen, * screen2;
TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX;
TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
int _tmain(int argc, _TCHAR* argv[])
{
@ -86,6 +86,7 @@ int _tmain(int argc, _TCHAR* argv[])
//TNR = TTF_OpenFont("Fonts\\tnr.ttf",10);
GEOR13 = TTF_OpenFont("Fonts\\georgia.ttf",13);
GEORXX = TTF_OpenFont("Fonts\\tnrb.ttf",22);
GEORM = TTF_OpenFont("Fonts\\georgia.ttf",10);
//initializing audio
CMusicHandler * mush = new CMusicHandler;

Binary file not shown.

View File

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