ManaPlus
Public Member Functions | Protected Member Functions | Protected Attributes
Sprite Class Referenceabstract

#include <sprite.h>

Inheritance diagram for Sprite:
AnimatedSprite CompoundSprite ImageSprite ActorSprite Being FloorItem LocalPlayer

Public Member Functions

virtual ~Sprite ()
 
virtual bool reset ()=0
 
virtual bool play (const std::string &action)=0
 
virtual bool update (const int time)=0
 
virtual void draw (Graphics *const graphics, const int posX, const int posY) const =0
 
virtual int getWidth () const =0
 
virtual int getHeight () const =0
 
virtual const ImagegetImage () const =0
 
virtual bool setSpriteDirection (const SpriteDirection::Type direction)=0
 
virtual void setAlpha (float alpha)
 
virtual float getAlpha () const
 
virtual unsigned int getCurrentFrame () const =0
 
virtual unsigned int getFrameCount () const =0
 
virtual const void * getHash () const
 
virtual const void * getHash2 () const
 
virtual bool updateNumber (const unsigned num)=0
 

Protected Member Functions

 Sprite ()
 

Protected Attributes

float mAlpha
 

Detailed Description

Definition at line 32 of file sprite.h.

Constructor & Destructor Documentation

◆ ~Sprite()

virtual Sprite::~Sprite ( )
inlinevirtual

Definition at line 37 of file sprite.h.

38  { }

◆ Sprite()

Sprite::Sprite ( )
inlineprotected

Definition at line 124 of file sprite.h.

124  :
125  mAlpha()
126  {
127  }

Member Function Documentation

◆ draw()

virtual void Sprite::draw ( Graphics *const  graphics,
const int  posX,
const int  posY 
) const
pure virtual

Draw the current animation frame at the coordinates given in screen pixels.

Implemented in AnimatedSprite, ImageSprite, Being, and FloorItem.

◆ getAlpha()

virtual float Sprite::getAlpha ( ) const
inlinevirtual

Returns the current alpha opacity of the animated sprite.

Reimplemented in ActorSprite.

Definition at line 102 of file sprite.h.

103  { return mAlpha; }

References mAlpha.

Referenced by ActorSprite::getAlpha().

◆ getCurrentFrame()

virtual unsigned int Sprite::getCurrentFrame ( ) const
pure virtual

Returns the current frame number for the sprite.

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ getFrameCount()

virtual unsigned int Sprite::getFrameCount ( ) const
pure virtual

Returns the frame count for the sprite.

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ getHash()

virtual const void* Sprite::getHash ( ) const
inlinevirtual

Reimplemented in AnimatedSprite.

Definition at line 115 of file sprite.h.

116  { return nullptr; }

◆ getHash2()

virtual const void* Sprite::getHash2 ( ) const
inlinevirtual

Definition at line 118 of file sprite.h.

119  { return this; }

◆ getHeight()

virtual int Sprite::getHeight ( ) const
pure virtual

Gets the height in pixels of the image of the current frame

Implemented in Being, ActorSprite, AnimatedSprite, CompoundSprite, and ImageSprite.

Referenced by NpcDialog::logic(), and NpcDialog::showAvatar().

◆ getImage()

virtual const Image* Sprite::getImage ( ) const
pure virtual

Returns a reference to the current image being drawn.

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ getWidth()

virtual int Sprite::getWidth ( ) const
pure virtual

Gets the width in pixels of the image of the current frame

Implemented in Being, ActorSprite, AnimatedSprite, CompoundSprite, and ImageSprite.

Referenced by NpcDialog::logic(), and NpcDialog::showAvatar().

◆ play()

virtual bool Sprite::play ( const std::string &  action)
pure virtual

Plays an action using the current direction.

Returns
true if the sprite changed, false otherwise

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ reset()

virtual bool Sprite::reset ( )
pure virtual

Resets the sprite.

Returns
true if the sprite changed, false otherwise

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ setAlpha()

virtual void Sprite::setAlpha ( float  alpha)
inlinevirtual

Sets the alpha value of the animated sprite

Reimplemented in AnimatedSprite, CompoundSprite, and ActorSprite.

Definition at line 96 of file sprite.h.

97  { mAlpha = alpha; }

References mAlpha.

◆ setSpriteDirection()

virtual bool Sprite::setSpriteDirection ( const SpriteDirection::Type  direction)
pure virtual

Sets the direction.

Returns
true if the sprite changed, false otherwise

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ update()

virtual bool Sprite::update ( const int  time)
pure virtual

Inform the animation of the passed time so that it can output the correct animation frame.

Returns
true if the sprite changed, false otherwise

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

◆ updateNumber()

virtual bool Sprite::updateNumber ( const unsigned  num)
pure virtual

Implemented in AnimatedSprite, CompoundSprite, and ImageSprite.

Field Documentation

◆ mAlpha

float Sprite::mAlpha
protected

The documentation for this class was generated from the following file:
Sprite::mAlpha
float mAlpha
Definition: sprite.h:129