Graphics.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #pragma once
  2. #include "gui/Fonts.h"
  3. #include "../lib/GameConstants.h"
  4. #include "gui/Geometries.h"
  5. /*
  6. * Graphics.h, part of VCMI engine
  7. *
  8. * Authors: listed in file AUTHORS in main folder
  9. *
  10. * License: GNU General Public License v2.0 or later
  11. * Full text of license available in license.txt file, in main folder
  12. *
  13. */
  14. class CDefEssential;
  15. struct SDL_Surface;
  16. class CGHeroInstance;
  17. class CGTownInstance;
  18. class CDefHandler;
  19. class CHeroClass;
  20. struct SDL_Color;
  21. struct InfoAboutHero;
  22. struct InfoAboutTown;
  23. class CGObjectInstance;
  24. class ObjectTemplate;
  25. class CAnimation;
  26. enum EFonts
  27. {
  28. FONT_BIG, FONT_CALLI, FONT_CREDITS, FONT_HIGH_SCORE, FONT_MEDIUM, FONT_SMALL, FONT_TIMES, FONT_TINY, FONT_VERD
  29. };
  30. /// Handles fonts, hero images, town images, various graphics
  31. class Graphics
  32. {
  33. void addImageListEntry(size_t index, std::string listName, std::string imageName);
  34. public:
  35. //Fonts
  36. static const int FONTS_NUMBER = 9;
  37. IFont * fonts[FONTS_NUMBER];
  38. //various graphics
  39. SDL_Color * playerColors; //array [8]
  40. SDL_Color * neutralColor;
  41. SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
  42. SDL_Color * neutralColorPalette;
  43. std::vector<CDefEssential *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  44. CDefEssential * resources32; //resources 32x32
  45. CDefEssential * heroMoveArrows;
  46. std::map<std::string, CDefEssential *> heroAnims; // [hero class def name] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  47. std::vector<CDefEssential *> boatAnims; // [boat type: 0 - 3] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  48. CDefHandler * FoWfullHide; //for Fog of War
  49. CDefHandler * FoWpartialHide; //for For of War
  50. std::map<std::string, JsonNode> imageLists;
  51. std::map<std::string, CDefEssential *> advmapobjGraphics;
  52. CDefEssential * getDef(const CGObjectInstance * obj);
  53. CDefEssential * getDef(const ObjectTemplate & info);
  54. //towns
  55. std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
  56. //for battles
  57. std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
  58. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  59. //functions
  60. Graphics();
  61. void initializeBattleGraphics();
  62. void loadPaletteAndColors();
  63. void loadHeroFlags();
  64. void loadHeroFlagsDetail(std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > &pr, bool mode);
  65. void loadHeroAnims();
  66. CDefEssential * loadHeroAnim(const std::string &name, const std::vector<std::pair<int,int> > &rotations);
  67. void loadErmuToPicture();
  68. void blueToPlayersAdv(SDL_Surface * sur, PlayerColor player); //replaces blue interface colour with a color of player
  69. void loadFonts();
  70. void initializeImageLists();
  71. };
  72. extern Graphics * graphics;