CConfigHandler.h 1.8 KB

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