mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
parent
62b69b1f25
commit
9e84383a61
@ -10,6 +10,9 @@
|
|||||||
#include "CCallback.h"
|
#include "CCallback.h"
|
||||||
#include <boost/assign/std/vector.hpp>
|
#include <boost/assign/std/vector.hpp>
|
||||||
#include "mapHandler.h"
|
#include "mapHandler.h"
|
||||||
|
#include "CMessage.h"
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
|
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
|
||||||
|
|
||||||
using namespace boost::logic;
|
using namespace boost::logic;
|
||||||
@ -86,7 +89,7 @@ void AdventureMapButton::clickLeft (tribool down)
|
|||||||
}
|
}
|
||||||
void AdventureMapButton::clickRight (tribool down)
|
void AdventureMapButton::clickRight (tribool down)
|
||||||
{
|
{
|
||||||
//TODO: show/hide infobox
|
LOCPLINT->adventureInt->handleRightClick(helpBox,down,this);
|
||||||
}
|
}
|
||||||
void AdventureMapButton::hover (bool on)
|
void AdventureMapButton::hover (bool on)
|
||||||
{
|
{
|
||||||
@ -101,6 +104,7 @@ void AdventureMapButton::activate()
|
|||||||
if (active) return;
|
if (active) return;
|
||||||
active=true;
|
active=true;
|
||||||
ClickableL::activate();
|
ClickableL::activate();
|
||||||
|
ClickableR::activate();
|
||||||
Hoverable::activate();
|
Hoverable::activate();
|
||||||
KeyInterested::activate();
|
KeyInterested::activate();
|
||||||
}
|
}
|
||||||
@ -501,6 +505,7 @@ void CStatusBar::show()
|
|||||||
CMinimap::CMinimap(bool draw)
|
CMinimap::CMinimap(bool draw)
|
||||||
{
|
{
|
||||||
statusbarTxt = CGI->preth->advWorldMap.first;
|
statusbarTxt = CGI->preth->advWorldMap.first;
|
||||||
|
rcText = CGI->preth->advWorldMap.second;
|
||||||
pos.x=630;
|
pos.x=630;
|
||||||
pos.y=26;
|
pos.y=26;
|
||||||
pos.h=pos.w=144;
|
pos.h=pos.w=144;
|
||||||
@ -565,7 +570,9 @@ void CMinimap::redraw(int level)// (level==-1) => redraw all levels
|
|||||||
void CMinimap::updateRadar()
|
void CMinimap::updateRadar()
|
||||||
{}
|
{}
|
||||||
void CMinimap::clickRight (tribool down)
|
void CMinimap::clickRight (tribool down)
|
||||||
{}
|
{
|
||||||
|
LOCPLINT->adventureInt->handleRightClick(rcText,down,this);
|
||||||
|
}
|
||||||
void CMinimap::clickLeft (tribool down)
|
void CMinimap::clickLeft (tribool down)
|
||||||
{
|
{
|
||||||
if (down && (!pressedL))
|
if (down && (!pressedL))
|
||||||
@ -682,6 +689,14 @@ void CTerrainRect::clickLeft(tribool down)
|
|||||||
int3 bufpos = currentHero->getPosition(false);
|
int3 bufpos = currentHero->getPosition(false);
|
||||||
//bufpos.x-=1;
|
//bufpos.x-=1;
|
||||||
currentPath = LOCPLINT->adventureInt->heroList.items[LOCPLINT->adventureInt->heroList.selected].second = CGI->pathf->getPath(bufpos,mp,currentHero,1);
|
currentPath = LOCPLINT->adventureInt->heroList.items[LOCPLINT->adventureInt->heroList.selected].second = CGI->pathf->getPath(bufpos,mp,currentHero,1);
|
||||||
|
|
||||||
|
//if (LOCPLINT->objsToBlit.size()==0)
|
||||||
|
//{
|
||||||
|
// CSimpleWindow * temp = CMessage::genWindow(" Tutaj dlugi dlugo test Tutaj dlugi dlugi dlugo test Tutaj dlugi dlugi dlugo test Tutaj dlugi dlugi dlugo test {Tutaj tytul} Tutaj dlugi dlugi dlugo test",0);
|
||||||
|
// temp->pos.x=temp->pos.y=0;temp->ID=3;
|
||||||
|
// LOCPLINT->objsToBlit.push_back(temp);
|
||||||
|
//}
|
||||||
|
//SDL_Delay(5000);
|
||||||
}
|
}
|
||||||
void CTerrainRect::clickRight(tribool down)
|
void CTerrainRect::clickRight(tribool down)
|
||||||
{
|
{
|
||||||
@ -1165,6 +1180,28 @@ CAdvMapInt::CurrentSelection::CurrentSelection()
|
|||||||
type=-1;
|
type=-1;
|
||||||
selected=NULL;
|
selected=NULL;
|
||||||
}
|
}
|
||||||
|
void CAdvMapInt::handleRightClick(std::string text, tribool down, CIntObject * client)
|
||||||
|
{
|
||||||
|
if (down)
|
||||||
|
{
|
||||||
|
boost::algorithm::erase_all(text,"\"");
|
||||||
|
CSimpleWindow * temp = CMessage::genWindow(text,LOCPLINT->playerID);
|
||||||
|
temp->pos.x=300-(temp->pos.w/2);
|
||||||
|
temp->pos.y=300-(temp->pos.h/2);
|
||||||
|
temp->owner = client;
|
||||||
|
LOCPLINT->objsToBlit.push_back(temp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i=0;i<LOCPLINT->objsToBlit.size();i++)
|
||||||
|
{
|
||||||
|
if (LOCPLINT->objsToBlit[i]->owner==client)
|
||||||
|
{
|
||||||
|
LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
int3 CAdvMapInt::verifyPos(int3 ver)
|
int3 CAdvMapInt::verifyPos(int3 ver)
|
||||||
{
|
{
|
||||||
if (ver.x<0)
|
if (ver.x<0)
|
||||||
|
@ -129,7 +129,7 @@ public:
|
|||||||
std::map<int,SDL_Color> colorsBlocked;
|
std::map<int,SDL_Color> colorsBlocked;
|
||||||
std::vector<SDL_Surface *> map; //one bitmap for each level
|
std::vector<SDL_Surface *> map; //one bitmap for each level
|
||||||
//TODO flagged buildings
|
//TODO flagged buildings
|
||||||
std::string statusbarTxt;
|
std::string statusbarTxt, rcText;
|
||||||
|
|
||||||
CMinimap(bool draw=true);
|
CMinimap(bool draw=true);
|
||||||
void draw();
|
void draw();
|
||||||
@ -256,6 +256,7 @@ public:
|
|||||||
|
|
||||||
void centerOn(int3 on);
|
void centerOn(int3 on);
|
||||||
int3 verifyPos(int3 ver);
|
int3 verifyPos(int3 ver);
|
||||||
|
void handleRightClick(std::string text, tribool down, CIntObject * client);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -72,6 +72,7 @@ int internalFunc(void * callback)
|
|||||||
}
|
}
|
||||||
std::cout<<std::endl;
|
std::cout<<std::endl;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//SDL_Delay(100);
|
//SDL_Delay(100);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,11 @@ public:
|
|||||||
return (*a.first)<(*b.first);
|
return (*a.first)<(*b.first);
|
||||||
}
|
}
|
||||||
} ocmptwo_cgin ;
|
} ocmptwo_cgin ;
|
||||||
|
CSimpleWindow::~CSimpleWindow()
|
||||||
|
{
|
||||||
|
SDL_FreeSurface(bitmap);
|
||||||
|
bitmap=NULL;
|
||||||
|
}
|
||||||
CButtonBase::CButtonBase()
|
CButtonBase::CButtonBase()
|
||||||
{
|
{
|
||||||
curimg=0;
|
curimg=0;
|
||||||
@ -187,6 +192,8 @@ void CPlayerInterface::yourTurn()
|
|||||||
adventureInt->update();
|
adventureInt->update();
|
||||||
LOCPLINT->adventureInt->updateScreen=false;
|
LOCPLINT->adventureInt->updateScreen=false;
|
||||||
}
|
}
|
||||||
|
for(int i=0;i<objsToBlit.size();i++)
|
||||||
|
blitAt(objsToBlit[i]->bitmap,objsToBlit[i]->pos.x,objsToBlit[i]->pos.y);
|
||||||
SDL_Delay(5); //give time for other apps
|
SDL_Delay(5); //give time for other apps
|
||||||
SDL_framerateDelay(mainFPSmng);
|
SDL_framerateDelay(mainFPSmng);
|
||||||
}
|
}
|
||||||
@ -957,6 +964,28 @@ void CPlayerInterface::handleEvent(SDL_Event *sEvent)
|
|||||||
lclickable[i]->clickLeft(boost::logic::indeterminate);
|
lclickable[i]->clickLeft(boost::logic::indeterminate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((sEvent->type==SDL_MOUSEBUTTONDOWN) && (sEvent->button.button == SDL_BUTTON_RIGHT))
|
||||||
|
{
|
||||||
|
for(int i=0; i<rclickable.size();i++)
|
||||||
|
{
|
||||||
|
if (isItIn(&rclickable[i]->pos,sEvent->motion.x,sEvent->motion.y))
|
||||||
|
{
|
||||||
|
rclickable[i]->clickRight(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_RIGHT))
|
||||||
|
{
|
||||||
|
for(int i=0; i<rclickable.size();i++)
|
||||||
|
{
|
||||||
|
if (isItIn(&rclickable[i]->pos,sEvent->motion.x,sEvent->motion.y))
|
||||||
|
{
|
||||||
|
rclickable[i]->clickRight(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rclickable[i]->clickRight(boost::logic::indeterminate);
|
||||||
|
}
|
||||||
|
}
|
||||||
current = NULL;
|
current = NULL;
|
||||||
|
|
||||||
} //event end
|
} //event end
|
||||||
|
@ -21,7 +21,15 @@ public:
|
|||||||
SDL_Rect pos;
|
SDL_Rect pos;
|
||||||
int ID;
|
int ID;
|
||||||
};
|
};
|
||||||
class CButtonBase : public virtual CIntObject
|
class CSimpleWindow : public virtual CIntObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SDL_Surface * bitmap;
|
||||||
|
CIntObject * owner;
|
||||||
|
CSimpleWindow():bitmap(NULL),owner(NULL){};
|
||||||
|
virtual ~CSimpleWindow();
|
||||||
|
};
|
||||||
|
class CButtonBase : public virtual CIntObject //basic buttton class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int type; //advmapbutton=2
|
int type; //advmapbutton=2
|
||||||
@ -111,6 +119,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;
|
||||||
|
|
||||||
SDL_Surface * hInfo;
|
SDL_Surface * hInfo;
|
||||||
|
|
||||||
@ -121,7 +130,6 @@ public:
|
|||||||
void heroCreated(const CHeroInstance * hero);
|
void heroCreated(const CHeroInstance * hero);
|
||||||
|
|
||||||
SDL_Surface * infoWin(void * specific); //specific=0 => draws info about selected town/hero //TODO - gdy sie dorobi sensowna hierarchie klas ins. to wywalic tego brzydkiego void*
|
SDL_Surface * infoWin(void * specific); //specific=0 => draws info about selected town/hero //TODO - gdy sie dorobi sensowna hierarchie klas ins. to wywalic tego brzydkiego void*
|
||||||
|
|
||||||
void handleEvent(SDL_Event * sEvent);
|
void handleEvent(SDL_Event * sEvent);
|
||||||
void init(CCallback * CB);
|
void init(CCallback * CB);
|
||||||
int3 repairScreenPos(int3 pos);
|
int3 repairScreenPos(int3 pos);
|
||||||
|
2
CMT.cpp
2
CMT.cpp
@ -292,7 +292,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
p.r = 0x84; p.g = 0x84; p.b = 0x84;//gray
|
p.r = 0x84; p.g = 0x84; p.b = 0x84;//gray
|
||||||
cgi->neutralColor = p;//gray
|
cgi->neutralColor = p;//gray
|
||||||
//colors initialized
|
//colors initialized
|
||||||
|
CMessage::init();
|
||||||
cgi->townh = new CTownHandler;
|
cgi->townh = new CTownHandler;
|
||||||
cgi->townh->loadNames();
|
cgi->townh->loadNames();
|
||||||
CAbilityHandler * abilh = new CAbilityHandler;
|
CAbilityHandler * abilh = new CAbilityHandler;
|
||||||
|
123
CMessage.cpp
123
CMessage.cpp
@ -6,7 +6,14 @@
|
|||||||
#include "CGameInfo.h"
|
#include "CGameInfo.h"
|
||||||
#include "SDL_Extensions.h"
|
#include "SDL_Extensions.h"
|
||||||
#include "hch\CLodHandler.h"
|
#include "hch\CLodHandler.h"
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
#include "CGameInterface.h"
|
||||||
|
#include "hch\CDefHandler.h"
|
||||||
|
#include "hch\CSemiDefHandler.h"
|
||||||
|
#include "CGameInfo.h"
|
||||||
|
#include "SDL_Extensions.h"
|
||||||
|
#include <sstream>
|
||||||
SDL_Color tytulowy, tlo, zwykly ;
|
SDL_Color tytulowy, tlo, zwykly ;
|
||||||
SDL_Rect genRect(int hh, int ww, int xx, int yy);
|
SDL_Rect genRect(int hh, int ww, int xx, int yy);
|
||||||
|
|
||||||
@ -27,8 +34,8 @@ namespace NMessage
|
|||||||
|
|
||||||
CMessage::CMessage()
|
CMessage::CMessage()
|
||||||
{
|
{
|
||||||
if (!NMessage::background)
|
//if (!NMessage::background)
|
||||||
init();
|
// init();
|
||||||
}
|
}
|
||||||
void CMessage::init()
|
void CMessage::init()
|
||||||
{
|
{
|
||||||
@ -107,14 +114,14 @@ SDL_Surface * CMessage::drawBox1(int w, int h, int playerColor)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> * CMessage::breakText(std::string text, int line, bool userBreak)
|
std::vector<std::string> * CMessage::breakText(std::string text, int line, bool userBreak, bool ifor)
|
||||||
{
|
{
|
||||||
std::vector<std::string> * ret = new std::vector<std::string>();
|
std::vector<std::string> * ret = new std::vector<std::string>();
|
||||||
while (text.length()>line)
|
while (text.length()>line)
|
||||||
{
|
{
|
||||||
int whereCut = -1;
|
int whereCut = -1, braces=0;
|
||||||
bool pom = true;
|
bool pom = true, opened=false;
|
||||||
for (int i=0; i<line; i++)
|
for (int i=0; i<line+braces; i++)
|
||||||
{
|
{
|
||||||
if (text[i]==10) //end of line sign
|
if (text[i]==10) //end of line sign
|
||||||
{
|
{
|
||||||
@ -122,17 +129,35 @@ std::vector<std::string> * CMessage::breakText(std::string text, int line, bool
|
|||||||
pom=false;
|
pom=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (ifor && (text[i]=='{') || (text[i]=='}')) // ignore braces
|
||||||
|
{
|
||||||
|
if (text[i]=='{')
|
||||||
|
opened=true;
|
||||||
|
else
|
||||||
|
opened=false;
|
||||||
|
braces++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (int i=line; i>0&&pom; i--)
|
for (int i=line+braces; i>0&&pom; i--)
|
||||||
{
|
{
|
||||||
if (text[i]==' ')
|
if (text[i]==' ')
|
||||||
{
|
{
|
||||||
whereCut = i;
|
whereCut = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (opened && text[i]=='{')
|
||||||
|
opened = false;
|
||||||
|
else if (text[i]=='}')
|
||||||
|
opened = true;
|
||||||
}
|
}
|
||||||
ret->push_back(text.substr(0,whereCut));
|
ret->push_back(text.substr(0,whereCut));
|
||||||
text.erase(0,whereCut);
|
text.erase(0,whereCut);
|
||||||
|
boost::algorithm::trim_left_if(text,boost::algorithm::is_any_of(" "));
|
||||||
|
if (opened)
|
||||||
|
{
|
||||||
|
(*(ret->end()-1))+='}';
|
||||||
|
text.insert(0,"{");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (int i=0;i<text.length();i++)
|
for (int i=0;i<text.length();i++)
|
||||||
{
|
{
|
||||||
@ -145,8 +170,90 @@ std::vector<std::string> * CMessage::breakText(std::string text, int line, bool
|
|||||||
}
|
}
|
||||||
if (text.length() > 0)
|
if (text.length() > 0)
|
||||||
ret->push_back(text);
|
ret->push_back(text);
|
||||||
|
for (int i=0; i<ret->size(); i++)
|
||||||
|
{
|
||||||
|
boost::algorithm::trim((*ret)[i]);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSimpleWindow * CMessage::genWindow(std::string text, int player, int Lmar, int Rmar, int Tmar, int Bmar)
|
||||||
|
{
|
||||||
|
CSimpleWindow * ret = new CSimpleWindow();
|
||||||
|
std::vector<std::string> * brtext = breakText(text,32,true,true);
|
||||||
|
std::vector<std::vector<SDL_Surface*> > txtg;
|
||||||
|
txtg.resize(brtext->size());
|
||||||
|
for (int i=0; i<brtext->size();i++) //foreach line
|
||||||
|
{
|
||||||
|
while((*brtext)[i].length()) //jesli zostalo cos
|
||||||
|
{
|
||||||
|
int z=0; bool br=true;
|
||||||
|
while( ((*brtext)[i][z]) != ('{') )
|
||||||
|
{
|
||||||
|
if (z >= (((*brtext)[i].length())-1))
|
||||||
|
{
|
||||||
|
br=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
z++;
|
||||||
|
}
|
||||||
|
if (!br)
|
||||||
|
z++;
|
||||||
|
if (z)
|
||||||
|
txtg[i].push_back(TTF_RenderText_Blended(TNRB16,(*brtext)[i].substr(0,z).c_str(),zwykly));
|
||||||
|
(*brtext)[i].erase(0,z);
|
||||||
|
z=0;
|
||||||
|
if ( ((*brtext)[i].length()==0) || ((*brtext)[i][z]!='{') )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
while( ((*brtext)[i][++z]) != ('}') )
|
||||||
|
{}
|
||||||
|
//tyemp = (*brtext)[i].substr(1,z-1); //od 1 bo pomijamy otwierajaca klamre
|
||||||
|
txtg[i].push_back(TTF_RenderText_Blended(TNRB16,(*brtext)[i].substr(1,z-1).c_str(),tytulowy));
|
||||||
|
(*brtext)[i].erase(0,z+1); //z+1 bo dajemy zamykajaca klamre
|
||||||
|
} //ends while((*brtext)[i].length())
|
||||||
|
} //ends for(int i=0; i<brtext->size();i++)
|
||||||
|
int max = -1, lh=0;
|
||||||
|
for (int i=0; i<txtg.size();i++) //szukamy najszerszej linii i lacznej wysokosci
|
||||||
|
{
|
||||||
|
int lw=0;
|
||||||
|
for (int j=0;j<txtg[i].size();j++)
|
||||||
|
{
|
||||||
|
lw+=txtg[i][j]->w;
|
||||||
|
lh+=txtg[i][j]->h;
|
||||||
|
}
|
||||||
|
if (max<lw)
|
||||||
|
max=lw;
|
||||||
|
}
|
||||||
|
ret->bitmap = drawBox1(max+Lmar+Rmar,lh+Tmar+Bmar,0);
|
||||||
|
ret->pos.h=ret->bitmap->h;
|
||||||
|
ret->pos.w=ret->bitmap->w;
|
||||||
|
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;
|
||||||
|
int pw = ret->bitmap->w/2, ph = ret->bitmap->h/2;
|
||||||
|
//int pw = Tmar, ph = Lmar;
|
||||||
|
pw -= lw/2;
|
||||||
|
ph -= (19*txtg.size())/2;
|
||||||
|
|
||||||
|
int tw = pw;
|
||||||
|
for (int j=0;j<txtg[i].size();j++)
|
||||||
|
{
|
||||||
|
//std::stringstream n;
|
||||||
|
//n <<"temp_"<<i<<"__"<<j<<".bmp";
|
||||||
|
blitAt(txtg[i][j],tw,ph+i*19,ret->bitmap);
|
||||||
|
//SDL_SaveBMP(ret->bitmap,n.str().c_str());
|
||||||
|
tw+=txtg[i][j]->w;
|
||||||
|
SDL_FreeSurface(txtg[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SDL_Surface * CMessage::genMessage
|
SDL_Surface * CMessage::genMessage
|
||||||
(std::string title, std::string text, EWindowType type, std::vector<CDefHandler*> *addPics, void * cb)
|
(std::string title, std::string text, EWindowType type, std::vector<CDefHandler*> *addPics, void * cb)
|
||||||
{
|
{
|
||||||
|
11
CMessage.h
11
CMessage.h
@ -4,15 +4,11 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "SDL_TTF.h"
|
#include "SDL_TTF.h"
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "hch\CSemiDefHandler.h"
|
|
||||||
#include "hch\CDefHandler.h"
|
|
||||||
#include "CGameInterface.h"
|
|
||||||
#include "CGameInfo.h"
|
|
||||||
#include "SDL_Extensions.h"
|
|
||||||
enum EWindowType {infoOnly, infoOK, yesOrNO};
|
enum EWindowType {infoOnly, infoOK, yesOrNO};
|
||||||
class CPreGame;
|
class CPreGame;
|
||||||
class MapSel;
|
class MapSel;
|
||||||
|
class CSimpleWindow;
|
||||||
|
class CDefHandler;
|
||||||
namespace NMessage
|
namespace NMessage
|
||||||
{
|
{
|
||||||
extern std::vector<std::vector<SDL_Surface*> > piecesOfBox; //in colors of all players
|
extern std::vector<std::vector<SDL_Surface*> > piecesOfBox; //in colors of all players
|
||||||
@ -22,10 +18,11 @@ namespace NMessage
|
|||||||
class CMessage
|
class CMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
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,
|
||||||
std::vector<CDefHandler*> *addPics=NULL, void * cb=NULL);
|
std::vector<CDefHandler*> *addPics=NULL, void * cb=NULL);
|
||||||
static SDL_Surface * drawBox1(int w, int h, int playerColor=1);
|
static SDL_Surface * drawBox1(int w, int h, int playerColor=1);
|
||||||
static std::vector<std::string> * breakText(std::string text, int line=30, bool userBreak=true); //line - chars per line
|
static std::vector<std::string> * breakText(std::string text, int line=30, bool userBreak=true, bool ifor=true); //line - chars per line
|
||||||
CMessage();
|
CMessage();
|
||||||
static void init();
|
static void init();
|
||||||
static void dispose();
|
static void dispose();
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "CMessage.h"
|
#include "CMessage.h"
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include "hch\CDefHandler.h"
|
||||||
|
|
||||||
SDL_Surface * CSDL_Ext::newSurface(int w, int h, SDL_Surface * mod) //creates new surface, with flags/format same as in surface given
|
SDL_Surface * CSDL_Ext::newSurface(int w, int h, SDL_Surface * mod) //creates new surface, with flags/format same as in surface given
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user