1 #ifndef GAME_MENUS_STOREITEMROW_HPP
2 #define GAME_MENUS_STOREITEMROW_HPP
4 #include <BLIB/Graphics/Dummy2D.hpp>
5 #include <BLIB/Interfaces/Menu.hpp>
21 using Ptr = std::shared_ptr<StoreItemRow>;
24 static constexpr
float Height = 18.f;
62 virtual glm::vec2
getSize()
const override;
77 virtual void doCreate(bl::engine::Engine& engine)
override;
84 virtual void doSceneAdd(bl::rc::Scene* overlay)
override;
94 virtual bl::ecs::Entity
getEntity()
const override;
101 virtual void draw(bl::rc::scene::CodeScene::RenderContext& ctx)
override;
107 bl::gfx::Dummy2D dummy;
108 bl::gfx::Text qtyText;
109 bl::gfx::Text nameText;
110 bl::gfx::Text priceText;
Id
Represents an item in its simplist form.
Parent namespace for all functionality unique to the game.
Menu item for an item in the store. Does both sellable and for-sale items.
virtual void draw(bl::rc::scene::CodeScene::RenderContext &ctx) override
Renders the item.
void updateQty(int qty)
Updates the text for how many items can be sold.
core::item::Id getItem() const
Returns the item that this row represents.
static Ptr create(int qty, core::item::Id item, int price)
Creates a new menu item in sell mode.
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...
std::shared_ptr< StoreItemRow > Ptr
Pointer to the menu item.
static constexpr float Height
Height of a single item in pixels.
virtual void doSceneRemove() override
Called when the item should be removed from the overlay.
virtual void doSceneAdd(bl::rc::Scene *overlay) override
Called when the item should be added to the overlay.
virtual ~StoreItemRow()=default
Destroy the Store Item Row object.
virtual glm::vec2 getSize() const override
Returns the size that the row takes up.
virtual bl::ecs::Entity getEntity() const override
Returns the entity (or top level entity) of the item.