Graphics.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef __GRAPHICS_H__
  2. #define __GRAPHICS_H__
  3. #include "../global.h"
  4. class CDefEssential;
  5. struct SDL_Surface;
  6. class CGHeroInstance;
  7. class CGTownInstance;
  8. class CDefHandler;
  9. class CHeroClass;
  10. struct SDL_Color;
  11. class Graphics
  12. {
  13. public:
  14. //various graphics
  15. SDL_Color * playerColors; //array [8]
  16. SDL_Color * neutralColor;
  17. SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
  18. SDL_Surface * hInfo, *tInfo; //hero and town infobox bgs
  19. SDL_Surface *heroInGarrison; //icon for town infobox
  20. std::vector<std::pair<int, int> > slotsPos; //creature slot positions in infoboxes
  21. CDefEssential *luck22, *luck30, *luck42, *luck82,
  22. *morale22, *morale30, *morale42, *morale82,
  23. *halls, *forts, *bigTownPic;
  24. std::map<int,SDL_Surface*> heroWins; //hero_ID => infobox
  25. std::map<int,SDL_Surface*> townWins; //town_ID => infobox
  26. CDefHandler * artDefs; //artifacts
  27. std::vector<SDL_Surface *> portraitSmall; //48x32 px portraits of heroes
  28. std::vector<SDL_Surface *> portraitLarge; //58x64 px portraits of heroes
  29. std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  30. CDefHandler * pskillsb, *resources; //82x93
  31. CDefHandler * pskillsm; //42x42
  32. CDefHandler * un44; //many things
  33. CDefHandler * smallIcons, *resources32; //resources 32x32
  34. CDefHandler * flags;
  35. std::vector<CDefHandler *> 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
  36. //creatures
  37. std::map<int,SDL_Surface*> smallImgs; //creature ID -> small 32x32 img of creature; //ID=-2 is for blank (black) img; -1 for the border
  38. std::map<int,SDL_Surface*> bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border
  39. std::map<int,SDL_Surface*> backgrounds; //castle ID -> 100x130 background creature image // -1 is for neutral
  40. std::map<int,SDL_Surface*> backgroundsm; //castle ID -> 100x120 background creature image // -1 is for neutral
  41. //for battles
  42. std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
  43. std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
  44. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  45. CDefHandler * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
  46. std::vector<std::string> guildBgs;// name of bitmaps with imgs for mage guild screen
  47. //abilities
  48. CDefHandler * abils32, * abils44, * abils82;
  49. //functions
  50. Graphics();
  51. void initializeBattleGraphics();
  52. void loadPaletteAndColors();
  53. void loadHeroFlags();
  54. void loadHeroFlags(std::pair<std::vector<CDefHandler *> Graphics::*, std::vector<const char *> > &pr, bool mode);
  55. void loadHeroAnim();
  56. void loadHeroPortraits();
  57. SDL_Surface * drawHeroInfoWin(const CGHeroInstance * curh);
  58. SDL_Surface * drawPrimarySkill(const CGHeroInstance *curh, SDL_Surface *ret, int from=0, int to=PRIMARY_SKILLS);
  59. SDL_Surface * drawTownInfoWin(const CGTownInstance * curh);
  60. SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //returns small picture of town: ID=-1 - blank; -2 - border; -3 - random
  61. void blueToPlayersAdv(SDL_Surface * sur, int player); //replaces blue interface colour with a color of player
  62. };
  63. extern Graphics * graphics;
  64. #endif // __GRAPHICS_H__