Graphics.h 2.7 KB

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