Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
game::menu::BagItemButton Class Reference

Represents a button for a quantity of items in the bag. More...

#include <BagItemButton.hpp>

+ Inheritance diagram for game::menu::BagItemButton:

Public Types

using Ptr = std::shared_ptr< BagItemButton >
 Pointer to the menu item. More...
 

Public Member Functions

virtual ~BagItemButton ()=default
 Destroy the Bag Item Button object. More...
 
void update (const core::player::Bag::Item &item)
 Updates the text labels from the given item. More...
 
virtual glm::vec2 getSize () const override
 Returns the size the button takes up. More...
 
const core::player::Bag::ItemgetItem () const
 Returns the item this button is representing. More...
 

Static Public Member Functions

static Ptr create (const core::player::Bag::Item &item)
 Creates a new item button. More...
 

Protected Member Functions

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 return the transform to use. More...
 
virtual void doSceneAdd (bl::rc::Scene *overlay) override
 Called when the item should be added to the overlay. More...
 
virtual void doSceneRemove () override
 Called when the item should be removed from the overlay. More...
 
virtual bl::ecs::Entity getEntity () const override
 Returns the entity (or top level entity) of the item. More...
 
virtual void draw (bl::rc::scene::CodeScene::RenderContext &ctx) override
 Renders the item. More...
 

Detailed Description

Represents a button for a quantity of items in the bag.

Definition at line 23 of file BagItemButton.hpp.

Member Typedef Documentation

◆ Ptr

Pointer to the menu item.

Definition at line 26 of file BagItemButton.hpp.

Constructor & Destructor Documentation

◆ ~BagItemButton()

virtual game::menu::BagItemButton::~BagItemButton ( )
virtualdefault

Destroy the Bag Item Button object.

Member Function Documentation

◆ create()

BagItemButton::Ptr game::menu::BagItemButton::create ( const core::player::Bag::Item item)
static

Creates a new item button.

Parameters
itemThe item to populate with
Returns
Ptr The created item

Definition at line 11 of file BagItemButton.cpp.

◆ doCreate()

void game::menu::BagItemButton::doCreate ( bl::engine::Engine &  engine)
overrideprotectedvirtual

Called at least once when the item is added to a menu. Should create required graphics primitives and return the transform to use.

Parameters
engineThe game engine instance

Definition at line 54 of file BagItemButton.cpp.

◆ doSceneAdd()

void game::menu::BagItemButton::doSceneAdd ( bl::rc::Scene *  overlay)
overrideprotectedvirtual

Called when the item should be added to the overlay.

Parameters
overlayThe overlay to add to

Definition at line 70 of file BagItemButton.cpp.

◆ doSceneRemove()

void game::menu::BagItemButton::doSceneRemove ( )
overrideprotectedvirtual

Called when the item should be removed from the overlay.

Definition at line 76 of file BagItemButton.cpp.

◆ draw()

void game::menu::BagItemButton::draw ( bl::rc::scene::CodeScene::RenderContext &  ctx)
overrideprotectedvirtual

Renders the item.

Parameters
ctxThe render context

Definition at line 89 of file BagItemButton.cpp.

◆ getEntity()

bl::ecs::Entity game::menu::BagItemButton::getEntity ( ) const
overrideprotectedvirtual

Returns the entity (or top level entity) of the item.

Definition at line 78 of file BagItemButton.cpp.

◆ getItem()

const core::player::Bag::Item & game::menu::BagItemButton::getItem ( ) const

Returns the item this button is representing.

Definition at line 52 of file BagItemButton.cpp.

◆ getSize()

glm::vec2 game::menu::BagItemButton::getSize ( ) const
overridevirtual

Returns the size the button takes up.

Definition at line 80 of file BagItemButton.cpp.

◆ update()

void game::menu::BagItemButton::update ( const core::player::Bag::Item item)

Updates the text labels from the given item.

Definition at line 21 of file BagItemButton.cpp.


The documentation for this class was generated from the following files: