2009-01-27 05:23:36 -08:00
|
|
|
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
2008-05-22 04:51:37 -07:00
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
#ifndef __C_GUI_SPRITE_BANK_H_INCLUDED__
|
|
|
|
#define __C_GUI_SPRITE_BANK_H_INCLUDED__
|
|
|
|
|
2007-07-25 22:30:19 -07:00
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
#ifdef _IRR_COMPILE_WITH_GUI_
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
#include "IGUISpriteBank.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace video
|
|
|
|
{
|
|
|
|
class IVideoDriver;
|
|
|
|
class ITexture;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace gui
|
|
|
|
{
|
|
|
|
|
|
|
|
class IGUIEnvironment;
|
|
|
|
|
|
|
|
//! Sprite bank interface.
|
|
|
|
class CGUISpriteBank : public IGUISpriteBank
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
CGUISpriteBank(IGUIEnvironment* env);
|
|
|
|
virtual ~CGUISpriteBank();
|
|
|
|
|
|
|
|
virtual core::array< core::rect<s32> >& getPositions();
|
|
|
|
virtual core::array< SGUISprite >& getSprites();
|
|
|
|
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual u32 getTextureCount() const;
|
|
|
|
virtual video::ITexture* getTexture(u32 index) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
virtual void addTexture(video::ITexture* texture);
|
|
|
|
virtual void setTexture(u32 index, video::ITexture* texture);
|
|
|
|
|
2010-01-23 12:13:43 -08:00
|
|
|
//! Add the texture and use it for a single non-animated sprite.
|
|
|
|
virtual s32 addTextureAsSprite(video::ITexture* texture);
|
|
|
|
|
|
|
|
//! clears sprites, rectangles and textures
|
|
|
|
virtual void clear();
|
|
|
|
|
2009-09-16 05:48:19 -07:00
|
|
|
//! Draws a sprite in 2d with position and color
|
2007-05-20 11:03:49 -07:00
|
|
|
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);
|
|
|
|
|
2009-09-16 05:48:19 -07:00
|
|
|
//! Draws a sprite batch in 2d using an array of positions and a color
|
|
|
|
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);
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
protected:
|
|
|
|
|
2009-09-16 05:48:19 -07:00
|
|
|
struct SDrawBatch
|
|
|
|
{
|
|
|
|
core::array<core::position2di> positions;
|
|
|
|
core::array<core::recti> sourceRects;
|
|
|
|
u32 textureNumber;
|
|
|
|
};
|
|
|
|
|
2009-01-27 05:23:36 -08:00
|
|
|
core::array<SGUISprite> Sprites;
|
2007-05-20 11:03:49 -07:00
|
|
|
core::array< core::rect<s32> > Rectangles;
|
|
|
|
core::array<video::ITexture*> Textures;
|
|
|
|
IGUIEnvironment* Environment;
|
|
|
|
video::IVideoDriver* Driver;
|
2009-09-16 05:48:19 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace gui
|
|
|
|
} // end namespace irr
|
|
|
|
|
2007-07-25 22:30:19 -07:00
|
|
|
#endif // _IRR_COMPILE_WITH_GUI_
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
#endif // __C_GUI_SPRITE_BANK_H_INCLUDED__
|
|
|
|
|