CConfigHandler.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __CCONFIGHANDLER_H__
  2. #define __CCONFIGHANDLER_H__
  3. #include "../global.h"
  4. class CAdvMapInt;
  5. /*
  6. * CConfighandler.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. namespace config
  15. {
  16. /// Struct holds data about client resolution, colors, fullscreen mode
  17. struct ClientConfig
  18. {
  19. int resx, resy, bpp, fullscreen; //client resolution/colours
  20. int screenx, screeny; //real screen resolution
  21. int pregameResx, pregameResy; //real screen resolution of preGame
  22. int port, localInformation;
  23. std::string server, //server address (e.g. 127.0.0.1)
  24. defaultPlayerAI, defaultBattleAI; //dll names
  25. bool showFPS; //show/hide FPS counter
  26. bool classicCreatureWindow;
  27. };
  28. struct ButtonInfo
  29. {
  30. std::string defName;
  31. std::vector<std::string> additionalDefs;
  32. int x, y; //position on the screen
  33. bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics)
  34. };
  35. /// Struct which holds data about position of several GUI elements at the adventure map screen
  36. struct AdventureMapConfig
  37. {
  38. //minimap properties
  39. int minimapX, minimapY, minimapW, minimapH;
  40. //statusbar
  41. int statusbarX, statusbarY; //pos
  42. std::string statusbarG; //graphic name
  43. //resdatabar
  44. int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
  45. std::string resdatabarG; //graphic name
  46. //infobox
  47. int infoboxX, infoboxY;
  48. //advmap
  49. int advmapX, advmapY, advmapW, advmapH;
  50. bool smoothMove;
  51. bool puzzleSepia;
  52. //general properties
  53. std::string mainGraphic;
  54. //buttons
  55. ButtonInfo kingOverview, underground, questlog, sleepWake, moveHero, spellbook, advOptions,
  56. sysOptions, nextHero, endTurn;
  57. //hero list
  58. int hlistX, hlistY, hlistSize;
  59. std::string hlistMB, hlistMN, hlistAU, hlistAD;
  60. //town list
  61. int tlistX, tlistY, tlistSize;
  62. std::string tlistAU, tlistAD;
  63. //gems
  64. int gemX[4], gemY[4];
  65. std::vector<std::string> gemG;
  66. //in-game console
  67. int inputLineLength, outputLineLength;
  68. //kingdom overview
  69. int overviewPics, overviewSize; //pic count in def and count of visible slots
  70. std::string overviewBg; //background name
  71. };
  72. struct GUIOptions
  73. {
  74. AdventureMapConfig ac;
  75. };
  76. /// Handles adventure map screen settings
  77. class CConfigHandler
  78. {
  79. GUIOptions *current; // pointer to current gui options
  80. public:
  81. ClientConfig cc;
  82. std::map<std::pair<int,int>, GUIOptions > guiOptions;
  83. void init();
  84. CConfigHandler(void); //c-tor
  85. ~CConfigHandler(void); //d-tor
  86. GUIOptions *go() { return current; };
  87. void SetResolution(int x, int y) {
  88. current = &guiOptions[std::pair<int,int>(x, y)];
  89. }
  90. };
  91. }
  92. extern config::CConfigHandler conf;
  93. #endif // __CCONFIGHANDLER_H__