CConfigHandler.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. bool smoothMove;
  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__