move ui panels to the right
This commit is contained in:
@@ -349,27 +349,30 @@ Modules in `modules.toml` define a `surface_mask` — a list of strings that des
|
||||
|
||||
### 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 |
|
||||
+--------------------------------------------------+
|
||||
| |
|
||||
| Game World (70%) |
|
||||
| |
|
||||
+-----------------+-----------------+--------------+
|
||||
| Selected | Build Button | Blueprint |
|
||||
| Building Panel | Grid | Panel |
|
||||
| (left) | (center) | (right) |
|
||||
+-----------------+-----------------+--------------+
|
||||
+--------------------------------------+--------------+
|
||||
| Header Bar | |
|
||||
+--------------------------------------+ Selected |
|
||||
| | Building |
|
||||
| | Panel |
|
||||
| +--------------+
|
||||
| Game World | Build |
|
||||
| | Button |
|
||||
| | Grid |
|
||||
| +--------------+
|
||||
| | 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-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-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-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-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
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
#include <QFile>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#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_bottomPanel = new QWidget(this);
|
||||
QHBoxLayout* bottomLayout = new QHBoxLayout(m_bottomPanel);
|
||||
bottomLayout->setContentsMargins(0, 0, 0, 0);
|
||||
bottomLayout->setSpacing(0);
|
||||
m_sidePanel = new QWidget(this);
|
||||
QVBoxLayout* sideLayout = new QVBoxLayout(m_sidePanel);
|
||||
sideLayout->setContentsMargins(0, 0, 0, 0);
|
||||
sideLayout->setSpacing(0);
|
||||
|
||||
m_selectedBuildingPanel = new SelectedBuildingPanel(sim, &sim->config(), m_bottomPanel);
|
||||
m_buildButtonGrid = new BuildButtonGrid(&sim->config(), m_bottomPanel);
|
||||
m_blueprintPanel = new BlueprintPanel(sim, &sim->config(), m_bottomPanel);
|
||||
m_selectedBuildingPanel = new SelectedBuildingPanel(sim, &sim->config(), m_sidePanel);
|
||||
m_buildButtonGrid = new BuildButtonGrid(&sim->config(), m_sidePanel);
|
||||
m_blueprintPanel = new BlueprintPanel(sim, &sim->config(), m_sidePanel);
|
||||
|
||||
bottomLayout->addWidget(m_selectedBuildingPanel, 1);
|
||||
bottomLayout->addWidget(m_buildButtonGrid, 1);
|
||||
bottomLayout->addWidget(m_blueprintPanel, 1);
|
||||
sideLayout->addWidget(m_selectedBuildingPanel, 1);
|
||||
sideLayout->addWidget(m_buildButtonGrid, 1);
|
||||
sideLayout->addWidget(m_blueprintPanel, 1);
|
||||
|
||||
m_gameWorldView->setFocus();
|
||||
|
||||
@@ -117,13 +116,12 @@ void MainWindow::layoutPanels()
|
||||
const int totalH = height();
|
||||
const int headerH = m_headerBar->sizeHint().height();
|
||||
if (headerH <= 0) { return; }
|
||||
const int remaining = totalH - headerH;
|
||||
const int gameH = remaining * 70 / 100;
|
||||
const int panelH = remaining - gameH;
|
||||
const int mainW = totalW * 75 / 100;
|
||||
const int sideW = totalW - mainW;
|
||||
|
||||
m_headerBar->setGeometry(0, 0, totalW, headerH);
|
||||
m_gameWorldView->setGeometry(0, headerH, totalW, gameH);
|
||||
m_bottomPanel->setGeometry(0, headerH + gameH, totalW, panelH);
|
||||
m_headerBar->setGeometry(0, 0, mainW, headerH);
|
||||
m_gameWorldView->setGeometry(0, headerH, mainW, totalH - headerH);
|
||||
m_sidePanel->setGeometry(mainW, 0, sideW, totalH);
|
||||
}
|
||||
|
||||
void MainWindow::handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event)
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
SelectedBuildingPanel* m_selectedBuildingPanel;
|
||||
BuildButtonGrid* m_buildButtonGrid;
|
||||
BlueprintPanel* m_blueprintPanel;
|
||||
QWidget* m_bottomPanel;
|
||||
QWidget* m_sidePanel;
|
||||
|
||||
std::vector<ShipLayoutBlueprint> m_layoutBlueprints;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user