Graphics.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Graphics.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "IFont.h"
  12. #include "../lib/GameConstants.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CGHeroInstance;
  15. class CGTownInstance;
  16. class CHeroClass;
  17. struct InfoAboutHero;
  18. struct InfoAboutTown;
  19. class CGObjectInstance;
  20. class ObjectTemplate;
  21. class EntityService;
  22. class JsonNode;
  23. VCMI_LIB_NAMESPACE_END
  24. struct SDL_Surface;
  25. struct SDL_Color;
  26. class CAnimation;
  27. enum EFonts : int
  28. {
  29. FONT_BIG, FONT_CALLI, FONT_CREDITS, FONT_HIGH_SCORE, FONT_MEDIUM, FONT_SMALL, FONT_TIMES, FONT_TINY, FONT_VERD
  30. };
  31. /// Handles fonts, hero images, town images, various graphics
  32. class Graphics
  33. {
  34. void addImageListEntry(size_t index, size_t group, const std::string & listName, const std::string & imageName);
  35. void addImageListEntries(const EntityService * service);
  36. void initializeBattleGraphics();
  37. void loadPaletteAndColors();
  38. void loadErmuToPicture();
  39. void loadFonts();
  40. void initializeImageLists();
  41. public:
  42. //Fonts
  43. static const int FONTS_NUMBER = 9;
  44. std::array< std::shared_ptr<IFont>, FONTS_NUMBER> fonts;
  45. //various graphics
  46. SDL_Color * playerColors; //array [8]
  47. SDL_Color * neutralColor;
  48. SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
  49. SDL_Color * neutralColorPalette;
  50. std::map<std::string, JsonNode> imageLists;
  51. //towns
  52. std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
  53. //for battles
  54. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  55. //functions
  56. Graphics();
  57. ~Graphics();
  58. void blueToPlayersAdv(SDL_Surface * sur, PlayerColor player); //replaces blue interface colour with a color of player
  59. };
  60. extern Graphics * graphics;