arsa  2.7
IGUISpriteBank.h
Go to the documentation of this file.
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 irrlicht.h
4 
5 #ifndef __I_GUI_SPRITE_BANK_H_INCLUDED__
6 #define __I_GUI_SPRITE_BANK_H_INCLUDED__
7 
8 #include "IReferenceCounted.h"
9 #include "irrArray.h"
10 #include "SColor.h"
11 #include "rect.h"
12 
13 namespace irr
14 {
15 
16 namespace video
17 {
18  class ITexture;
19 } // end namespace video
20 
21 namespace 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 {
29  {
30  }
31 
32  SGUISpriteFrame(u32 textureIndex, u32 positionIndex)
33  : textureNumber(textureIndex), rectNumber(positionIndex)
34  {
35  }
36 
39 
42 };
43 
45 // Note for implementer: Can't fix variable names to uppercase as this is a public interface used since a while
46 struct SGUISprite
47 {
49  SGUISprite(const SGUISpriteFrame& firstFrame) : frameTime(0)
50  {
51  Frames.push_back(firstFrame);
52  }
53 
56 };
57 
58 
60 
63 class IGUISpriteBank : public virtual IReferenceCounted
64 {
65 public:
66 
69 
72 
74  virtual u32 getTextureCount() const = 0;
75 
77  virtual video::ITexture* getTexture(u32 index) const = 0;
78 
80  virtual void addTexture(video::ITexture* texture) = 0;
81 
83  virtual void setTexture(u32 index, video::ITexture* texture) = 0;
84 
86 
89 
91  virtual void clear() = 0;
92 
94 
106  virtual void draw2DSprite(u32 index, const core::position2di& pos,
107  const core::rect<s32>* clip=0,
108  const video::SColor& color= video::SColor(255,255,255,255),
109  u32 starttime=0, u32 currenttime=0,
110  bool loop=true, bool center=false) = 0;
111 
113 
123  virtual void draw2DSprite(u32 index, const core::rect<s32>& destRect,
124  const core::rect<s32>* clip=0,
125  const video::SColor * const colors=0,
126  u32 timeTicks = 0,
127  bool loop=true) = 0;
128 
131  const core::rect<s32>* clip=0,
132  const video::SColor& color= video::SColor(255,255,255,255),
133  u32 starttime=0, u32 currenttime=0,
134  bool loop=true, bool center=false) = 0;
135 };
136 
137 
138 } // end namespace gui
139 } // end namespace irr
140 
141 #endif // __I_GUI_SPRITE_BANK_H_INCLUDED__
142 
virtual void setTexture(u32 index, video::ITexture *texture)=0
Changes one of the textures in the sprite bank.
u32 rectNumber
Index in IGUISpriteBank::getPositions()
Sprite bank interface.
u32 textureNumber
Texture index in IGUISpriteBank.
SGUISprite(const SGUISpriteFrame &firstFrame)
GLenum GLenum GLuint texture
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: SDL_opengl.h:1571
virtual core::array< SGUISprite > & getSprites()=0
Returns the array of animated sprites within the sprite bank.
virtual core::array< core::rect< s32 > > & getPositions()=0
Returns the list of rectangles held by the sprite bank.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
A sprite composed of several frames.
A single sprite frame.
virtual video::ITexture * getTexture(u32 index) const =0
Gets the texture with the specified index.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
virtual u32 getTextureCount() const =0
Returns the number of textures held by the sprite bank.
GLuint index
Class representing a 32 bit ARGB color.
Definition: SColor.h:316
virtual void draw2DSpriteBatch(const core::array< u32 > &indices, const core::array< core::position2di > &pos, const core::rect< s32 > *clip=0, const video::SColor &color=video::SColor(255, 255, 255, 255), u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false)=0
Draws a sprite batch in 2d using an array of positions and a color.
Self reallocating template array (like stl vector) with additional features.
Definition: irrArray.h:22
virtual s32 addTextureAsSprite(video::ITexture *texture)=0
Add the texture and use it for a single non-animated sprite.
2d vector template class with lots of operators and methods.
Definition: dimension2d.h:16
SGUISpriteFrame(u32 textureIndex, u32 positionIndex)
virtual void addTexture(video::ITexture *texture)=0
Adds a texture to the sprite bank.
GLuint color
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:177
Base class of most objects of the Irrlicht Engine.
virtual void draw2DSprite(u32 index, const core::position2di &pos, const core::rect< s32 > *clip=0, const video::SColor &color=video::SColor(255, 255, 255, 255), u32 starttime=0, u32 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.
core::array< SGUISpriteFrame > Frames