Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IGUISpriteBank.hpp
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in duckcpp/duckcpp.hpp
4
5#ifndef DCPP_I_GUI_SPRITE_BANK_HPP_INCLUDED
6#define DCPP_I_GUI_SPRITE_BANK_HPP_INCLUDED
7
8#include <duckcpp/core/engine/IReferenceCounted.hpp>
9#include <duckcpp/core/engine/irrArray.hpp>
10#include <duckcpp/core/engine/SColor.hpp>
11#include <duckcpp/core/engine/rect.hpp>
12
13namespace dcpp
14{
15
16namespace video
17{
18 class ITexture;
19} // end namespace video
20
21namespace gui
22{
23
25// Note for implementer: Can't fix variable names to uppercase as this is a public interface used since a while
27{
28public:
30 {
31 }
32
33public:
34 SGUISpriteFrame(dcpp::uint32_kt textureIndex, dcpp::uint32_kt positionIndex)
35 : textureNumber(textureIndex), rectNumber(positionIndex)
36 {
37 }
38
39public:
42
45};
46
48// Note for implementer: Can't fix variable names to uppercase as this is a public interface used since a while
50{
51public:
52 SGUISprite() : frameTime(0) {}
53
54public:
55 SGUISprite(const SGUISpriteFrame& firstFrame) : frameTime(0)
56 {
57 Frames.push_back(firstFrame);
58 }
59
60public:
62 dcpp::uint32_kt frameTime;
63};
64
65
67
70class IGUISpriteBank : public virtual IReferenceCounted
71{
72public:
73
76
79
81 virtual dcpp::uint32_kt getTextureCount() const = 0;
82
85
87 virtual void addTexture(dcpp::video::ITexture* texture) = 0;
88
90 virtual void setTexture(dcpp::uint32_kt index, dcpp::video::ITexture* texture) = 0;
91
93
96
98 virtual void clear() = 0;
99
101
114 const dcpp::nub::recti* clip=0,
115 const dcpp::video::SColor& color= dcpp::video::SColor(255,255,255,255),
116 dcpp::uint32_kt starttime=0, dcpp::uint32_kt currenttime=0,
117 bool loop=true, bool center=false) = 0;
118
120
130 virtual void draw2DSprite(dcpp::uint32_kt index, const dcpp::nub::recti& destRect,
131 const dcpp::nub::recti* clip=0,
132 const dcpp::video::SColor * const colors=0,
133 dcpp::uint32_kt timeTicks = 0,
134 bool loop=true) = 0;
135
138 const dcpp::nub::recti* clip=0,
139 const dcpp::video::SColor& color= dcpp::video::SColor(255,255,255,255),
140 dcpp::uint32_kt starttime=0, dcpp::uint32_kt currenttime=0,
141 bool loop=true, bool center=false) = 0;
142};
143
144
145} // end namespace gui
146} // end namespace dcpp
147
148#endif // DCPP_I_GUI_SPRITE_BANK_HPP_INCLUDED
Base class of most objects of the Duckcpp Engine.
Definition IReferenceCounted.hpp:46
Sprite bank interface.
Definition IGUISpriteBank.hpp:71
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 clear()=0
Clears sprites, rectangles and textures.
virtual dcpp::video::ITexture * getTexture(dcpp::uint32_kt index) const =0
Gets the texture with the specified index.
virtual void setTexture(dcpp::uint32_kt index, dcpp::video::ITexture *texture)=0
Changes one of the textures in the sprite bank.
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.
virtual void addTexture(dcpp::video::ITexture *texture)=0
Adds a texture to 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 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 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.
A single sprite frame.
Definition IGUISpriteBank.hpp:27
dcpp::uint32_kt textureNumber
Texture index in IGUISpriteBank.
Definition IGUISpriteBank.hpp:41
dcpp::uint32_kt rectNumber
Index in IGUISpriteBank::getPositions()
Definition IGUISpriteBank.hpp:44
A sprite composed of several frames.
Definition IGUISpriteBank.hpp:50
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
Rectangle template.
Definition rect.hpp:27
Interface of a Video Driver dependent Texture.
Definition ITexture.hpp:186
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
As of Duckcpp 1.6, position2d is a synonym for vector2d.
Definition shared_device.hpp:34
unsigned int uint32_kt
32 bit unsigned variable.
Definition irrTypes.hpp:64
signed int int32_kt
32 bit signed variable.
Definition irrTypes.hpp:72

Duckcpp    @cppfx.xyz