GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
Item Struct Reference

A generic interface for all items that can appear in the shop or be in the inventory. This uses first member struct inheritance - other structs are meant to inherit it by making their first member field Item. Then casts from inheriting structs to Item* are allowed and intentional and this allows for generic code that uses polymorphism. The -fms-extensions compile flag allows for anonymous members making it behave fully as inheritance. It makes all member fields be fully inherited so any struct that inherits Item for example will have all its fields accessible directly, e.g. JokerObject joker_object; joker_object.type = ITEM_TYPE_JOKER More...

#include <item.h>

Data Fields

 SpriteObject
 First member struct inheritance all items that can appear in the shop are SpriteObjects. Note that this is an anonymous member.
 
enum ItemType type
 The item type - used to dispatch the function implementations for inheriting types.
 
bool is_owned
 Whether the item is currently held - used in cases where a behaviour needs to be different for Items still in the Shop and the ones we have bought.
 

Detailed Description

A generic interface for all items that can appear in the shop or be in the inventory. This uses first member struct inheritance - other structs are meant to inherit it by making their first member field Item. Then casts from inheriting structs to Item* are allowed and intentional and this allows for generic code that uses polymorphism. The -fms-extensions compile flag allows for anonymous members making it behave fully as inheritance. It makes all member fields be fully inherited so any struct that inherits Item for example will have all its fields accessible directly, e.g. JokerObject joker_object; joker_object.type = ITEM_TYPE_JOKER

Definition at line 82 of file item.h.

Field Documentation

◆ is_owned

bool is_owned

Whether the item is currently held - used in cases where a behaviour needs to be different for Items still in the Shop and the ones we have bought.

Definition at line 100 of file item.h.

◆ SpriteObject

First member struct inheritance all items that can appear in the shop are SpriteObjects. Note that this is an anonymous member.

Definition at line 89 of file item.h.

◆ type

enum ItemType type

The item type - used to dispatch the function implementations for inheriting types.

Definition at line 94 of file item.h.


The documentation for this struct was generated from the following file: