Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FloorItem Class Referencefinal

An item lying on the floor. More...

#include <flooritem.h>

Inheritance diagram for FloorItem:
ActorSprite Actor

Public Member Functions

 FloorItem (int id, int itemId, const Vector &position, Map *map)
 Constructor.
 
Type getType () const override
 Returns the type of the ActorSprite.
 
bool draw (Graphics *graphics, int offsetX, int offsetY) const override
 Draws the Actor to the given graphics context.
 
int getItemId () const
 Returns the item ID.
 
const ItemInfogetInfo () const
 Returns the item info for this floor item.
 
int getTileX () const override
 Returns the x coordinate in tiles of the actor.
 
int getTileY () const override
 Returns the y coordinate in tiles of the actor.
 
- Public Member Functions inherited from ActorSprite
 ActorSprite (int id)
 
 ~ActorSprite () override
 
int getId () const
 
void setId (int id)
 
int getDrawOrder () const override
 Returns the pixel Y coordinate that the actor should be drawn at.
 
bool drawSpriteAt (Graphics *graphics, int x, int y) const
 
virtual void logic ()
 
void setMap (Map *map) override
 
virtual Map::BlockType getBlockType () const
 Gets the way the object blocks pathfinding for other objects.
 
void controlParticle (Particle *particle)
 Take control of a particle.
 
virtual TargetCursorSize getTargetCursorSize () const
 Returns the required size of a target cursor for this being.
 
void setTargetType (TargetCursorType type)
 Sets the target animation for this actor.
 
void untarget ()
 Untargets the actor.
 
void setAlpha (float alpha) override
 Sets the alpha value used to draw the actor.
 
float getAlpha () const override
 Returns the current alpha value used to draw the actor.
 
int getWidth () const
 
int getHeight () const
 
- Public Member Functions inherited from Actor
 Actor ()
 
virtual ~Actor ()
 
const VectorgetPosition () const
 Returns the pixel position of this actor.
 
virtual void setPosition (const Vector &pos)
 Sets the pixel position of this actor.
 
int getPixelX () const
 Returns the pixels X coordinate of the actor.
 
int getPixelY () const
 Returns the pixel Y coordinate of the actor.
 
virtual bool drawnWhenBehind () const
 Determines wether the actor should be drawn translucent when behind another object.
 
MapgetMap () const
 

Private Attributes

int mItemId
 
int mX
 
int mY
 
ResourceRef< ImagemImage
 

Additional Inherited Members

- Public Types inherited from ActorSprite
enum  Type {
  UNKNOWN , PLAYER , NPC , MONSTER ,
  FLOOR_ITEM , PORTAL
}
 
enum  TargetCursorSize { TC_SMALL = 0 , TC_MEDIUM , TC_LARGE , NUM_TC }
 
enum  TargetCursorType { TCT_NONE = -1 , TCT_NORMAL = 0 , TCT_IN_RANGE , NUM_TCT }
 
- Static Public Member Functions inherited from ActorSprite
static void load ()
 
static void unload ()
 
- Protected Member Functions inherited from ActorSprite
void setupSpriteDisplay (const SpriteDisplay &display, bool forceDisplay=true)
 
- Protected Attributes inherited from ActorSprite
int mId
 
std::vector< ParticleHandlemChildParticleEffects
 
CompoundSprite mSprites
 
- Protected Attributes inherited from Actor
MapmMap = nullptr
 
Vector mPos
 Position in pixels relative to map.
 

Detailed Description

An item lying on the floor.

Definition at line 31 of file flooritem.h.

Constructor & Destructor Documentation

◆ FloorItem()

FloorItem::FloorItem ( int  id,
int  itemId,
const Vector position,
Map map 
)

Constructor.

Parameters
idthe unique ID of this item instance
itemIdthe item ID
positionthe position in pixels
mapthe map this item is on

Definition at line 32 of file flooritem.cpp.

Member Function Documentation

◆ draw()

bool FloorItem::draw ( Graphics graphics,
int  offsetX,
int  offsetY 
) const
overridevirtual

Draws the Actor to the given graphics context.

Note: this function could be simplified if the graphics context would support setting a translation offset. It already does this partly with the clipping rectangle support.

Reimplemented from ActorSprite.

Definition at line 63 of file flooritem.cpp.

◆ getInfo()

const ItemInfo & FloorItem::getInfo ( ) const

Returns the item info for this floor item.

Useful for adding an item link for the floor item to chat.

Definition at line 76 of file flooritem.cpp.

◆ getItemId()

int FloorItem::getItemId ( ) const
inline

Returns the item ID.

Definition at line 54 of file flooritem.h.

◆ getTileX()

int FloorItem::getTileX ( ) const
inlineoverridevirtual

Returns the x coordinate in tiles of the actor.

Reimplemented from Actor.

Definition at line 62 of file flooritem.h.

◆ getTileY()

int FloorItem::getTileY ( ) const
inlineoverridevirtual

Returns the y coordinate in tiles of the actor.

Reimplemented from Actor.

Definition at line 63 of file flooritem.h.

◆ getType()

Type FloorItem::getType ( ) const
inlineoverridevirtual

Returns the type of the ActorSprite.

Reimplemented from ActorSprite.

Definition at line 47 of file flooritem.h.

Member Data Documentation

◆ mImage

ResourceRef<Image> FloorItem::mImage
private

Definition at line 68 of file flooritem.h.

◆ mItemId

int FloorItem::mItemId
private

Definition at line 66 of file flooritem.h.

◆ mX

int FloorItem::mX
private

Definition at line 67 of file flooritem.h.

◆ mY

int FloorItem::mY
private

Definition at line 67 of file flooritem.h.


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