mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Merge pull request #4004 from Laserlicht/background
[1.5.2] background for multiple windows
This commit is contained in:
commit
82af0639df
@ -21,6 +21,7 @@
|
||||
#include "../windows/InfoWindows.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
#include "../render/Canvas.h"
|
||||
#include "../render/IRenderHandler.h"
|
||||
|
||||
#include "../CGameInfo.h"
|
||||
#include "../CVideoHandler.h"
|
||||
@ -81,7 +82,8 @@ CHighScoreScreen::CHighScoreScreen(HighScorePage highscorepage, int highlighted)
|
||||
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
pos = center(Rect(0, 0, 800, 600));
|
||||
updateShadow();
|
||||
|
||||
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), Rect(-pos.x, -pos.y, GH.screenDimensions().x, GH.screenDimensions().y));
|
||||
|
||||
addHighScores();
|
||||
addButtons();
|
||||
@ -222,8 +224,8 @@ CHighScoreInputScreen::CHighScoreInputScreen(bool won, HighScoreCalculation calc
|
||||
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
pos = center(Rect(0, 0, 800, 600));
|
||||
updateShadow();
|
||||
|
||||
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), Rect(-pos.x, -pos.y, GH.screenDimensions().x, GH.screenDimensions().y));
|
||||
background = std::make_shared<TransparentFilledRectangle>(Rect(0, 0, pos.w, pos.h), Colors::BLACK);
|
||||
|
||||
if(won)
|
||||
@ -289,6 +291,9 @@ int CHighScoreInputScreen::addEntry(std::string text) {
|
||||
|
||||
void CHighScoreInputScreen::show(Canvas & to)
|
||||
{
|
||||
if(background)
|
||||
background->show(to);
|
||||
|
||||
CCS->videoh->update(pos.x, pos.y, to.getInternalSurface(), true, false,
|
||||
[&]()
|
||||
{
|
||||
@ -303,7 +308,11 @@ void CHighScoreInputScreen::show(Canvas & to)
|
||||
else
|
||||
close();
|
||||
});
|
||||
redraw();
|
||||
|
||||
if(input)
|
||||
input->showAll(to);
|
||||
for(auto & text : texts)
|
||||
text->showAll(to);
|
||||
|
||||
CIntObject::show(to);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ class CLabel;
|
||||
class CMultiLineLabel;
|
||||
class CAnimImage;
|
||||
class CTextInput;
|
||||
class CFilledTexture;
|
||||
|
||||
class TransparentFilledRectangle;
|
||||
|
||||
@ -61,6 +62,7 @@ private:
|
||||
HighScorePage highscorepage;
|
||||
|
||||
std::shared_ptr<CPicture> background;
|
||||
std::shared_ptr<CFilledTexture> backgroundAroundMenu;
|
||||
std::vector<std::shared_ptr<CButton>> buttons;
|
||||
std::vector<std::shared_ptr<CLabel>> texts;
|
||||
std::vector<std::shared_ptr<CAnimImage>> images;
|
||||
@ -93,6 +95,7 @@ class CHighScoreInputScreen : public CWindowObject
|
||||
std::vector<std::shared_ptr<CMultiLineLabel>> texts;
|
||||
std::shared_ptr<CHighScoreInput> input;
|
||||
std::shared_ptr<TransparentFilledRectangle> background;
|
||||
std::shared_ptr<CFilledTexture> backgroundAroundMenu;
|
||||
|
||||
std::string video;
|
||||
int videoSoundHandle;
|
||||
|
@ -108,9 +108,9 @@ void CMenuScreen::show(Canvas & to)
|
||||
if(!config["video"].isNull())
|
||||
{
|
||||
// redraw order: background -> video -> buttons and pictures
|
||||
background->redraw();
|
||||
background->showAll(to);
|
||||
CCS->videoh->update((int)config["video"]["x"].Float() + pos.x, (int)config["video"]["y"].Float() + pos.y, to.getInternalSurface(), true, false);
|
||||
tabs->redraw();
|
||||
tabs->showAll(to);
|
||||
}
|
||||
CIntObject::show(to);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../gui/FramerateManager.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
#include "../widgets/Images.h"
|
||||
#include "../render/Canvas.h"
|
||||
|
||||
|
||||
@ -27,7 +28,8 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
addUsedEvents(LCLICK | TIME);
|
||||
pos = center(Rect(0, 0, 800, 600));
|
||||
updateShadow();
|
||||
|
||||
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), Rect(-pos.x, -pos.y, GH.screenDimensions().x, GH.screenDimensions().y));
|
||||
|
||||
auto audioData = CCS->videoh->getAudio(spe.prologVideo);
|
||||
videoSoundHandle = CCS->soundh->playSound(audioData, -1);
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../../lib/campaign/CampaignScenarioPrologEpilog.h"
|
||||
|
||||
class CMultiLineLabel;
|
||||
class CFilledTexture;
|
||||
|
||||
class CPrologEpilogVideo : public CWindowObject
|
||||
{
|
||||
@ -25,6 +26,7 @@ class CPrologEpilogVideo : public CWindowObject
|
||||
std::function<void()> exitCb;
|
||||
|
||||
std::shared_ptr<CMultiLineLabel> text;
|
||||
std::shared_ptr<CFilledTexture> backgroundAroundMenu;
|
||||
|
||||
bool voiceStopped = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user