CConfigHandler.h 1.6 KB

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