diff --git a/fggl/scenes/menu.cpp b/fggl/scenes/menu.cpp index a49729872836ac4480a47625cb8920e07b9a3e12..b7330a7d8d784ab77281feadcc38b3139757ea7b 100644 --- a/fggl/scenes/menu.cpp +++ b/fggl/scenes/menu.cpp @@ -61,24 +61,23 @@ namespace fggl::scenes { } - void BasicMenu::add(const std::string &name, callback cb) { - m_items[name] = cb; + void BasicMenu::add(const std::string &name, const Callback& callback) { + m_items[name] = callback; - const math::vec2 btnSize{150.0f, 30.0f}; + const math::vec2 btnSize{150.0F, 30.0F}; const float spacing = 5; - const float padX = 50.0f; - const float padY = 50.0f; + const float padX = 50.0F; + const float padY = 50.0F; // figure out the position based off the old logic // FIXME should be the container's job - math::vec2 pos{1920.0f - (padX + btnSize.x), padY}; - auto btnIdx = m_items.size() - 1; - pos.y += (btnIdx * (btnSize.y + spacing)); + math::vec2 pos{1920.0F - (padX + btnSize.x), padY}; + pos.y += ( (m_items.size()-1.0F) * (btnSize.y + spacing)); // build the button auto btn = std::make_unique<gui::Button>(pos, btnSize); btn->label(name); - btn->addCallback(cb); + btn->addCallback(callback); m_canvas.add(std::move(btn)); } diff --git a/include/fggl/data/assimp/module.hpp b/include/fggl/data/assimp/module.hpp index 0a4001d7005d0db0797846ae3920c6f460d6a93a..a10e11422f0a60af3e0a1359663cd74d7722f819 100644 --- a/include/fggl/data/assimp/module.hpp +++ b/include/fggl/data/assimp/module.hpp @@ -43,7 +43,7 @@ namespace fggl::data::models { // new style loaders (textures) bool load_tex_stb(const std::filesystem::path& filePath, assets::MemoryBlock& block); - static assets::AssetTypeID is_tex_stb(const std::filesystem::path& filePath); + assets::AssetTypeID is_tex_stb(const std::filesystem::path& filePath); // new style loaders (models) assets::AssetTypeID is_model_assimp(const std::filesystem::path& filePath); diff --git a/include/fggl/scenes/menu.hpp b/include/fggl/scenes/menu.hpp index 70c0b15e29d16a0e01087cfcd5d62907313dbb13..740d655a0edd11e8bf075850d7f1f34a5fa17828 100644 --- a/include/fggl/scenes/menu.hpp +++ b/include/fggl/scenes/menu.hpp @@ -26,7 +26,7 @@ namespace fggl::scenes { - using callback = std::function<void(void)>; + using Callback = std::function<void(void)>; class BasicMenu : public AppState { public: @@ -38,11 +38,11 @@ namespace fggl::scenes { void activate() override; void deactivate() override; - void add(const std::string &label, callback cb); + void add(const std::string &label, const Callback& /*cb*/); private: input::Input *m_inputs; - std::map<const std::string, callback> m_items; + std::map<const std::string, Callback> m_items; // menu state std::string m_active;