Graphics.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #pragma once
  2. #include "FontBase.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. typedef struct _TTF_Font TTF_Font; //from SDL_ttf.h
  26. /// Handles fonts, hero images, town images, various graphics
  27. class Graphics
  28. {
  29. public:
  30. //Fonts
  31. static const int FONTS_NUMBER = 9;
  32. Font *fonts[FONTS_NUMBER];
  33. TTF_Font * fontsTrueType[FONTS_NUMBER];//true type fonts, if some of the fonts not loaded - NULL
  34. //various graphics
  35. SDL_Color * playerColors; //array [8]
  36. SDL_Color * neutralColor;
  37. SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
  38. SDL_Color * neutralColorPalette;
  39. CDefEssential * artDefs; //artifacts //TODO: move to CArtifact class
  40. std::vector<CDefEssential *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  41. CDefEssential * resources32; //resources 32x32
  42. CDefEssential * flags;
  43. CDefEssential * heroMoveArrows;
  44. std::vector<CDefEssential *> heroAnims; // [class id: 0 - 17] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  45. 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
  46. CDefHandler * FoWfullHide; //for Fog of War
  47. CDefHandler * FoWpartialHide; //for For of War
  48. std::map<std::string, CDefEssential *> advmapobjGraphics;
  49. CDefEssential * getDef(const CGObjectInstance * obj);
  50. CDefEssential * getDef(const CGDefInfo * info);
  51. //creatures
  52. std::map<int,SDL_Surface*> bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border
  53. //towns
  54. std::map<int, std::string> ERMUtoPicture[GameConstants::F_NUMBER]; //maps building ID to it's picture's name for each town type
  55. //for battles
  56. std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
  57. std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
  58. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  59. CDefEssential * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
  60. //abilities
  61. CDefEssential * abils82;
  62. //spells
  63. CDefEssential *spellscr; //spell on the scroll 83x61
  64. //functions
  65. Graphics();
  66. void initializeBattleGraphics();
  67. void loadPaletteAndColors();
  68. void loadHeroFlags();
  69. void loadHeroFlags(std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > &pr, bool mode);
  70. void loadHeroAnims();
  71. void loadHeroAnim(const std::string &name, const std::vector<std::pair<int,int> > &rotations, std::vector<CDefEssential *> Graphics::*dst);
  72. void loadErmuToPicture();
  73. void blueToPlayersAdv(SDL_Surface * sur, int player); //replaces blue interface colour with a color of player
  74. void loadTrueType();
  75. void loadFonts();
  76. Font *loadFont(const char * name);
  77. };
  78. extern Graphics * graphics;