Try to convert icon rendering to new helper function (for GL3 support)

This commit is contained in:
Marianne Gagnon 2014-05-13 20:00:16 -04:00
parent dd81f02fea
commit 474bbb4373
6 changed files with 40 additions and 5 deletions

View File

@ -12,6 +12,7 @@
namespace irr
{
namespace video { class ITexture; }
namespace gui
{
class IGUIFont;
@ -564,6 +565,10 @@ namespace gui
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture) = 0;
};

View File

@ -249,11 +249,16 @@ void CGUIButton::draw()
pos.X -= ImageRect.getWidth() / 2;
pos.Y -= ImageRect.getHeight() / 2;
driver->draw2DImage(Image,
ScaleImage? AbsoluteRect :
core::recti(pos, ImageRect.getSize()),
ImageRect, &AbsoluteClippingRect,
0, UseAlphaChannel);
skin->draw2DImage(Image,
ScaleImage ? AbsoluteRect :
core::recti(pos, ImageRect.getSize()),
ImageRect, &AbsoluteClippingRect,
0, UseAlphaChannel);
//driver->draw2DImage(Image,
// ScaleImage? AbsoluteRect :
// core::recti(pos, ImageRect.getSize()),
// ImageRect, &AbsoluteClippingRect,
// 0, UseAlphaChannel);
}
}
else

View File

@ -179,6 +179,13 @@ CGUISkin::~CGUISkin()
}
void CGUISkin::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture)
{
Driver->draw2DImage(texture, destRect, sourceRect, clipRect, colors, useAlphaChannelOfTexture);
}
//! returns default color
video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color) const
{

View File

@ -224,6 +224,10 @@ namespace gui
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture);
private:
video::SColor Colors[EGDC_COUNT];

View File

@ -2267,6 +2267,15 @@ void Skin::drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon,
// -----------------------------------------------------------------------------
void Skin::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture)
{
::draw2DImage(texture, destRect, sourceRect, clipRect, colors, useAlphaChannelOfTexture);
}
// -----------------------------------------------------------------------------
video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const
{
/*

View File

@ -381,6 +381,11 @@ namespace GUIEngine
const core::rect< s32 > &rect,
const core::rect< s32 > *clip,
core::rect<s32>* checkClientArea=0);
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture);
virtual void drawIcon (gui::IGUIElement *element,
gui::EGUI_DEFAULT_ICON icon,
const core::position2di position,