CConfigHandler.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. };
  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. public:
  79. ClientConfig cc;
  80. std::map<std::pair<int,int>, GUIOptions > guiOptions;
  81. GUIOptions *go(); //return pointer to gui options appropriate for used screen resolution
  82. void init();
  83. CConfigHandler(void); //c-tor
  84. ~CConfigHandler(void); //d-tor
  85. };
  86. }
  87. extern config::CConfigHandler conf;
  88. #endif // __CCONFIGHANDLER_H__