mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
hide adventuremap
This commit is contained in:
parent
d64473b894
commit
a1f4fcb78a
@ -145,6 +145,8 @@
|
||||
"vcmi.adventureOptions.mapScrollSpeed1.help": "Set the map scrolling speed to very slow.",
|
||||
"vcmi.adventureOptions.mapScrollSpeed5.help": "Set the map scrolling speed to very fast.",
|
||||
"vcmi.adventureOptions.mapScrollSpeed6.help": "Set the map scrolling speed to instantaneous.",
|
||||
"vcmi.adventureOptions.hideBackground.hover" : "Hide Background",
|
||||
"vcmi.adventureOptions.hideBackground.help" : "{Hide Background}\n\nHide the adventuremap in the background and show a texture instead.",
|
||||
|
||||
"vcmi.battleOptions.queueSizeLabel.hover": "Show Turn Order Queue",
|
||||
"vcmi.battleOptions.queueSizeNoneButton.hover": "OFF",
|
||||
|
@ -145,6 +145,8 @@
|
||||
"vcmi.adventureOptions.mapScrollSpeed1.help": "Geschwindigkeit des Kartenbildlaufs auf sehr langsam einstellen",
|
||||
"vcmi.adventureOptions.mapScrollSpeed5.help": "Geschwindigkeit des Kartenbildlaufs auf sehr schnell einstellen",
|
||||
"vcmi.adventureOptions.mapScrollSpeed6.help": "Geschwindigkeit des Kartenbildlaufs auf sofort einstellen",
|
||||
"vcmi.adventureOptions.hideBackground.hover" : "Hintergrund ausblenden",
|
||||
"vcmi.adventureOptions.hideBackground.help" : "{Hintergrund ausblenden}\n\nDie Abenteuerkarte im Hintergrund ausblenden und stattdessen eine Textur anzeigen.",
|
||||
|
||||
"vcmi.battleOptions.queueSizeLabel.hover": "Reihenfolge der Kreaturen anzeigen",
|
||||
"vcmi.battleOptions.queueSizeNoneButton.hover": "AUS",
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "../gui/Shortcut.h"
|
||||
#include "../gui/WindowHandler.h"
|
||||
#include "../render/Canvas.h"
|
||||
#include "../render/IRenderHandler.h"
|
||||
#include "../CMT.h"
|
||||
#include "../PlayerLocalState.h"
|
||||
#include "../CPlayerInterface.h"
|
||||
@ -168,6 +169,15 @@ void AdventureMapInterface::show(Canvas & to)
|
||||
|
||||
void AdventureMapInterface::dim(Canvas & to)
|
||||
{
|
||||
if(settings["adventure"]["hideBackground"].Bool())
|
||||
for (auto window : GH.windows().findWindows<IShowActivatable>())
|
||||
{
|
||||
if(!std::dynamic_pointer_cast<AdventureMapInterface>(window) && std::dynamic_pointer_cast<CIntObject>(window) && std::dynamic_pointer_cast<CIntObject>(window)->pos.w >= 800 && std::dynamic_pointer_cast<CIntObject>(window)->pos.w >= 600)
|
||||
{
|
||||
to.fillTexture(GH.renderHandler().loadImage(ImagePath::builtin("DiBoxBck")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (auto window : GH.windows().findWindows<IShowActivatable>())
|
||||
{
|
||||
if (!std::dynamic_pointer_cast<AdventureMapInterface>(window) && !std::dynamic_pointer_cast<RadialMenu>(window) && !window->isPopupWindow())
|
||||
|
@ -182,6 +182,20 @@ void Canvas::drawColorBlended(const Rect & target, const ColorRGBA & color)
|
||||
CSDL_Ext::fillRectBlended(surface, realTarget, CSDL_Ext::toSDL(color));
|
||||
}
|
||||
|
||||
void Canvas::fillTexture(const std::shared_ptr<IImage>& image)
|
||||
{
|
||||
assert(image);
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
Rect imageArea = Rect(Point(0, 0), image->dimensions());
|
||||
for (int y=0; y < surface->h; y+= imageArea.h)
|
||||
{
|
||||
for (int x=0; x < surface->w; x+= imageArea.w)
|
||||
image->draw(surface, renderArea.x + x, renderArea.y + y);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Surface * Canvas::getInternalSurface()
|
||||
{
|
||||
return surface;
|
||||
|
@ -99,6 +99,9 @@ public:
|
||||
/// fills selected area with blended color
|
||||
void drawColorBlended(const Rect & target, const ColorRGBA & color);
|
||||
|
||||
/// fills canvas with texture
|
||||
void fillTexture(const std::shared_ptr<IImage>& image);
|
||||
|
||||
/// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished.
|
||||
SDL_Surface * getInternalSurface();
|
||||
|
||||
|
@ -134,6 +134,10 @@ AdventureOptionsTab::AdventureOptionsTab()
|
||||
{
|
||||
return setBoolSetting("gameTweaks", "skipAdventureMapAnimations", value);
|
||||
});
|
||||
addCallback("hideBackgroundChanged", [](bool value)
|
||||
{
|
||||
return setBoolSetting("adventure", "hideBackground", value);
|
||||
});
|
||||
build(config);
|
||||
|
||||
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
|
||||
@ -179,4 +183,7 @@ AdventureOptionsTab::AdventureOptionsTab()
|
||||
|
||||
std::shared_ptr<CToggleButton> skipAdventureMapAnimationsCheckbox = widget<CToggleButton>("skipAdventureMapAnimationsCheckbox");
|
||||
skipAdventureMapAnimationsCheckbox->setSelected(settings["gameTweaks"]["skipAdventureMapAnimations"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> hideBackgroundCheckbox = widget<CToggleButton>("hideBackgroundCheckbox");
|
||||
hideBackgroundCheckbox->setSelected(settings["adventure"]["hideBackground"].Bool());
|
||||
}
|
||||
|
@ -241,7 +241,7 @@
|
||||
"type" : "object",
|
||||
"additionalProperties" : false,
|
||||
"default" : {},
|
||||
"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel" ],
|
||||
"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground" ],
|
||||
"properties" : {
|
||||
"heroMoveTime" : {
|
||||
"type" : "number",
|
||||
@ -294,6 +294,10 @@
|
||||
"type" : "number",
|
||||
"default" : 128
|
||||
},
|
||||
"hideBackground" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
}
|
||||
}
|
||||
},
|
||||
"battle" : {
|
||||
|
@ -297,6 +297,9 @@
|
||||
},
|
||||
{
|
||||
"text": "vcmi.adventureOptions.showGrid.hover"
|
||||
},
|
||||
{
|
||||
"text": "vcmi.adventureOptions.hideBackground.hover"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -324,6 +327,11 @@
|
||||
"name": "showGridCheckbox",
|
||||
"help": "vcmi.adventureOptions.showGrid",
|
||||
"callback": "showGridChanged"
|
||||
},
|
||||
{
|
||||
"name": "hideBackgroundCheckbox",
|
||||
"help": "vcmi.adventureOptions.hideBackground",
|
||||
"callback": "hideBackgroundChanged"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user