diff --git a/demo/demo/hexboard/board.cpp b/demo/demo/hexboard/board.cpp index 4e39ba921345d88a8ff89879c900fe635f7dabea..fafd6fda6d061b4e92b9ad462a0b5832b786a6ab 100644 --- a/demo/demo/hexboard/board.cpp +++ b/demo/demo/hexboard/board.cpp @@ -19,31 +19,34 @@ #include "hexboard/scene.hpp" namespace demo::hexboard { + constexpr float SCROLL_SPEED = 0.01F; + constexpr float HEX_SIZE = 64.0F; + constexpr std::array<fggl::grid::IntHex, 4> ISLAND_CENTERS {{ + {2, 3}, + {6, 7}, + {9, 10}, + {6, 3} + }}; + Scene::Scene(fggl::App &app) : GameBase(app), m_board(nullptr), m_screen(1920.F, 1080.F) { } void Scene::activate() { m_board = std::make_unique<fggl::grid::HexGrid>(); - m_layout = std::make_unique<fggl::grid::Layout>( fggl::grid::Orientation::make_pointy(), 64.0F ); + m_layout = std::make_unique<fggl::grid::Layout>( fggl::grid::Orientation::make_pointy(), HEX_SIZE ); //m_layout->m_origin = { 1920.0F * -0.5F, 1080.0F * -0.5F}; m_selections = std::make_unique<SelectionModel>(); - fggl::grid::TerrainType grass{ + const fggl::grid::TerrainType grass{ .data = std::make_shared<fggl::grid::MaterialData>() }; grass.data->name = "grass"; grass.data->colour = {0.0F, 1.0F, 0.0}; - std::array<fggl::grid::IntHex, 4> islands {{ - {3, 3}, - {7, 7}, - {10, 10}, - {7, 3} - }}; - for (auto islandPoint : islands){ + for (auto islandPoint : ISLAND_CENTERS){ auto island = islandPoint.hexesInRange(2); for (auto &hex : island) { m_board->setTerrain(hex, grass); @@ -88,7 +91,7 @@ namespace demo::hexboard { } auto offset = screenPos - m_dragging.value(); - m_camera->teleportBy(offset * 0.01F); + m_camera->teleportBy(offset * SCROLL_SPEED); } else if ( input.mouse.released(fggl::input::MouseButton::RIGHT) ) { m_dragging = {}; }