Irrlicht 3D Engine
IGUISpriteBank.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_GUI_SPRITE_BANK_H_INCLUDED__
00006 #define __I_GUI_SPRITE_BANK_H_INCLUDED__
00007 
00008 #include "IReferenceCounted.h"
00009 #include "irrArray.h"
00010 #include "SColor.h"
00011 #include "rect.h"
00012 
00013 namespace irr
00014 {
00015 
00016 namespace video
00017 {
00018     class ITexture;
00019 } // end namespace video
00020 
00021 namespace gui
00022 {
00023 
00025 struct SGUISpriteFrame
00026 {
00027     u32 textureNumber;
00028     u32 rectNumber;
00029 };
00030 
00032 struct SGUISprite
00033 {
00034     SGUISprite() : Frames(), frameTime(0) {}
00035 
00036     core::array<SGUISpriteFrame> Frames;
00037     u32 frameTime;
00038 };
00039 
00040 
00042 
00045 class IGUISpriteBank : public virtual IReferenceCounted
00046 {
00047 public:
00048 
00050     virtual core::array< core::rect<s32> >& getPositions() = 0;
00051 
00053     virtual core::array< SGUISprite >& getSprites() = 0;
00054 
00056     virtual u32 getTextureCount() const = 0;
00057 
00059     virtual video::ITexture* getTexture(u32 index) const = 0;
00060 
00062     virtual void addTexture(video::ITexture* texture) = 0;
00063 
00065     virtual void setTexture(u32 index, video::ITexture* texture) = 0;
00066 
00070     virtual s32 addTextureAsSprite(video::ITexture* texture) = 0;
00071 
00073     virtual void clear() = 0;
00074 
00076     virtual void draw2DSprite(u32 index, const core::position2di& pos,
00077             const core::rect<s32>* clip=0,
00078             const video::SColor& color= video::SColor(255,255,255,255),
00079             u32 starttime=0, u32 currenttime=0,
00080             bool loop=true, bool center=false) = 0;
00081 
00083     virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<core::position2di>& pos,
00084             const core::rect<s32>* clip=0,
00085             const video::SColor& color= video::SColor(255,255,255,255),
00086             u32 starttime=0, u32 currenttime=0,
00087             bool loop=true, bool center=false) = 0;
00088 };
00089 
00090 
00091 } // end namespace gui
00092 } // end namespace irr
00093 
00094 #endif // __I_GUI_SPRITE_BANK_H_INCLUDED__
00095