Skip to content

Commit 52b86cb

Browse files
committed
Introduce method to draw background ob IngameWindows
Some windows need to draw a custom background where all controls, borders etc. are on top. In the observation window this is the map view which should seemlessly blend with all controls. This fixes a regression of 700945f where the controls of the observation window got hidden behind the map view. Fixes #1787
1 parent 331409a commit 52b86cb

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

libs/s25main/ingameWindows/IngameWindow.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,7 @@ void IngameWindow::Draw_()
423423
// Client area
424424
if(!isMinimized_)
425425
{
426-
if(background)
427-
background->DrawPart(Rect(GetPos() + DrawPoint(contentOffset), GetIwSize()));
428-
426+
DrawBackground();
429427
Window::Draw_();
430428
DrawContent();
431429
}
@@ -435,6 +433,12 @@ void IngameWindow::Draw_()
435433
bottomBorderSideImg->DrawFull(GetPos() + GetSize() - bottomBorderSideImg->GetSize());
436434
}
437435

436+
void IngameWindow::DrawBackground()
437+
{
438+
if(background)
439+
background->DrawPart(Rect(GetPos() + DrawPoint(contentOffset), GetIwSize()));
440+
}
441+
438442
void IngameWindow::MoveToCenter()
439443
{
440444
SetPos(DrawPoint(VIDEODRIVER.GetRenderSize() - GetSize()) / 2);

libs/s25main/ingameWindows/IngameWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class IngameWindow : public Window
104104

105105
protected:
106106
void Draw_() final;
107+
/// Called when not minimized before drawing the frame
108+
virtual void DrawBackground();
107109
/// Called when not minimized after the frame and background have been drawn
108110
virtual void DrawContent() {}
109111

libs/s25main/ingameWindows/iwObservate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void iwObservate::Msg_Timer(const unsigned ctrl_id)
179179
}
180180
}
181181

182-
void iwObservate::DrawContent()
182+
void iwObservate::DrawBackground()
183183
{
184184
if(GetPos() != lastWindowPos)
185185
{

libs/s25main/ingameWindows/iwObservate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class iwObservate : public IngameWindow
3737
iwObservate(GameWorldView& gwv, MapPoint selectedPt);
3838

3939
private:
40-
void DrawContent() override;
40+
void DrawBackground() override;
4141
void Msg_ButtonClick(unsigned ctrl_id) override;
4242
bool Msg_MouseMove(const MouseCoords& mc) override;
4343
bool Msg_RightDown(const MouseCoords& mc) override;

0 commit comments

Comments
 (0)