split the selection panel into one card per kind of selection
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "SelectionPanel.h"
|
||||
#include "ShipLayoutBlueprintSerializer.h"
|
||||
#include "ShipLayoutDialog.h"
|
||||
#include "BuildingIconCache.h"
|
||||
#include "ItemIconCache.h"
|
||||
#include "ModalPauseScope.h"
|
||||
#include "Simulation.h"
|
||||
@@ -48,31 +49,28 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir,
|
||||
setWindowTitle(tr("Dota Factory"));
|
||||
resize(1280, 768);
|
||||
|
||||
// Item icons live alongside the config (a sibling of the config dir), read from
|
||||
// disk at runtime like the building icons and visuals.toml (REQ-UI-ITEM-ICON).
|
||||
const std::string itemsIconDir = QDir::cleanPath(
|
||||
QString::fromStdString(m_configDir) + "/../icons/items").toStdString();
|
||||
|
||||
// Item and building icons live alongside the config (siblings of the config dir),
|
||||
// read from disk at runtime the same way visuals.toml is (REQ-UI-ITEM-ICON,
|
||||
// REQ-UI-BUILD-ICON).
|
||||
const QString configDirPath = QString::fromStdString(m_configDir);
|
||||
m_itemIcons = std::make_unique<ItemIconCache>(
|
||||
QString::fromStdString(itemsIconDir));
|
||||
QDir::cleanPath(configDirPath + "/../icons/items"));
|
||||
m_buildingIcons = std::make_unique<BuildingIconCache>(
|
||||
QDir::cleanPath(configDirPath + "/../icons/buildings"));
|
||||
|
||||
m_headerBar = new HeaderBar(sim, &sim->getConfig(), m_itemIcons.get(), this);
|
||||
|
||||
m_gameWorldView = new GameWorldView(sim, &sim->getConfig(), &m_visuals, m_configDir,
|
||||
m_itemIcons.get(), m_replay.get(), this);
|
||||
|
||||
// Building icons live alongside the config (a sibling of the config dir), read
|
||||
// from disk at runtime the same way visuals.toml is.
|
||||
const std::string iconDir = QDir::cleanPath(
|
||||
QString::fromStdString(m_configDir) + "/../icons/buildings").toStdString();
|
||||
|
||||
// Floats over the game world at its bottom center, sized to its buttons
|
||||
// (REQ-UI-BUILD-BAR). Creation order is the stacking order for siblings, so
|
||||
// building it after the world view puts it above the world and its vignettes,
|
||||
// and before the dim overlay keeps modals dimming it too (REQ-UI-MODAL-DIM).
|
||||
// Its geometry comes from layoutPanels().
|
||||
m_buildButtonBar = new BuildButtonBar(sim, &sim->getConfig(), iconDir,
|
||||
m_itemIcons.get(), this);
|
||||
m_buildButtonBar = new BuildButtonBar(sim, &sim->getConfig(),
|
||||
m_buildingIcons.get(), m_itemIcons.get(),
|
||||
this);
|
||||
|
||||
// The blueprints have no widget of their own: they are saved with Ctrl+C and picked
|
||||
// from a modal dialog (REQ-UI-BLUEPRINT-DIALOG), both driven from this window
|
||||
@@ -85,7 +83,9 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir,
|
||||
// the build button bar it is a sibling of the world view built after it, which is
|
||||
// what puts it above the world and its vignettes and below the dim overlay. It
|
||||
// brings its own chrome; its geometry comes from layoutPanels().
|
||||
m_selectionPanel = new SelectionPanel(sim, &sim->getConfig(), this);
|
||||
m_selectionPanel = new SelectionPanel(sim, &sim->getConfig(), &m_visuals,
|
||||
m_itemIcons.get(), m_buildingIcons.get(),
|
||||
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).
|
||||
|
||||
Reference in New Issue
Block a user