Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
dcpp::gui::IGUISpriteBank Class Referenceabstract

Sprite bank interface. More...

#include <duckcpp/core/engine/IGUISpriteBank.hpp>

Inheritance diagram for dcpp::gui::IGUISpriteBank:
Inheritance graph
Collaboration diagram for dcpp::gui::IGUISpriteBank:
Collaboration graph

Public Member Functions

virtual dcpp::nub::array< dcpp::nub::recti > & getPositions ()=0
 Returns the list of rectangles held by the sprite bank.
 
virtual dcpp::nub::array< SGUISprite > & getSprites ()=0
 Returns the array of animated sprites within the sprite bank.
 
virtual dcpp::uint32_kt getTextureCount () const =0
 Returns the number of textures held by the sprite bank.
 
virtual dcpp::video::ITexturegetTexture (dcpp::uint32_kt index) const =0
 Gets the texture with the specified index.
 
virtual void addTexture (dcpp::video::ITexture *texture)=0
 Adds a texture to the sprite bank.
 
virtual void setTexture (dcpp::uint32_kt index, dcpp::video::ITexture *texture)=0
 Changes one of the textures in the sprite bank.
 
virtual dcpp::int32_kt addTextureAsSprite (dcpp::video::ITexture *texture)=0
 Add the texture and use it for a single non-animated sprite.
 
virtual void clear ()=0
 Clears sprites, rectangles and textures.
 
virtual void draw2DSprite (dcpp::uint32_kt index, const dcpp::nub::position2di &pos, const dcpp::nub::recti *clip=0, const dcpp::video::SColor &color=dcpp::video::SColor(255, 255, 255, 255), dcpp::uint32_kt starttime=0, dcpp::uint32_kt currenttime=0, bool loop=true, bool center=false)=0
 Draws a sprite in 2d with position and color.
 
virtual void draw2DSprite (dcpp::uint32_kt index, const dcpp::nub::recti &destRect, const dcpp::nub::recti *clip=0, const dcpp::video::SColor *const colors=0, dcpp::uint32_kt timeTicks=0, bool loop=true)=0
 Draws a sprite in 2d with destination rectangle and colors.
 
virtual void draw2DSpriteBatch (const dcpp::nub::array< dcpp::uint32_kt > &indices, const dcpp::nub::array< dcpp::nub::position2di > &pos, const dcpp::nub::recti *clip=0, const dcpp::video::SColor &color=dcpp::video::SColor(255, 255, 255, 255), dcpp::uint32_kt starttime=0, dcpp::uint32_kt currenttime=0, bool loop=true, bool center=false)=0
 Draws a sprite batch in 2d using an array of positions and a color.
 
- Public Member Functions inherited from dcpp::IReferenceCounted
 IReferenceCounted ()
 Constructor.
 
virtual ~IReferenceCounted ()
 Destructor.
 
void grab () const
 Grabs the object. Increments the reference counter by one.
 
bool drop () const
 Drops the object. Decrements the reference counter by one.
 
dcpp::int32_kt getReferenceCount () const
 Get the reference count.
 
const dcpp::char_ktgetDebugName () const
 Returns the debug name of the object.
 

Additional Inherited Members

- Protected Member Functions inherited from dcpp::IReferenceCounted
void setDebugName (const dcpp::char_kt *newName)
 Sets the debug name of the object.
 

Detailed Description

Sprite bank interface.

See http://irrlicht.sourceforge.net/forum//viewtopic.php?f=9&t=25742 for more information how to use the spritebank.

Member Function Documentation

◆ addTextureAsSprite()

virtual dcpp::int32_kt dcpp::gui::IGUISpriteBank::addTextureAsSprite ( dcpp::video::ITexture texture)
pure virtual

Add the texture and use it for a single non-animated sprite.

The texture and the corresponding rectangle and sprite will all be added to the end of each array.

Returns
The index of the sprite or -1 on failure

◆ draw2DSprite() [1/2]

virtual void dcpp::gui::IGUISpriteBank::draw2DSprite ( dcpp::uint32_kt  index,
const dcpp::nub::position2di pos,
const dcpp::nub::recti clip = 0,
const dcpp::video::SColor color = dcpp::video::SColor(255, 255, 255, 255),
dcpp::uint32_kt  starttime = 0,
dcpp::uint32_kt  currenttime = 0,
bool  loop = true,
bool  center = false 
)
pure virtual

Draws a sprite in 2d with position and color.

Parameters
indexIndex of SGUISprite to draw
posTarget position - depending on center value either the left-top or the sprite center is used as pivot
clipClipping rectangle, can be 0 when clipping is not wanted.
colorColor with which the image is drawn. Note that the alpha component is used. If alpha is other than 255, the image will be transparent.
starttimeTick when the first frame was drawn (only difference currenttime-starttime matters).
currenttimeTo calculate the frame of animated sprites
loopWhen true animations are looped
centerWhen true pivot is set to the sprite-center. So it affects pos.

◆ draw2DSprite() [2/2]

virtual void dcpp::gui::IGUISpriteBank::draw2DSprite ( dcpp::uint32_kt  index,
const dcpp::nub::recti destRect,
const dcpp::nub::recti clip = 0,
const dcpp::video::SColor *const  colors = 0,
dcpp::uint32_kt  timeTicks = 0,
bool  loop = true 
)
pure virtual

Draws a sprite in 2d with destination rectangle and colors.

Parameters
indexIndex of SGUISprite to draw
destRectThe sprite will be scaled to fit this target rectangle
clipClipping rectangle, can be 0 when clipping is not wanted.
colorsArray of 4 colors denoting the color values of the corners of the destRect
timeTicksCurrent frame for animated sprites (same as currenttime-starttime in other draw2DSprite function)
loopWhen true animations are looped

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

Duckcpp    @cppfx.xyz