CMessage.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "Graphics.h"
  3. #include "UIFramework/Geometries.h"
  4. /*
  5. * CMessage.h, part of VCMI engine
  6. *
  7. * Authors: listed in file AUTHORS in main folder
  8. *
  9. * License: GNU General Public License v2.0 or later
  10. * Full text of license available in license.txt file, in main folder
  11. *
  12. */
  13. struct SDL_Surface;
  14. enum EWindowType {infoOnly, infoOK, yesOrNO};
  15. class CInfoWindow;
  16. class CDefHandler;
  17. class CComponent;
  18. class CSelWindow;
  19. class ComponentResolved;
  20. /// Class which draws formatted text messages and generates chat windows
  21. class CMessage
  22. {
  23. public:
  24. //Function usd only in CMessage.cpp
  25. static std::pair<int,int> getMaxSizes(std::vector<std::vector<SDL_Surface*> > * txtg, int fontHeight);
  26. static SDL_Surface * blitTextOnSur(std::vector<std::vector<SDL_Surface*> > * txtg, int fontHeight, int & curh, SDL_Surface * ret, int xCenterPos=-1); //xPos==-1 works as if ret->w/2
  27. /// Draw border on exiting surface
  28. static void drawBorder(TPlayerColor playerColor, SDL_Surface * ret, int w, int h, int x=0, int y=0);
  29. /// Draw simple dialog box (borders and background only)
  30. static SDL_Surface * drawDialogBox(int w, int h, TPlayerColor playerColor=1);
  31. static void drawIWindow(CInfoWindow * ret, std::string text, TPlayerColor player);
  32. /// split text in lines
  33. static std::vector<std::string> breakText(std::string text, size_t maxLineWidth, EFonts font);
  34. /// constructor
  35. static void init();
  36. /// destructor
  37. static void dispose();
  38. };