1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Further progress - UI tweaks, new settings etc

This commit is contained in:
Dydzio 2023-02-14 20:30:06 +01:00
parent 80a5595d6c
commit fb06aca0bb
24 changed files with 277 additions and 36 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,8 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "quadwide-normal.png"},
{ "frame" : 1, "file" : "quadwide-pressed.png"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,8 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "square-normal.png"},
{ "frame" : 1, "file" : "square-pressed.png"}
]
}

View File

@ -0,0 +1,8 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "square-normal.png"},
{ "frame" : 1, "file" : "square-pressed.png"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,8 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "triplewide-normal.png"},
{ "frame" : 1, "file" : "triplewide-pressed.png"}
]
}

View File

@ -1,8 +0,0 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "vcmisettingsNormal.png"},
{ "frame" : 1, "file" : "vcmisettingsPressed.png"}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,8 +0,0 @@
{
"basepath" : "buttons/",
"images" :
[
{ "frame" : 0, "file" : "vcmisettingsbackNormal.png"},
{ "frame" : 1, "file" : "vcmisettingsbackPressed.png"}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -49,6 +49,8 @@
"vcmi.adventureOptions.numericQuantities.help" : "{Numeric creatures quantities}\n\n Shows inaccurate enemy creatures quantities in numeric A-B format",
"vcmi.adventureOptions.forceMovementInfo.hover" : "Always show move info in status bar",
"vcmi.adventureOptions.forceMovementInfo.help" : "{Always show move info in status bar}\n\n Replaces default status bar info with movement points data without need to hold ALT button",
"vcmi.adventureOptions.showGrid.hover" : "Show grid",
"vcmi.adventureOptions.showGrid.help" : "{Show grid}\n\n Shows grid overlay, showing borders between adventure map tiles",
"vcmi.battleOptions.showQueue.hover": "Show queue",
"vcmi.battleOptions.showQueue.help": "{Show queue}\n\n Show queue that displays movement order of creature stacks",

View File

@ -919,7 +919,7 @@ void CMapHandler::CMapBlitter::blit(SDL_Surface * targetSurf, const MapDrawingIn
drawOverlayEx(targetSurf);
// drawDebugGrid()
if (settings["session"]["showGrid"].Bool())
if (settings["gameTweaks"]["showGrid"].Bool())
{
for (realPos.x = initPos.x, pos.x = topTile.x; pos.x < topTile.x + tileCount.x; pos.x++, realPos.x += tileSize)
{

View File

@ -43,6 +43,7 @@ AdventureOptionsTab::AdventureOptionsTab()
//settings that do not belong to base game:
addCallback("numericQuantitiesChanged", std::bind(&setBoolSetting, "gameTweaks", "numericCreaturesQuantities", _1));
addCallback("forceMovementInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "forceMovementInfo", _1));
addCallback("showGridChanged", std::bind(&setBoolSetting, "gameTweaks", "showGrid", _1));
build(config);
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
@ -65,4 +66,7 @@ AdventureOptionsTab::AdventureOptionsTab()
std::shared_ptr<CToggleButton> forceMovementInfoCheckbox = widget<CToggleButton>("forceMovementInfoCheckbox");
forceMovementInfoCheckbox->setSelected((bool)settings["gameTweaks"]["forceMovementInfo"].Bool());
std::shared_ptr<CToggleButton> showGridCheckbox = widget<CToggleButton>("showGridCheckbox");
showGridCheckbox->setSelected((bool)settings["gameTweaks"]["showGrid"].Bool());
}

View File

@ -28,11 +28,15 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
addCallback("movementShadowChanged", std::bind(&BattleOptionsTab::movementShadowChangedCallback, this, _1, owner));
addCallback("mouseShadowChanged", std::bind(&BattleOptionsTab::mouseShadowChangedCallback, this, _1));
addCallback("animationSpeedChanged", std::bind(&BattleOptionsTab::animationSpeedChangedCallback, this, _1));
addCallback("showQueueChanged", std::bind(&BattleOptionsTab::showQueueChangedCallback, this, _1));
addCallback("queueSizeChanged", std::bind(&BattleOptionsTab::queueSizeChangedCallback, this, _1));
build(config);
std::shared_ptr<CToggleGroup> animationSpeedToggle = widget<CToggleGroup>("animationSpeedPicker");
animationSpeedToggle->setSelected(getAnimSpeed());
std::shared_ptr<CToggleGroup> queueSizeToggle = widget<CToggleGroup>("queueSizePicker");
queueSizeToggle->setSelected(getQueueSizeId());
std::shared_ptr<CToggleButton> viewGridCheckbox = widget<CToggleButton>("viewGridCheckbox");
viewGridCheckbox->setSelected((bool)settings["battle"]["cellBorders"].Bool());
@ -42,6 +46,9 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
std::shared_ptr<CToggleButton> mouseShadowCheckbox = widget<CToggleButton>("mouseShadowCheckbox");
mouseShadowCheckbox->setSelected((bool)settings["battle"]["mouseShadow"].Bool());
std::shared_ptr<CToggleButton> showQueueCheckbox = widget<CToggleButton>("showQueueCheckbox");
showQueueCheckbox->setSelected((bool)settings["battle"]["showQueue"].Bool());
}
int BattleOptionsTab::getAnimSpeed() const
@ -52,6 +59,34 @@ int BattleOptionsTab::getAnimSpeed() const
return static_cast<int>(std::round(settings["battle"]["speedFactor"].Float()));
}
int BattleOptionsTab::getQueueSizeId() const
{
std::string text = settings["battle"]["queueSize"].String();
if(text == "auto")
return 0;
else if(text == "small")
return 1;
else if(text == "big")
return 2;
return 0;
}
std::string BattleOptionsTab::getQueueSizeStringFromId(int value) const
{
switch(value)
{
case 0:
return "auto";
case 1:
return "small";
case 2:
return "big";
default:
return "auto";
}
}
void BattleOptionsTab::viewGridChangedCallback(bool value, BattleInterface * parentBattleInterface)
{
Settings cellBorders = settings.write["battle"]["cellBorders"];
@ -80,3 +115,16 @@ void BattleOptionsTab::animationSpeedChangedCallback(int value)
speed->Float() = float(value);
}
void BattleOptionsTab::showQueueChangedCallback(bool value)
{
Settings shadow = settings.write["battle"]["showQueue"];
shadow->Bool() = value;
}
void BattleOptionsTab::queueSizeChangedCallback(int value)
{
std::string stringifiedValue = getQueueSizeStringFromId(value);
Settings size = settings.write["battle"]["queueSize"];
size->String() = stringifiedValue;
}

View File

@ -19,10 +19,14 @@ private:
std::vector<std::shared_ptr<CToggleButton>> toggles;
int getAnimSpeed() const;
int getQueueSizeId() const;
std::string getQueueSizeStringFromId(int value) const;
void viewGridChangedCallback(bool value, BattleInterface * parentBattleInterface = nullptr);
void movementShadowChangedCallback(bool value, BattleInterface * parentBattleInterface = nullptr);
void mouseShadowChangedCallback(bool value);
void animationSpeedChangedCallback(int value);
void showQueueChangedCallback(bool value);
void queueSizeChangedCallback(int value);
public:
BattleOptionsTab(BattleInterface * owner = nullptr);
};

View File

@ -147,16 +147,38 @@
{
"index": 6,
"type": "toggleButton",
"image": "sysob11",
"help": "core.help.359",
"position": {"x": 192, "y": 0}
"image": "buttons/square",
"help": "TODO",
"position": {"x": 192, "y": 0},
"items":
[
{
"name": "mapScrollSpeed4",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "4"
}
]
},
{
"index": 8,
"type": "toggleButton",
"image": "sysob11",
"help": "core.help.359",
"position": {"x": 256, "y": 0}
"image": "buttons/square",
"help": "TODO",
"position": {"x": 224, "y": 0},
"items":
[
{
"name": "mapScrollSpeed5",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "5"
}
]
}
],
"callback": "mapScrollSpeedChanged"
@ -189,6 +211,10 @@
{
"position": {"x": 64, "y": 402},
"text": "vcmi.adventureOptions.forceMovementInfo.hover"
},
{
"position": {"x": 64, "y": 438},
"text": "vcmi.adventureOptions.showGrid.hover"
}
]
},
@ -227,6 +253,14 @@
"help": "vcmi.adventureOptions.forceMovementInfo",
"position": {"x": 28, "y": 400},
"callback": "forceMovementInfoChanged"
},
{
"name": "showGridCheckbox",
"type": "toggleButton",
"image": "sysopchk.def",
"help": "vcmi.adventureOptions.showGrid",
"position": {"x": 28, "y": 436},
"callback": "showGridChanged"
}
]
}

View File

@ -188,19 +188,152 @@
{
"index": 6,
"type": "toggleButton",
"image": "sysob11",
"help": "core.help.424",
"position": {"x": 192, "y": 0}
"image": "buttons/square",
"help": "TODO",
"position": {"x": 192, "y": 0},
"items":
[
{
"name": "battleAnimationsSpeed4",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "4"
}
]
},
{
"index": 12,
"type": "toggleButton",
"image": "sysob11",
"help": "core.help.424",
"position": {"x": 256, "y": 0}
"image": "buttons/square",
"help": "TODO",
"position": {"x": 229, "y": 0},
"items":
[
{
"name": "battleAnimationsSpeed5",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "5"
}
]
},
{
"index": 24,
"type": "toggleButton",
"image": "buttons/square",
"help": "TODO",
"position": {"x": 266, "y": 0},
"items":
[
{
"name": "battleAnimationsSpeed6",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "6"
}
]
}
],
"callback": "animationSpeedChanged"
},
{
"name": "showQueueLabel",
"type": "label",
"font": "medium",
"alignment": "left",
"color": "white",
"text": "vcmi.battleOptions.showQueue.hover",
"position": {"x": 61, "y": 363}
},
{
"name": "showQueueCheckbox",
"type": "toggleButton",
"image": "sysopchk.def",
"help": "vcmi.battleOptions.showQueue",
"position": {"x": 25, "y": 361},
"callback": "showQueueChanged"
},
{
"name": "queueSizeLabel",
"type": "label",
"font": "medium",
"alignment": "left",
"color": "white",
"text": "vcmi.battleOptions.queueSizeLabel.hover",
"position": {"x": 60, "y": 399}
},
{
"name": "queueSizePicker",
"type": "toggleGroup",
"position": {"x": 28, "y": 420},
"items":
[
{
"index": 0, //auto
"type": "toggleButton",
"image": "buttons/triplewide",
"help": "TODO",
"position": {"x": 0, "y": 0},
"items":
[
{
"name": "queueSizeAutoText",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "AUTO"
}
]
},
{
"index": 1, //small
"type": "toggleButton",
"image": "buttons/triplewide",
"help": "TODO",
"position": {"x": 113, "y": 0},
"items":
[
{
"name": "queueSizeSmallText",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "SMALL"
}
]
},
{
"index": 2, //large
"type": "toggleButton",
"image": "buttons/triplewide",
"help": "TODO",
"position": {"x": 226, "y": 0},
"items":
[
{
"name": "queueSizeBigText",
"type": "label",
"font": "big",
"alignment": "center",
"color": "yellow",
"text": "BIG"
}
]
}
],
"callback": "queueSizeChanged"
}
]
}

View File

@ -12,7 +12,7 @@
"name": "activateGeneralOptionsButton",
"type": "button",
"position": {"x": 0, "y": 0},
"image": "buttons/vcmisettings",
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.systemTab",
"callback": "activateGeneralTab",
"items":
@ -31,8 +31,8 @@
{
"name": "activateAdventureOptionsButton",
"type": "button",
"position": {"x": 200, "y": 0},
"image": "buttons/vcmisettings",
"position": {"x": 150, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.adventureTab",
"callback": "activateAdventureTab",
"items":
@ -51,8 +51,8 @@
{
"name": "activateBattleOptionsButton",
"type": "button",
"position": {"x": 400, "y": 0},
"image": "buttons/vcmisettings",
"position": {"x": 300, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.battleTab",
"callback": "activateBattleTab",
"items":
@ -71,8 +71,8 @@
{
"name": "activateVcmiSettingsButton",
"type": "button",
"position": {"x": 600, "y": 0},
"image": "buttons/vcmisettings",
"position": {"x": 450, "y": 0},
"image": "buttons/quadwide",
"help": "vcmi.settingsMainWindow.otherTab",
"callback": "activateVcmiSettingsTab",
"items":