move ui panels to the right

This commit is contained in:
2026-06-14 13:00:10 +02:00
parent 10c5ad678f
commit 123c544423
3 changed files with 34 additions and 33 deletions

View File

@@ -349,27 +349,30 @@ Modules in `modules.toml` define a `surface_mask` — a list of strings that des
### Layout ### Layout
The screen is divided into three vertical sections: The screen is divided into two columns: a main column (75% width) containing the header bar and game world, and a side panel column (25% width) containing the three UI panels stacked vertically:
``` ```
+--------------------------------------------------+ +--------------------------------------+--------------+
| Header Bar | | Header Bar | |
+--------------------------------------------------+ +--------------------------------------+ Selected |
| | | | Building |
| Game World (70%) | | | Panel |
| | | +--------------+
+-----------------+-----------------+--------------+ | Game World | Build |
| Selected | Build Button | Blueprint | | | Button |
| Building Panel | Grid | Panel | | | Grid |
| (left) | (center) | (right) | | +--------------+
+-----------------+-----------------+--------------+ | | Blueprint |
| | Panel |
+--------------------------------------+--------------+
(75% width) (25% width)
``` ```
- REQ-UI-HEADER: The header bar spans the full width above the game world and always shows the elapsed survival time and the current global building blocks stock on the left, the boss wave counter and boss countdown (REQ-UI-BOSS-STATUS) to the left of the speed buttons, and game speed controls on the right. - REQ-UI-HEADER: The header bar spans the width of the game world column (75% of the screen width) and always shows the elapsed survival time and the current global building blocks stock on the left, the boss wave counter and boss countdown (REQ-UI-BOSS-STATUS) to the left of the speed buttons, and game speed controls on the right.
- REQ-UI-BOSS-STATUS: The header bar displays, to the left of the speed buttons, the current boss wave counter (REQ-WAV-BOSS-COUNTER) and the time remaining on the boss countdown (REQ-WAV-BOSS-COUNTDOWN). The boss wave counter is shown as `Boss Wave #<x>` and the countdown as `Next boss: <M:SS>`, where `<M:SS>` is the remaining seconds formatted as whole minutes and two-digit seconds. Both values update continuously as the simulation runs. - REQ-UI-BOSS-STATUS: The header bar displays, to the left of the speed buttons, the current boss wave counter (REQ-WAV-BOSS-COUNTER) and the time remaining on the boss countdown (REQ-WAV-BOSS-COUNTDOWN). The boss wave counter is shown as `Boss Wave #<x>` and the countdown as `Next boss: <M:SS>`, where `<M:SS>` is the remaining seconds formatted as whole minutes and two-digit seconds. Both values update continuously as the simulation runs.
- REQ-UI-SPEED: The game speed controls in the header bar are buttons for 0×, 0.5×, 1×, 2×, and 4× speed. The currently active speed is shown as selected. All game simulation (production, movement, threat accumulation, wave timing) scales with the selected speed. 0× pauses the game. - REQ-UI-SPEED: The game speed controls in the header bar are buttons for 0×, 0.5×, 1×, 2×, and 4× speed. The currently active speed is shown as selected. All game simulation (production, movement, threat accumulation, wave timing) scales with the selected speed. 0× pauses the game.
- REQ-UI-WORLD-HEIGHT: The game world view occupies 70% of the remaining screen height below the header bar. - REQ-UI-WORLD-SIZE: The game world view occupies the full height below the header bar in the main column (75% of the screen width).
- REQ-UI-PANEL-HEIGHT: The UI panel occupies the remaining 30% of the screen height, split horizontally into a selected building panel (left), a build button grid (center), and a blueprint panel (right). - REQ-UI-PANEL-COLUMN: The side panel column occupies 25% of the screen width and the full screen height. It is divided into three equal-height panels stacked top to bottom: selected building panel (top), build button grid (middle), and blueprint panel (bottom).
### Game World ### Game World

View File

@@ -6,7 +6,6 @@
#include <QApplication> #include <QApplication>
#include <QCloseEvent> #include <QCloseEvent>
#include <QFile> #include <QFile>
#include <QHBoxLayout>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QResizeEvent> #include <QResizeEvent>
@@ -40,18 +39,18 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir, QWidget* p
m_gameWorldView = new GameWorldView(sim, &sim->config(), &m_visuals, this); m_gameWorldView = new GameWorldView(sim, &sim->config(), &m_visuals, this);
m_bottomPanel = new QWidget(this); m_sidePanel = new QWidget(this);
QHBoxLayout* bottomLayout = new QHBoxLayout(m_bottomPanel); QVBoxLayout* sideLayout = new QVBoxLayout(m_sidePanel);
bottomLayout->setContentsMargins(0, 0, 0, 0); sideLayout->setContentsMargins(0, 0, 0, 0);
bottomLayout->setSpacing(0); sideLayout->setSpacing(0);
m_selectedBuildingPanel = new SelectedBuildingPanel(sim, &sim->config(), m_bottomPanel); m_selectedBuildingPanel = new SelectedBuildingPanel(sim, &sim->config(), m_sidePanel);
m_buildButtonGrid = new BuildButtonGrid(&sim->config(), m_bottomPanel); m_buildButtonGrid = new BuildButtonGrid(&sim->config(), m_sidePanel);
m_blueprintPanel = new BlueprintPanel(sim, &sim->config(), m_bottomPanel); m_blueprintPanel = new BlueprintPanel(sim, &sim->config(), m_sidePanel);
bottomLayout->addWidget(m_selectedBuildingPanel, 1); sideLayout->addWidget(m_selectedBuildingPanel, 1);
bottomLayout->addWidget(m_buildButtonGrid, 1); sideLayout->addWidget(m_buildButtonGrid, 1);
bottomLayout->addWidget(m_blueprintPanel, 1); sideLayout->addWidget(m_blueprintPanel, 1);
m_gameWorldView->setFocus(); m_gameWorldView->setFocus();
@@ -117,13 +116,12 @@ void MainWindow::layoutPanels()
const int totalH = height(); const int totalH = height();
const int headerH = m_headerBar->sizeHint().height(); const int headerH = m_headerBar->sizeHint().height();
if (headerH <= 0) { return; } if (headerH <= 0) { return; }
const int remaining = totalH - headerH; const int mainW = totalW * 75 / 100;
const int gameH = remaining * 70 / 100; const int sideW = totalW - mainW;
const int panelH = remaining - gameH;
m_headerBar->setGeometry(0, 0, totalW, headerH); m_headerBar->setGeometry(0, 0, mainW, headerH);
m_gameWorldView->setGeometry(0, headerH, totalW, gameH); m_gameWorldView->setGeometry(0, headerH, mainW, totalH - headerH);
m_bottomPanel->setGeometry(0, headerH + gameH, totalW, panelH); m_sidePanel->setGeometry(mainW, 0, sideW, totalH);
} }
void MainWindow::handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event) void MainWindow::handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event)

View File

@@ -59,7 +59,7 @@ private:
SelectedBuildingPanel* m_selectedBuildingPanel; SelectedBuildingPanel* m_selectedBuildingPanel;
BuildButtonGrid* m_buildButtonGrid; BuildButtonGrid* m_buildButtonGrid;
BlueprintPanel* m_blueprintPanel; BlueprintPanel* m_blueprintPanel;
QWidget* m_bottomPanel; QWidget* m_sidePanel;
std::vector<ShipLayoutBlueprint> m_layoutBlueprints; std::vector<ShipLayoutBlueprint> m_layoutBlueprints;
}; };