Graphics.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef GRAPHICS_H
  2. #define GRAPHICS_H
  3. #ifdef _MSC_VER
  4. #pragma once
  5. #endif
  6. #include "../global.h"
  7. class CDefEssential;
  8. struct SDL_Surface;
  9. class CGHeroInstance;
  10. class CGTownInstance;
  11. class CDefHandler;
  12. class CHeroClass;
  13. struct SDL_Color;
  14. class Graphics
  15. {
  16. public:
  17. //various graphics
  18. SDL_Color * playerColors; //array [8]
  19. SDL_Color * neutralColor;
  20. SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
  21. SDL_Surface * hInfo, *tInfo; //hero and town infobox bgs
  22. SDL_Surface *heroInGarrison; //icon for town infobox
  23. std::vector<std::pair<int, int> > slotsPos; //creature slot positions in infoboxes
  24. CDefEssential *luck22, *luck30, *luck42, *luck82,
  25. *morale22, *morale30, *morale42, *morale82,
  26. *halls, *forts, *bigTownPic;
  27. std::map<int,SDL_Surface*> heroWins; //hero_ID => infobox
  28. std::map<int,SDL_Surface*> townWins; //town_ID => infobox
  29. CDefHandler * artDefs; //artifacts
  30. std::vector<SDL_Surface *> portraitSmall; //48x32 px portraits of heroes
  31. std::vector<SDL_Surface *> portraitLarge; //58x64 px portraits of heroes
  32. std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  33. CDefHandler * pskillsb, *resources; //82x93
  34. CDefHandler * pskillsm; //42x42
  35. CDefHandler * un44; //many things
  36. CDefHandler * smallIcons, *resources32; //resources 32x32
  37. CDefHandler * flags;
  38. //creatures
  39. std::map<int,SDL_Surface*> smallImgs; //creature ID -> small 32x32 img of creature; //ID=-2 is for blank (black) img; -1 for the border
  40. std::map<int,SDL_Surface*> bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border
  41. std::map<int,SDL_Surface*> backgrounds; //castle ID -> 100x130 background creature image // -1 is for neutral
  42. std::map<int,SDL_Surface*> backgroundsm; //castle ID -> 100x120 background creature image // -1 is for neutral
  43. //for battles
  44. std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
  45. std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
  46. std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
  47. CDefHandler * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
  48. std::vector<std::string> guildBgs;// name of bitmaps with imgs for mage guild screen
  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(std::vector<CDefHandler **> & anims);
  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