CConfigHandler.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. };
  26. struct ButtonInfo
  27. {
  28. std::string defName;
  29. std::vector<std::string> additionalDefs;
  30. int x, y; //position on the screen
  31. bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics)
  32. };
  33. /// Struct which holds data about position of several GUI elements at the adventure map screen
  34. struct AdventureMapConfig
  35. {
  36. //minimap properties
  37. int minimapX, minimapY, minimapW, minimapH;
  38. //statusbar
  39. int statusbarX, statusbarY; //pos
  40. std::string statusbarG; //graphic name
  41. //resdatabar
  42. int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
  43. std::string resdatabarG; //graphic name
  44. //infobox
  45. int infoboxX, infoboxY;
  46. //advmap
  47. int advmapX, advmapY, advmapW, advmapH;
  48. bool smoothMove;
  49. bool puzzleSepia;
  50. //general properties
  51. std::string mainGraphic;
  52. //buttons
  53. ButtonInfo kingOverview, underground, questlog, sleepWake, moveHero, spellbook, advOptions,
  54. sysOptions, nextHero, endTurn;
  55. //hero list
  56. int hlistX, hlistY, hlistSize;
  57. std::string hlistMB, hlistMN, hlistAU, hlistAD;
  58. //town list
  59. int tlistX, tlistY, tlistSize;
  60. std::string tlistAU, tlistAD;
  61. //gems
  62. int gemX[4], gemY[4];
  63. std::vector<std::string> gemG;
  64. //in-game console
  65. int inputLineLength, outputLineLength;
  66. //kingdom overview
  67. int overviewPics, overviewSize; //pic count in def and count of visible slots
  68. std::string overviewBg; //background name
  69. };
  70. struct GUIOptions
  71. {
  72. AdventureMapConfig ac;
  73. };
  74. /// Handles adventure map screen settings
  75. class CConfigHandler
  76. {
  77. public:
  78. ClientConfig cc;
  79. std::map<std::pair<int,int>, GUIOptions > guiOptions;
  80. GUIOptions *go(); //return pointer to gui options appropriate for used screen resolution
  81. void init();
  82. CConfigHandler(void); //c-tor
  83. ~CConfigHandler(void); //d-tor
  84. };
  85. }
  86. extern config::CConfigHandler conf;
  87. #endif // __CCONFIGHANDLER_H__