Graphics.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "../lib/GameConstants.h"
  12. #include "../lib/Color.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. class CAnimation;
  26. class IFont;
  27. /// Handles fonts, hero images, town images, various graphics
  28. class Graphics
  29. {
  30. void addImageListEntry(size_t index, size_t group, const std::string & listName, const std::string & imageName);
  31. void addImageListEntries(const EntityService * service);
  32. void initializeBattleGraphics();
  33. void loadPaletteAndColors();
  34. void loadErmuToPicture();
  35. void loadFonts();
  36. void initializeImageLists();
  37. public:
  38. //Fonts
  39. static const int FONTS_NUMBER = 9;
  40. std::array< std::shared_ptr<IFont>, FONTS_NUMBER> fonts;
  41. using PlayerPalette = std::array<ColorRGBA, 32>;
  42. //various graphics
  43. std::array<ColorRGBA, 8> playerColors;
  44. std::array<PlayerPalette, 8> playerColorPalette; //palette to make interface colors good - array of size [256]
  45. PlayerPalette neutralColorPalette;
  46. ColorRGBA neutralColor;
  47. std::map<std::string, JsonNode> imageLists;
  48. //towns
  49. std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
  50. //for battles
  51. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  52. //functions
  53. Graphics();
  54. void blueToPlayersAdv(SDL_Surface * sur, PlayerColor player); //replaces blue interface colour with a color of player
  55. };
  56. extern Graphics * graphics;