1 #ifndef GAME_MENUS_BAGITEMBUTTON_HPP
2 #define GAME_MENUS_BAGITEMBUTTON_HPP
4 #include <BLIB/Interfaces/Menu.hpp>
26 using Ptr = std::shared_ptr<BagItemButton>;
49 virtual glm::vec2
getSize()
const override;
63 virtual void doCreate(bl::engine::Engine& engine)
override;
70 virtual void doSceneAdd(bl::rc::Scene* overlay)
override;
80 virtual bl::ecs::Entity
getEntity()
const override;
87 virtual void draw(bl::rc::scene::CodeScene::RenderContext& ctx)
override;
91 bl::rc::res::TextureRef txtr;
92 bl::gfx::Sprite background;
Parent namespace for all functionality unique to the game.
Simple struct representing a set of items in the bag.
Represents a button for a quantity of items in the bag.
void update(const core::player::Bag::Item &item)
Updates the text labels from the given item.
const core::player::Bag::Item & getItem() const
Returns the item this button is representing.
virtual void doCreate(bl::engine::Engine &engine) override
Called at least once when the item is added to a menu. Should create required graphics primitives and...
virtual void draw(bl::rc::scene::CodeScene::RenderContext &ctx) override
Renders the item.
std::shared_ptr< BagItemButton > Ptr
Pointer to the menu item.
static Ptr create(const core::player::Bag::Item &item)
Creates a new item button.
virtual glm::vec2 getSize() const override
Returns the size the button takes up.
virtual void doSceneRemove() override
Called when the item should be removed from the overlay.
virtual ~BagItemButton()=default
Destroy the Bag Item Button object.
virtual bl::ecs::Entity getEntity() const override
Returns the entity (or top level entity) of the item.
virtual void doSceneAdd(bl::rc::Scene *overlay) override
Called when the item should be added to the overlay.