CMessage.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef CMESSAGE_H
  2. #define CMESSAGE_H
  3. #include "global.h"
  4. #include "SDL_TTF.h"
  5. #include "SDL.h"
  6. enum EWindowType {infoOnly, infoOK, yesOrNO};
  7. class CPreGame;
  8. class MapSel;
  9. class CSimpleWindow;
  10. class CInfoWindow;
  11. class CDefHandler;
  12. class SComponent;
  13. namespace NMessage
  14. {
  15. extern CDefHandler * ok, *cancel;
  16. extern std::vector<std::vector<SDL_Surface*> > piecesOfBox; //in colors of all players
  17. extern SDL_Surface * background ;
  18. }
  19. class CMessage
  20. {
  21. public:
  22. static std::pair<int,int> getMaxSizes(std::vector<std::vector<SDL_Surface*> > * txtg);
  23. static std::vector<std::vector<SDL_Surface*> > * drawText(std::vector<std::string> * brtext);
  24. static SDL_Surface * blitTextOnSur(std::vector<std::vector<SDL_Surface*> > * txtg, int & curh, SDL_Surface * ret);
  25. static SDL_Surface * blitCompsOnSur(std::vector<SComponent*> & comps, int maxw, int inter, int & curh, SDL_Surface * ret);
  26. static CInfoWindow * genIWindow(std::string text, int player, int charperline, std::vector<SComponent*> & comps);
  27. 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
  28. static SDL_Surface * genMessage(std::string title, std::string text, EWindowType type=infoOnly,
  29. std::vector<CDefHandler*> *addPics=NULL, void * cb=NULL);
  30. static SDL_Surface * drawBox1(int w, int h, int playerColor=1);
  31. static std::vector<std::string> * breakText(std::string text, int line=30, bool userBreak=true, bool ifor=true); //line - chars per line
  32. CMessage();
  33. static void init();
  34. static void dispose();
  35. };
  36. //
  37. #endif //CMESSAGE_H