show the available controls in a panel over the world

This commit is contained in:
2026-08-07 18:48:01 +02:00
parent 68a43a7d98
commit 980fad272f
9 changed files with 466 additions and 0 deletions

View File

@@ -29,6 +29,7 @@
#include "SchematicChoiceDialog.h"
#include "HeaderBar.h"
#include "SelectionPanel.h"
#include "ControlsPanel.h"
#include "ShipLayoutBlueprintSerializer.h"
#include "ShipLayoutDialog.h"
#include "BuildingIconCache.h"
@@ -91,6 +92,11 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir,
m_itemIcons.get(), m_buildingIcons.get(),
this);
// Floats at the world view's opposite edge from the selection panel and reads the
// world view for the player's current situation (REQ-UI-CONTROLS-PANEL). Built
// after the view for the same stacking reason as the panels above it.
m_controlsPanel = new ControlsPanel(m_gameWorldView, this);
// Created last so it stacks above the other children; covers the whole window and
// dims the game behind modal dialogs/menus (REQ-UI-MODAL-DIM).
m_dimOverlay = new ModalDimOverlay(m_visuals.overlays.modalDim, this);
@@ -173,6 +179,10 @@ void MainWindow::layoutPanels()
// move for it (REQ-UI-SELECTION-PANEL, REQ-UI-BUILD-BAR).
m_selectionPanel->anchorTo(
worldRect.adjusted(0, 0, 0, -m_buildButtonBar->getStripHeightPx()));
// Same band, opposite edge: left and bottom-aligned, so it clears the bar's strip
// too and never meets the selection panel (REQ-UI-CONTROLS-PANEL).
m_controlsPanel->anchorTo(
worldRect.adjusted(0, 0, 0, -m_buildButtonBar->getStripHeightPx()));
m_dimOverlay->setGeometry(0, 0, totalW, totalH);
}