Graphics.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #include "../lib/filesystem/ResourcePath.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class CGHeroInstance;
  16. class CGTownInstance;
  17. class CHeroClass;
  18. struct InfoAboutHero;
  19. struct InfoAboutTown;
  20. class CGObjectInstance;
  21. class ObjectTemplate;
  22. class EntityService;
  23. class JsonNode;
  24. VCMI_LIB_NAMESPACE_END
  25. struct SDL_Palette;
  26. class IFont;
  27. /// Handles fonts, hero images, town images, various graphics
  28. class Graphics
  29. {
  30. void initializeBattleGraphics();
  31. void loadPaletteAndColors();
  32. void loadErmuToPicture();
  33. void loadFonts();
  34. public:
  35. //Fonts
  36. static const int FONTS_NUMBER = 9;
  37. std::array< std::shared_ptr<IFont>, FONTS_NUMBER> fonts;
  38. using PlayerPalette = std::array<ColorRGBA, 32>;
  39. //various graphics
  40. std::array<ColorRGBA, 8> playerColors;
  41. std::array<PlayerPalette, 8> playerColorPalette; //palette to make interface colors good - array of size [256]
  42. PlayerPalette neutralColorPalette;
  43. ColorRGBA neutralColor;
  44. //towns
  45. std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
  46. //for battles
  47. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  48. //functions
  49. Graphics();
  50. void setPlayerPalette(SDL_Palette * sur, PlayerColor player);
  51. void setPlayerFlagColor(SDL_Palette * sur, PlayerColor player);
  52. };
  53. extern Graphics * graphics;