1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_GUI_SPRITE_BANK_H_INCLUDED__
\r
6 #define __C_GUI_SPRITE_BANK_H_INCLUDED__
\r
8 #include "IGUISpriteBank.h"
\r
22 class IGUIEnvironment;
\r
24 //! Sprite bank interface.
\r
25 class CGUISpriteBank : public IGUISpriteBank
\r
29 CGUISpriteBank(IGUIEnvironment* env);
\r
30 virtual ~CGUISpriteBank();
\r
32 core::array< core::rect<s32> >& getPositions() override;
\r
33 core::array< SGUISprite >& getSprites() override;
\r
35 u32 getTextureCount() const override;
\r
36 video::ITexture* getTexture(u32 index) const override;
\r
37 void addTexture(video::ITexture* texture) override;
\r
38 void setTexture(u32 index, video::ITexture* texture) override;
\r
40 //! Add the texture and use it for a single non-animated sprite.
\r
41 s32 addTextureAsSprite(video::ITexture* texture) override;
\r
43 //! clears sprites, rectangles and textures
\r
44 void clear() override;
\r
46 //! Draws a sprite in 2d with position and color
\r
47 virtual void draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip=0,
\r
48 const video::SColor& color= video::SColor(255,255,255,255),
\r
49 u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false) override;
\r
51 //! Draws a sprite in 2d with destination rectangle and colors
\r
52 virtual void draw2DSprite(u32 index, const core::rect<s32>& destRect,
\r
53 const core::rect<s32>* clip=0,
\r
54 const video::SColor * const colors=0,
\r
56 bool loop=true) override;
\r
58 //! Draws a sprite batch in 2d using an array of positions and a color
\r
59 virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<core::position2di>& pos,
\r
60 const core::rect<s32>* clip=0,
\r
61 const video::SColor& color= video::SColor(255,255,255,255),
\r
62 u32 starttime=0, u32 currenttime=0,
\r
63 bool loop=true, bool center=false) override;
\r
67 bool getFrameNr(u32& frameNr, u32 index, u32 time, bool loop) const;
\r
71 core::array<core::position2di> positions;
\r
72 core::array<core::recti> sourceRects;
\r
76 core::array<SGUISprite> Sprites;
\r
77 core::array< core::rect<s32> > Rectangles;
\r
78 core::array<video::ITexture*> Textures;
\r
79 IGUIEnvironment* Environment;
\r
80 video::IVideoDriver* Driver;
\r
84 } // end namespace gui
\r
85 } // end namespace irr
\r
87 #endif // __C_GUI_SPRITE_BANK_H_INCLUDED__
\r