2007-06-26 15:38:58 +03:00
# ifndef CMESSAGE_H
# define CMESSAGE_H
2007-08-12 20:48:05 +03:00
# include "global.h"
2008-07-31 15:59:42 +03:00
# include <SDL_ttf.h>
2007-07-29 02:01:25 +03:00
# include "SDL.h"
2008-07-16 21:26:15 +03:00
# include "CPreGame.h"
2007-06-12 12:33:20 +03:00
enum EWindowType { infoOnly , infoOK , yesOrNO } ;
2007-06-19 18:25:42 +03:00
class CPreGame ;
2007-06-28 13:47:28 +03:00
class MapSel ;
2007-10-13 23:31:50 +03:00
class CSimpleWindow ;
2007-11-19 00:58:28 +02:00
class CInfoWindow ;
2007-10-13 23:31:50 +03:00
class CDefHandler ;
2007-12-09 14:42:45 +02:00
class SComponent ;
2007-12-27 02:11:46 +02:00
class CSelWindow ;
class CSelectableComponent ;
2007-07-29 02:01:25 +03:00
namespace NMessage
{
2007-11-24 00:33:55 +02:00
extern CDefHandler * ok , * cancel ;
2007-07-29 02:01:25 +03:00
extern std : : vector < std : : vector < SDL_Surface * > > piecesOfBox ; //in colors of all players
extern SDL_Surface * background ;
}
2007-06-12 12:33:20 +03:00
class CMessage
{
public :
2008-07-16 21:26:15 +03:00
2007-11-19 00:58:28 +02:00
static std : : pair < int , int > getMaxSizes ( std : : vector < std : : vector < SDL_Surface * > > * txtg ) ;
2007-12-27 02:11:46 +02:00
static std : : pair < int , int > getMaxSizes ( std : : vector < std : : vector < CSelectableComponent * > > * komp ) ;
2007-11-19 00:58:28 +02:00
static std : : vector < std : : vector < SDL_Surface * > > * drawText ( std : : vector < std : : string > * brtext ) ;
2007-12-01 14:50:33 +02:00
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 ) ;
2008-07-16 21:26:15 +03:00
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 ) ;
2007-12-27 02:11:46 +02:00
static CSelWindow * genSelWindow ( std : : string text , int player , int charperline , std : : vector < CSelectableComponent * > & comps , int owner ) ;
2007-10-13 23:31:50 +03:00
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
2008-07-16 21:26:15 +03:00
static SDL_Surface * genMessage ( std : : string title , std : : string text , EWindowType type = infoOnly ,
2007-07-11 15:08:42 +03:00
std : : vector < CDefHandler * > * addPics = NULL , void * cb = NULL ) ;
2007-07-29 02:01:25 +03:00
static SDL_Surface * drawBox1 ( int w , int h , int playerColor = 1 ) ;
2008-03-06 20:54:35 +02:00
static SDL_Surface * drawBoxTextBitmapSub ( int player , std : : string text , SDL_Surface * bitmap , std : : string sub , int charperline = 30 ) ;
2007-10-13 23:31:50 +03:00
static std : : vector < std : : string > * breakText ( std : : string text , int line = 30 , bool userBreak = true , bool ifor = true ) ; //line - chars per line
2007-06-12 12:33:20 +03:00
CMessage ( ) ;
2007-08-04 00:47:34 +03:00
static void init ( ) ;
static void dispose ( ) ;
2007-06-19 18:25:42 +03:00
} ;
//
2007-06-26 15:38:58 +03:00
2007-12-27 02:11:46 +02:00
2008-07-16 21:26:15 +03:00
# endif //CMESSAGE_H