CConfigHandler.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef CCONFIGHANDLER_H
  2. #define CCONFIGHANDLER_H
  3. #pragma once
  4. #include "../global.h"
  5. class CAdvMapInt;
  6. namespace config
  7. {
  8. struct ClientConfig
  9. {
  10. int resx, resy, bpp, fullscreen; //client resolution/colours
  11. int port, localInformation;
  12. std::string server, //server address (e.g. 127.0.0.1)
  13. defaultAI; //dll name
  14. };
  15. struct ButtonInfo
  16. {
  17. std::string defName;
  18. std::vector<std::string> additionalDefs;
  19. int x, y; //position on the screen
  20. bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics)
  21. };
  22. struct AdventureMapConfig
  23. {
  24. //minimap properties
  25. int minimapX, minimapY, minimapW, minimapH;
  26. //statusbar
  27. int statusbarX, statusbarY; //pos
  28. std::string statusbarG; //graphic name
  29. //resdatabar
  30. int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
  31. std::string resdatabarG; //graphic name
  32. //infobox
  33. int infoboxX, infoboxY;
  34. //advmap
  35. int tilesW, tilesH, advmapX, advmapY, advmapTrimX, advmapTrimY;
  36. //general properties
  37. std::string mainGraphic;
  38. //buttons
  39. ButtonInfo kingOverview, underground, questlog, sleepWake, moveHero, spellbook, advOptions,
  40. sysOptions, nextHero, endTurn;
  41. //hero list
  42. int hlistX, hlistY, hlistSize;
  43. std::string hlistMB, hlistMN, hlistAU, hlistAD;
  44. //town list
  45. int tlistX, tlistY, tlistSize;
  46. std::string tlistAU, tlistAD;
  47. //gems
  48. int gemX[4], gemY[4];
  49. std::vector<std::string> gemG;
  50. };
  51. struct GUIOptions
  52. {
  53. AdventureMapConfig ac;
  54. };
  55. class CConfigHandler
  56. {
  57. public:
  58. ClientConfig cc;
  59. std::map<std::pair<int,int>, GUIOptions > guiOptions;
  60. GUIOptions *go(); //return pointer to gui options appropriate for used screen resolution
  61. void init();
  62. CConfigHandler(void);
  63. ~CConfigHandler(void);
  64. };
  65. }
  66. extern config::CConfigHandler conf;
  67. #endif //CCONFIGHANDLER_H