Skip to content

Commit 4d76423

Browse files
committed
Fix misplaced buttons in game interface for very small windows
The game interface draws the frame manually using the render size. The size given in the resize event data is capped, so the buttons might end up outside the screen. For consistency use the same size here so the full frame is always intact.
1 parent 0f40d2d commit 4d76423

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

libs/s25main/desktops/dskGameInterface.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ void dskGameInterface::Resize(const Extent& newSize)
301301
cbb.buildBorder(newSize, borders);
302302

303303
// move buttons
304-
DrawPoint barPos((newSize.x - LOADER.GetImageN("resource", 29)->getWidth()) / 2 + 44,
305-
newSize.y - LOADER.GetImageN("resource", 29)->getHeight() + 4);
304+
// Get real renderer size as newSize may get capped but we want to keep the manually drawn borders intact
305+
const Extent realNewSize = VIDEODRIVER.GetRenderSize();
306+
DrawPoint barPos = DrawPoint((realNewSize.x - LOADER.GetImageN("resource", 29)->getWidth()) / 2 + 44,
307+
realNewSize.y - LOADER.GetImageN("resource", 29)->getHeight() + 4);
306308

307309
auto* button = GetCtrl<ctrlButton>(ID_btMap);
308310
button->SetPos(barPos);

0 commit comments

Comments
 (0)