mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Several bugfixes and half-done things.
This commit is contained in:
parent
7c0f9afc9f
commit
e1b2ae0df1
@ -4,8 +4,8 @@ void CEmptyAI::init(CCallback * CB)
|
|||||||
{
|
{
|
||||||
cb = CB;
|
cb = CB;
|
||||||
human=false;
|
human=false;
|
||||||
playerID=-1;
|
playerID=cb->getMyColor();
|
||||||
serialID=-1;
|
serialID=cb->getMySerial();
|
||||||
std::cout << "EmptyAI initialized." << std::endl;
|
std::cout << "EmptyAI initialized." << std::endl;
|
||||||
}
|
}
|
||||||
void CEmptyAI::yourTurn()
|
void CEmptyAI::yourTurn()
|
||||||
|
@ -1299,6 +1299,7 @@ void CAdvMapInt::show()
|
|||||||
townList.activate();
|
townList.activate();
|
||||||
townList.draw();
|
townList.draw();
|
||||||
terrain.activate();
|
terrain.activate();
|
||||||
|
update();
|
||||||
|
|
||||||
resdatabar.draw();
|
resdatabar.draw();
|
||||||
|
|
||||||
@ -1376,7 +1377,11 @@ void CAdvMapInt::handleRightClick(std::string text, tribool down, CIntObject * c
|
|||||||
{
|
{
|
||||||
for (int i=0;i<LOCPLINT->objsToBlit.size();i++)
|
for (int i=0;i<LOCPLINT->objsToBlit.size();i++)
|
||||||
{
|
{
|
||||||
if (LOCPLINT->objsToBlit[i]->owner==client)
|
//TODO: pewnie da sie to zrobic lepiej, ale nie chce mi sie. Wolajacy obiekt powinien informowac kogo spodziewa sie odwolac (null jesli down)
|
||||||
|
CSimpleWindow * pom = dynamic_cast<CSimpleWindow*>(LOCPLINT->objsToBlit[i]);
|
||||||
|
if (!pom)
|
||||||
|
continue;
|
||||||
|
if (pom->owner==client)
|
||||||
{
|
{
|
||||||
LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+(i));
|
LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+(i));
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,7 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
|
|||||||
if (!blockvis)
|
if (!blockvis)
|
||||||
{
|
{
|
||||||
curd.successful = true;
|
curd.successful = true;
|
||||||
|
hero->pos = curd.dst;
|
||||||
int heroSight = hero->getSightDistance();
|
int heroSight = hero->getSightDistance();
|
||||||
|
|
||||||
int xbeg = stpos.x - heroSight - 2;
|
int xbeg = stpos.x - heroSight - 2;
|
||||||
@ -154,7 +155,6 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hero->pos = curd.dst;
|
|
||||||
int nn=0; //number of interfece of currently browsed player
|
int nn=0; //number of interfece of currently browsed player
|
||||||
for(std::map<int, PlayerState>::iterator j=CGI->state->players.begin(); j!=CGI->state->players.end(); ++j)//CGI->state->players.size(); ++j) //for testing
|
for(std::map<int, PlayerState>::iterator j=CGI->state->players.begin(); j!=CGI->state->players.end(); ++j)//CGI->state->players.size(); ++j) //for testing
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
|
|||||||
vis[iii]->state->onHeroVisit(vis[iii],curd.ho->subID);
|
vis[iii]->state->onHeroVisit(vis[iii],curd.ho->subID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else //interaction with blocking object (like resources)
|
||||||
{
|
{
|
||||||
curd.successful = false;
|
curd.successful = false;
|
||||||
CGI->playerint[gs->players[hero->getOwner()].serial]->heroMoved(curd);
|
CGI->playerint[gs->players[hero->getOwner()].serial]->heroMoved(curd);
|
||||||
@ -194,7 +194,6 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return true; //move ended - no more movement points
|
return true; //move ended - no more movement points
|
||||||
//hero->pos = curd.dst;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -245,7 +244,7 @@ const CGHeroInstance * CCallback::getHeroInfo(int player, int val, bool mode) //
|
|||||||
|
|
||||||
int CCallback::getResourceAmount(int type)
|
int CCallback::getResourceAmount(int type)
|
||||||
{
|
{
|
||||||
return gs->players[gs->currentPlayer].resources[type];
|
return gs->players[player].resources[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
int CCallback::getDate(int mode)
|
int CCallback::getDate(int mode)
|
||||||
@ -347,6 +346,14 @@ bool CCallback::isVisible(int3 pos)
|
|||||||
return isVisible(pos,player);
|
return isVisible(pos,player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CCallback::getMyColor()
|
||||||
|
{
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
int CCallback::getMySerial()
|
||||||
|
{
|
||||||
|
return gs->players[player].serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int3 CScriptCallback::getPos(CGObjectInstance * ob)
|
int3 CScriptCallback::getPos(CGObjectInstance * ob)
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
std::vector < std::string > getObjDescriptions(int3 pos); //returns descriptions of objects at pos in order from the lowest to the highest
|
std::vector < std::string > getObjDescriptions(int3 pos); //returns descriptions of objects at pos in order from the lowest to the highest
|
||||||
std::vector < const CGHeroInstance *> * getHeroesInfo(bool onlyOur=true);
|
std::vector < const CGHeroInstance *> * getHeroesInfo(bool onlyOur=true);
|
||||||
bool isVisible(int3 pos);
|
bool isVisible(int3 pos);
|
||||||
|
int getMyColor();
|
||||||
|
int getMySerial();
|
||||||
|
|
||||||
//friends
|
//friends
|
||||||
friend int _tmain(int argc, _TCHAR* argv[]);
|
friend int _tmain(int argc, _TCHAR* argv[]);
|
||||||
|
84
CMessage.cpp
84
CMessage.cpp
@ -200,7 +200,47 @@ std::pair<int,int> CMessage::getMaxSizes(std::vector<std::vector<SDL_Surface*> >
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
SDL_Surface * CMessage::blitTextOnSur(std::vector<std::vector<SDL_Surface*> > * txtg, int & curh, SDL_Surface * ret)
|
||||||
|
{
|
||||||
|
for (int i=0; i<txtg->size();i++)
|
||||||
|
{
|
||||||
|
int lw=0;
|
||||||
|
for (int j=0;j<(*txtg)[i].size();j++)
|
||||||
|
lw+=(*txtg)[i][j]->w; //lw - laczna szerokosc linii
|
||||||
|
int pw = ret->w/2;
|
||||||
|
pw -= lw/2; //poczatek tekstu (x)
|
||||||
|
|
||||||
|
int tw = pw;
|
||||||
|
for (int j=0;j<(*txtg)[i].size();j++) //blit text
|
||||||
|
{
|
||||||
|
blitAt((*txtg)[i][j],tw,curh+i*19,ret);
|
||||||
|
tw+=(*txtg)[i][j]->w;
|
||||||
|
SDL_FreeSurface((*txtg)[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
SDL_Surface * CMessage::blitCompsOnSur(std::vector<SComponent*> & comps, int maxw, int inter, int & curh, SDL_Surface * ret)
|
||||||
|
{
|
||||||
|
std::vector<std::string> * brdtext;
|
||||||
|
if (comps.size())
|
||||||
|
brdtext = breakText(comps[0]->subtitle,12,true,true);
|
||||||
|
else
|
||||||
|
brdtext = NULL;
|
||||||
|
curh += 30;
|
||||||
|
comps[0]->pos.x = (ret->w/2) - ((comps[0]->getImg()->w)/2);
|
||||||
|
comps[0]->pos.y = curh;
|
||||||
|
blitAt(comps[0]->getImg(),comps[0]->pos.x,comps[0]->pos.y,ret);
|
||||||
|
curh += comps[0]->getImg()->h + 5; //obrazek + przerwa
|
||||||
|
for (int i=0; i<brdtext->size();i++) //descr.
|
||||||
|
{
|
||||||
|
SDL_Surface * tesu = TTF_RenderText_Blended(GEOR13,(*brdtext)[i].c_str(),zwykly);
|
||||||
|
blitAt(tesu,((comps[0]->getImg()->w - tesu->w)/2)+comps[0]->pos.x,curh,ret);
|
||||||
|
curh+=tesu->h;
|
||||||
|
SDL_FreeSurface(tesu);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
std::vector<std::vector<SDL_Surface*> > * CMessage::drawText(std::vector<std::string> * brtext)
|
std::vector<std::vector<SDL_Surface*> > * CMessage::drawText(std::vector<std::string> * brtext)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<SDL_Surface*> > * txtg = new std::vector<std::vector<SDL_Surface*> >();
|
std::vector<std::vector<SDL_Surface*> > * txtg = new std::vector<std::vector<SDL_Surface*> >();
|
||||||
@ -276,14 +316,7 @@ CInfoWindow * CMessage::genIWindow(std::string text, int player, int charperline
|
|||||||
//TODO: support for more than one component
|
//TODO: support for more than one component
|
||||||
CInfoWindow * ret = new CInfoWindow();
|
CInfoWindow * ret = new CInfoWindow();
|
||||||
ret->components = comps;
|
ret->components = comps;
|
||||||
//for (int i=0;i<comps.size();i++)
|
|
||||||
// comps[i]->
|
|
||||||
std::vector<std::string> * brtext = breakText(text,charperline,true,true);
|
std::vector<std::string> * brtext = breakText(text,charperline,true,true);
|
||||||
std::vector<std::string> * brdtext;
|
|
||||||
if (comps.size())
|
|
||||||
brdtext = breakText(comps[0]->subtitle,12,true,true);
|
|
||||||
else
|
|
||||||
brdtext = NULL;
|
|
||||||
std::vector<std::vector<SDL_Surface*> > * txtg = drawText(brtext);
|
std::vector<std::vector<SDL_Surface*> > * txtg = drawText(brtext);
|
||||||
std::pair<int,int> txts = getMaxSizes(txtg);
|
std::pair<int,int> txts = getMaxSizes(txtg);
|
||||||
txts.second = txts.second
|
txts.second = txts.second
|
||||||
@ -295,50 +328,19 @@ CInfoWindow * CMessage::genIWindow(std::string text, int player, int charperline
|
|||||||
+ 30 //space to first component
|
+ 30 //space to first component
|
||||||
+ comps[0]->getImg()->h
|
+ comps[0]->getImg()->h
|
||||||
+ 5 //img <-> subtitle
|
+ 5 //img <-> subtitle
|
||||||
+ brdtext->size() * 10; //subtitle //!!!!!!!!!!!!!!!!!!!!
|
+ 20; //subtitle //!!!!!!!!!!!!!!!!!!!!
|
||||||
ret->bitmap = drawBox1(txts.first+70,txts.second+70,0);
|
ret->bitmap = drawBox1(txts.first+70,txts.second+70,0);
|
||||||
ret->pos.h=ret->bitmap->h;
|
ret->pos.h=ret->bitmap->h;
|
||||||
ret->pos.w=ret->bitmap->w;
|
ret->pos.w=ret->bitmap->w;
|
||||||
|
|
||||||
int curh = 30; //gorny margines
|
int curh = 30; //gorny margines
|
||||||
for (int i=0; i<txtg->size();i++)
|
blitTextOnSur(txtg,curh,ret->bitmap);
|
||||||
{
|
|
||||||
int lw=0;
|
|
||||||
for (int j=0;j<(*txtg)[i].size();j++)
|
|
||||||
lw+=(*txtg)[i][j]->w;
|
|
||||||
int pw = ret->bitmap->w/2;
|
|
||||||
//int pw = Tmar, ph = Lmar;
|
|
||||||
pw -= lw/2;
|
|
||||||
|
|
||||||
int tw = pw;
|
|
||||||
for (int j=0;j<(*txtg)[i].size();j++) //blit text
|
|
||||||
{
|
|
||||||
//std::stringstream n;
|
|
||||||
//n <<"temp_"<<i<<"__"<<j<<".bmp";
|
|
||||||
//SDL_SaveBMP(ret->bitmap,n.str().c_str());
|
|
||||||
blitAt((*txtg)[i][j],tw,curh+i*19,ret->bitmap);
|
|
||||||
tw+=(*txtg)[i][j]->w;
|
|
||||||
SDL_FreeSurface((*txtg)[i][j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
curh += (19 * txtg->size()); //wys. tekstu
|
curh += (19 * txtg->size()); //wys. tekstu
|
||||||
|
|
||||||
if (comps.size())
|
if (comps.size())
|
||||||
{
|
{
|
||||||
curh += 30;
|
blitCompsOnSur(comps,200,0,curh,ret->bitmap);
|
||||||
comps[0]->pos.x = (ret->bitmap->w/2) - ((comps[0]->getImg()->w)/2);
|
|
||||||
comps[0]->pos.y = curh;
|
|
||||||
blitAt(comps[0]->getImg(),comps[0]->pos.x,comps[0]->pos.y,ret->bitmap);
|
|
||||||
curh += comps[0]->getImg()->h + 5; //obrazek + przerwa
|
|
||||||
for (int i=0; i<brdtext->size();i++) //descr.
|
|
||||||
{
|
|
||||||
SDL_Surface * tesu = TTF_RenderText_Blended(GEOR13,(*brdtext)[i].c_str(),zwykly);
|
|
||||||
blitAt(tesu,((comps[0]->getImg()->w - tesu->w)/2)+comps[0]->pos.x,curh,ret->bitmap);
|
|
||||||
curh+=tesu->h;
|
|
||||||
SDL_FreeSurface(tesu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curh += 20; //to buttton
|
curh += 20; //to buttton
|
||||||
|
|
||||||
ret->okb.posr.x = (ret->bitmap->w/2) - (ret->okb.imgs[0][0]->w/2);
|
ret->okb.posr.x = (ret->bitmap->w/2) - (ret->okb.imgs[0][0]->w/2);
|
||||||
|
@ -24,6 +24,8 @@ public:
|
|||||||
|
|
||||||
static std::pair<int,int> getMaxSizes(std::vector<std::vector<SDL_Surface*> > * txtg);
|
static std::pair<int,int> getMaxSizes(std::vector<std::vector<SDL_Surface*> > * txtg);
|
||||||
static std::vector<std::vector<SDL_Surface*> > * drawText(std::vector<std::string> * brtext);
|
static std::vector<std::vector<SDL_Surface*> > * drawText(std::vector<std::string> * brtext);
|
||||||
|
static SDL_Surface * blitTextOnSur(std::vector<std::vector<SDL_Surface*> > * txtg, int & curh, SDL_Surface * ret);
|
||||||
|
static SDL_Surface * blitCompsOnSur(std::vector<SComponent*> & comps, int maxw, int inter, int & curh, SDL_Surface * ret);
|
||||||
static CInfoWindow * genIWindow(std::string text, int player, int charperline, std::vector<SComponent*> & comps);
|
static CInfoWindow * genIWindow(std::string text, int player, int charperline, std::vector<SComponent*> & comps);
|
||||||
static CSimpleWindow * genWindow(std::string text, int player, int Lmar=35, int Rmar=35, int Tmar=35, int Bmar=35);//supports h3 text formatting; player sets color of window, Lmar/Rmar/Tmar/Bmar are Left/Right/Top/Bottom margins
|
static CSimpleWindow * genWindow(std::string text, int player, int Lmar=35, int Rmar=35, int Tmar=35, int Bmar=35);//supports h3 text formatting; player sets color of window, Lmar/Rmar/Tmar/Bmar are Left/Right/Top/Bottom margins
|
||||||
static SDL_Surface * genMessage(std::string title, std::string text, EWindowType type=infoOnly,
|
static SDL_Surface * genMessage(std::string title, std::string text, EWindowType type=infoOnly,
|
||||||
|
@ -107,6 +107,12 @@ void SComponent::deactivate()
|
|||||||
{
|
{
|
||||||
ClickableR::deactivate();
|
ClickableR::deactivate();
|
||||||
}
|
}
|
||||||
|
void CSimpleWindow::show(SDL_Surface * to)
|
||||||
|
{
|
||||||
|
if(!to)
|
||||||
|
to=ekran;
|
||||||
|
blitAt(bitmap,pos.x,pos.y,to);
|
||||||
|
}
|
||||||
CSimpleWindow::~CSimpleWindow()
|
CSimpleWindow::~CSimpleWindow()
|
||||||
{
|
{
|
||||||
if (bitmap)
|
if (bitmap)
|
||||||
@ -154,16 +160,16 @@ template <typename T> void CSCButton<typename T>::deactivate()
|
|||||||
ClickableL::deactivate();
|
ClickableL::deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> void CSCButton<typename T>::show()
|
template <typename T> void CSCButton<typename T>::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
if (delg)
|
if (delg) //we blit on our owner's bitmap
|
||||||
{
|
{
|
||||||
blitAt(imgs[curimg][state],posr.x,posr.y,delg->bitmap);
|
blitAt(imgs[curimg][state],posr.x,posr.y,delg->bitmap);
|
||||||
updateRect(&genRect(pos.h,pos.w,posr.x,posr.y),delg->bitmap);
|
updateRect(&genRect(pos.h,pos.w,posr.x,posr.y),delg->bitmap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CButtonBase::show();
|
CButtonBase::show(to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CButtonBase::CButtonBase()
|
CButtonBase::CButtonBase()
|
||||||
@ -175,17 +181,19 @@ CButtonBase::CButtonBase()
|
|||||||
ourObj=NULL;
|
ourObj=NULL;
|
||||||
state=0;
|
state=0;
|
||||||
}
|
}
|
||||||
void CButtonBase::show()
|
void CButtonBase::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
|
if(!to)
|
||||||
|
to=ekran;
|
||||||
if (abs)
|
if (abs)
|
||||||
{
|
{
|
||||||
blitAt(imgs[curimg][state],pos.x,pos.y);
|
blitAt(imgs[curimg][state],pos.x,pos.y,to);
|
||||||
updateRect(&pos);
|
updateRect(&pos,to);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
blitAt(imgs[curimg][state],pos.x+ourObj->pos.x,pos.y+ourObj->pos.y);
|
blitAt(imgs[curimg][state],pos.x+ourObj->pos.x,pos.y+ourObj->pos.y,to);
|
||||||
updateRect(&genRect(pos.h,pos.w,pos.x+ourObj->pos.x,pos.y+ourObj->pos.y));
|
updateRect(&genRect(pos.h,pos.w,pos.x+ourObj->pos.x,pos.y+ourObj->pos.y),to);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,7 +370,7 @@ void CPlayerInterface::yourTurn()
|
|||||||
adventureInt->updateMinimap=false;
|
adventureInt->updateMinimap=false;
|
||||||
}
|
}
|
||||||
for(int i=0;i<objsToBlit.size();i++)
|
for(int i=0;i<objsToBlit.size();i++)
|
||||||
blitAt(objsToBlit[i]->bitmap,objsToBlit[i]->pos.x,objsToBlit[i]->pos.y);
|
objsToBlit[i]->show();
|
||||||
SDL_Delay(5); //give time for other apps
|
SDL_Delay(5); //give time for other apps
|
||||||
SDL_framerateDelay(mainFPSmng);
|
SDL_framerateDelay(mainFPSmng);
|
||||||
}
|
}
|
||||||
@ -427,7 +435,6 @@ int getDir(int3 src, int3 dst)
|
|||||||
}
|
}
|
||||||
void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||||
{
|
{
|
||||||
adventureInt->minimap.draw();
|
|
||||||
//initializing objects and performing first step of move
|
//initializing objects and performing first step of move
|
||||||
CGHeroInstance * ho = details.ho; //object representing this hero
|
CGHeroInstance * ho = details.ho; //object representing this hero
|
||||||
int3 hp = details.src;
|
int3 hp = details.src;
|
||||||
@ -994,6 +1001,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
ho->isStanding = true;
|
ho->isStanding = true;
|
||||||
//move finished
|
//move finished
|
||||||
CGI->mh->recalculateHideVisPosUnderObj(details.ho, true);
|
CGI->mh->recalculateHideVisPosUnderObj(details.ho, true);
|
||||||
|
adventureInt->minimap.draw();
|
||||||
adventureInt->heroList.draw();
|
adventureInt->heroList.draw();
|
||||||
}
|
}
|
||||||
void CPlayerInterface::heroKilled(const CGHeroInstance*)
|
void CPlayerInterface::heroKilled(const CGHeroInstance*)
|
||||||
@ -1268,7 +1276,7 @@ void CPlayerInterface::showInfoDialog(std::string text, std::vector<SComponent*>
|
|||||||
temp->components[i]->pos.y += temp->pos.y;
|
temp->components[i]->pos.y += temp->pos.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CPlayerInterface::removeObjToBlit(CSimpleWindow* obj)
|
void CPlayerInterface::removeObjToBlit(IShowable* obj)
|
||||||
{
|
{
|
||||||
objsToBlit.erase
|
objsToBlit.erase
|
||||||
(std::find(objsToBlit.begin(),objsToBlit.end(),obj));
|
(std::find(objsToBlit.begin(),objsToBlit.end(),obj));
|
||||||
|
@ -11,21 +11,36 @@ struct HeroMoveDetails;
|
|||||||
class CDefEssential;
|
class CDefEssential;
|
||||||
class CGHeroInstance;
|
class CGHeroInstance;
|
||||||
class CAdvMapInt;
|
class CAdvMapInt;
|
||||||
|
|
||||||
|
class IShowable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void show(SDL_Surface * to = NULL)=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class IActivable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void activate()=0;
|
||||||
|
virtual void deactivate()=0;
|
||||||
|
};
|
||||||
|
|
||||||
class CIntObject //interface object
|
class CIntObject //interface object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SDL_Rect pos;
|
SDL_Rect pos;
|
||||||
int ID;
|
int ID;
|
||||||
};
|
};
|
||||||
class CSimpleWindow : public virtual CIntObject
|
class CSimpleWindow : public virtual CIntObject, public IShowable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SDL_Surface * bitmap;
|
SDL_Surface * bitmap;
|
||||||
CIntObject * owner;
|
CIntObject * owner;
|
||||||
|
virtual void show(SDL_Surface * to = NULL);
|
||||||
CSimpleWindow():bitmap(NULL),owner(NULL){};
|
CSimpleWindow():bitmap(NULL),owner(NULL){};
|
||||||
virtual ~CSimpleWindow();
|
virtual ~CSimpleWindow();
|
||||||
};
|
};
|
||||||
class CButtonBase : public virtual CIntObject //basic buttton class
|
class CButtonBase : public virtual CIntObject, public IShowable, public IActivable //basic buttton class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int type; //advmapbutton=2
|
int type; //advmapbutton=2
|
||||||
@ -35,7 +50,7 @@ public:
|
|||||||
int state;
|
int state;
|
||||||
std::vector< std::vector<SDL_Surface*> > imgs;
|
std::vector< std::vector<SDL_Surface*> > imgs;
|
||||||
int curimg;
|
int curimg;
|
||||||
virtual void show() ;
|
virtual void show(SDL_Surface * to = NULL);
|
||||||
virtual void activate()=0;
|
virtual void activate()=0;
|
||||||
virtual void deactivate()=0;
|
virtual void deactivate()=0;
|
||||||
CButtonBase();
|
CButtonBase();
|
||||||
@ -94,7 +109,7 @@ public:
|
|||||||
void clickLeft (tribool down);
|
void clickLeft (tribool down);
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
void deactivate();
|
||||||
void show();
|
void show(SDL_Surface * to = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInfoWindow : public CSimpleWindow //text + comp. + ok button
|
class CInfoWindow : public CSimpleWindow //text + comp. + ok button
|
||||||
@ -146,7 +161,7 @@ public:
|
|||||||
std::vector<Hoverable*> hoverable;
|
std::vector<Hoverable*> hoverable;
|
||||||
std::vector<KeyInterested*> keyinterested;
|
std::vector<KeyInterested*> keyinterested;
|
||||||
std::vector<MotionInterested*> motioninterested;
|
std::vector<MotionInterested*> motioninterested;
|
||||||
std::vector<CSimpleWindow*> objsToBlit;
|
std::vector<IShowable*> objsToBlit;
|
||||||
|
|
||||||
SDL_Surface * hInfo;
|
SDL_Surface * hInfo;
|
||||||
std::vector<std::pair<int, int> > slotsPos;
|
std::vector<std::pair<int, int> > slotsPos;
|
||||||
@ -166,7 +181,7 @@ public:
|
|||||||
void init(CCallback * CB);
|
void init(CCallback * CB);
|
||||||
int3 repairScreenPos(int3 pos);
|
int3 repairScreenPos(int3 pos);
|
||||||
void showInfoDialog(std::string text, std::vector<SComponent*> & components);
|
void showInfoDialog(std::string text, std::vector<SComponent*> & components);
|
||||||
void removeObjToBlit(CSimpleWindow* obj);
|
void removeObjToBlit(IShowable* obj);
|
||||||
|
|
||||||
CPlayerInterface(int Player, int serial);
|
CPlayerInterface(int Player, int serial);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user