my class def :
Code: Select all
protected :
irr::video::SColor color;
public:
//! constructor
/*!
constructor (cf Irrlicht's IGUIElements)
\param irr::gui::IGUIEnvironment* environment
\param irr::gui::IGUIElement* parent
\param irr::s32 id
\param irr::core::rect<irr::s32> rectangle : where to draw
*/
MaximaGUIBackground(
irr::gui::IGUIEnvironment* environment,
irr::gui::IGUIElement* parent, irr::s32 id,
irr::core::rect<irr::s32> rectangle);
//! destructor
~MaximaGUIBackground();
//! sets the background color
virtual void setColor(irr::video::SColor color);
//! draws the element and its children
virtual void draw();
and in the .cpp :
Code: Select all
// constructor (i am sure i screwed up something, though there ain't much ^^")
GUIBackground::GUIBackground(
irr::gui::IGUIEnvironment* environment,
irr::gui::IGUIElement* parent,
s32 id,
core::rect<s32> rectangle)
: IGUIElement(EGUIET_ELEMENT, environment, parent, id, rectangle)
{
// by default, the color is black and without transparency
this->color = SColor(0, 0, 0, 0); // ARGB
}
// just to set a new color :
void GUIBackground::setColor(irr::video::SColor color)
{
this->color = color;
}
// and the draw :
void GUIBackground::draw()
{
if (!IsVisible)
return;
// we draw the background color
Environment->getVideoDriver()->draw2DRectangle(this->color, AbsoluteRect, &AbsoluteClippingRect);
// ^ i don't know exactly what are these absoluteRect and clippingRect, but i intended
// to discover it once i could get something to be actually drawn....
IGUIElement::draw();
}
anyway, thanks to anyone with an advice on this
ps : i don't intend to modify the IGUIEnvironment class and as of now i just my constructor and set the color directly (not via a "addBg" fonction)... i have looked at the addXX functions to see if they did add important things and it seems it is not the case, thus i doubt the problem comes from this (i am saying it just in case ^^)