1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Initial part of dynamically-sized adventure map:

- removed no longer used CConfigHandler
- remove no longer use resolutions.json
- moved widget management from adventure map to a separate class
- adventure map layout is now loaded from config
This commit is contained in:
Ivan Savenko
2023-04-26 15:44:10 +03:00
parent cb8201876b
commit a015bf6507
28 changed files with 1335 additions and 884 deletions

View File

@@ -112,83 +112,6 @@ public:
friend class SettingsStorage;
};
namespace config
{
struct DLL_LINKAGE ButtonInfo
{
std::string defName;
std::vector<std::string> additionalDefs;
int x, y; //position on the screen
bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics)
};
/// Struct which holds data about position of several GUI elements at the adventure map screen
struct DLL_LINKAGE AdventureMapConfig
{
//minimap properties
int minimapX, minimapY, minimapW, minimapH;
//statusbar
int statusbarX, statusbarY; //pos
std::string statusbarG; //graphic name
//resdatabar
int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
std::string resdatabarG; //graphic name
//infobox
int infoboxX, infoboxY;
//advmap
int advmapX, advmapY, advmapW, advmapH;
bool smoothMove;
bool puzzleSepia;
bool screenFading;
bool objectFading;
//general properties
std::string mainGraphic;
std::string worldViewGraphic;
//buttons
ButtonInfo kingOverview, underground, questlog, sleepWake, moveHero, spellbook, advOptions,
sysOptions, nextHero, endTurn;
//hero list
int hlistX, hlistY, hlistSize;
std::string hlistMB, hlistMN, hlistAU, hlistAD;
//town list
int tlistX, tlistY, tlistSize;
std::string tlistAU, tlistAD;
//gems
int gemX[4], gemY[4];
std::vector<std::string> gemG;
//in-game console
int inputLineLength, outputLineLength;
//kingdom overview
int overviewPics, overviewSize; //pic count in def and count of visible slots
std::string overviewBg; //background name
};
struct DLL_LINKAGE GUIOptions
{
AdventureMapConfig ac;
};
/// Handles adventure map screen settings
class DLL_LINKAGE CConfigHandler
{
GUIOptions *current; // pointer to current gui options
public:
using GuiOptionsMap = std::map<std::pair<int, int>, GUIOptions>;
GuiOptionsMap guiOptions;
void init();
CConfigHandler();
GUIOptions *go() { return current; };
void SetResolution(int x, int y)
{
std::pair<int,int> index(x, y);
if (guiOptions.count(index) == 0)
current = nullptr;
else
current = &guiOptions.at(index);
}
};
}
extern DLL_LINKAGE SettingsStorage settings;
extern DLL_LINKAGE config::CConfigHandler conf;
VCMI_LIB_NAMESPACE_END