Graphics.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #pragma once
  2. #include "UIFramework/Fonts.h"
  3. #include "../lib/GameConstants.h"
  4. #include "UIFramework/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 CGDefInfo;
  25. enum EFonts
  26. {
  27. FONT_BIG, FONT_CALLI, FONT_CREDITS, FONT_HIGH_SCORE, FONT_MEDIUM, FONT_SMALL, FONT_TIMES, FONT_TINY, FONT_VERD
  28. };
  29. /// Handles fonts, hero images, town images, various graphics
  30. class Graphics
  31. {
  32. public:
  33. //Fonts
  34. static const int FONTS_NUMBER = 9;
  35. IFont * fonts[FONTS_NUMBER];
  36. \
  37. //various graphics
  38. SDL_Color * playerColors; //array [8]
  39. SDL_Color * neutralColor;
  40. SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
  41. SDL_Color * neutralColorPalette;
  42. std::vector<CDefEssential *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  43. CDefEssential * resources32; //resources 32x32
  44. CDefEssential * heroMoveArrows;
  45. 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
  46. 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
  47. CDefHandler * FoWfullHide; //for Fog of War
  48. CDefHandler * FoWpartialHide; //for For of War
  49. std::map<std::string, CDefEssential *> advmapobjGraphics;
  50. CDefEssential * getDef(const CGObjectInstance * obj);
  51. CDefEssential * getDef(const CGDefInfo * info);
  52. //towns
  53. std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
  54. //for battles
  55. std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
  56. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  57. CDefEssential * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
  58. //spells
  59. CDefEssential *spellscr; //spell on the scroll 83x61
  60. //functions
  61. Graphics();
  62. void initializeBattleGraphics();
  63. void loadPaletteAndColors();
  64. void loadHeroFlags();
  65. void loadHeroFlags(std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > &pr, bool mode);
  66. void loadHeroAnims();
  67. CDefEssential * loadHeroAnim(const std::string &name, const std::vector<std::pair<int,int> > &rotations);
  68. void loadErmuToPicture();
  69. void blueToPlayersAdv(SDL_Surface * sur, int player); //replaces blue interface colour with a color of player
  70. void loadFonts();
  71. };
  72. extern Graphics * graphics;