1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/CMessage.h
Michał W. Urbańczyk 23a7b708d8 * right click popups in towns
* drawing window text-bitmap-subtitle
* destructor for CDefEssential
* version changed to 0.5x (or maybe it should be 0.6 ?)
* minor changes
2008-03-06 18:54:35 +00:00

49 lines
2.4 KiB
C++

#ifndef CMESSAGE_H
#define CMESSAGE_H
#include "global.h"
#include "SDL_TTF.h"
#include "SDL.h"
enum EWindowType {infoOnly, infoOK, yesOrNO};
class CPreGame;
class MapSel;
class CSimpleWindow;
class CInfoWindow;
class CDefHandler;
class SComponent;
class CSelWindow;
class CSelectableComponent;
namespace NMessage
{
extern CDefHandler * ok, *cancel;
extern std::vector<std::vector<SDL_Surface*> > piecesOfBox; //in colors of all players
extern SDL_Surface * background ;
}
class CMessage
{
public:
static std::pair<int,int> getMaxSizes(std::vector<std::vector<SDL_Surface*> > * txtg);
static std::pair<int, int> getMaxSizes(std::vector< std::vector<CSelectableComponent*> > * komp);
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 SDL_Surface* blitCompsOnSur(SDL_Surface * or, std::vector< std::vector<CSelectableComponent*> > * komp, int inter, int &curh, SDL_Surface *ret);
static CInfoWindow * genIWindow(std::string text, int player, int charperline, std::vector<SComponent*> & comps);
static std::vector< std::vector<CSelectableComponent*> > * breakComps(std::vector<CSelectableComponent*> & comps,int maxw, SDL_Surface* or=NULL);
static CSelWindow * genSelWindow(std::string text, int player, int charperline, std::vector<CSelectableComponent*> & comps, int owner);
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,
std::vector<CDefHandler*> *addPics=NULL, void * cb=NULL);
static SDL_Surface * drawBox1(int w, int h, int playerColor=1);
static SDL_Surface * drawBoxTextBitmapSub(int player, std::string text, SDL_Surface* bitmap, std::string sub, int charperline=30);
static std::vector<std::string> * breakText(std::string text, int line=30, bool userBreak=true, bool ifor=true); //line - chars per line
CMessage();
static void init();
static void dispose();
};
//
#endif //CMESSAGE_H