CConfigHandler.h 2.8 KB

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