Files
eepp/src/ui/cuibackground.cpp
spartanj 6432fa9a9b Added support for multitexture binding.
Added some functions for tex env managing.
Modified some enum names from renders.
Added a pixel separator for characters in the ttf creation ( optional ).
Moved some OpenGL and GLEW things to cGL, this is for a future implementation with OpenGL ES and without GLEW.
Tryed to fix a bad rendering bug when clipping controls with borders ( borders disappear ), i think that the hack is working.
Modified some name conventions.
2010-09-04 05:28:41 -03:00

90 lines
2.1 KiB
C++

#include "cuibackground.hpp"
namespace EE { namespace UI {
cUIBackground::cUIBackground() :
mBlendMode( ALPHA_NORMAL ),
mCorners(0)
{
mColor.push_back( eeColorA(0xFF404040) );
}
cUIBackground::cUIBackground( const cUIBackground& Back ) :
mBlendMode( ALPHA_NORMAL ),
mCorners( Back.Corners() )
{
cUIBackground * b = const_cast<cUIBackground *> ( &Back ); // cheating
mColor = b->Colors();
}
cUIBackground::cUIBackground( const eeColorA& Color, const eeUint& Corners, const EE_PRE_BLEND_FUNC& BlendMode ) :
mBlendMode( BlendMode ),
mCorners( Corners )
{
mColor.push_back( Color );
}
cUIBackground::cUIBackground( const eeColorA& TopLeftColor, const eeColorA& BottomLeftColor, const eeColorA& BottomRightColor, const eeColorA& TopRightColor, const eeUint& Corners, const EE_PRE_BLEND_FUNC& BlendMode ) :
mBlendMode( BlendMode ),
mCorners( Corners )
{
Colors( TopLeftColor, BottomLeftColor, BottomRightColor, TopRightColor );
}
eeColorA& cUIBackground::Color( const eeUint& index ) {
if ( index < mColor.size() )
return mColor[ index ];
return mColor[ 0 ];
}
void cUIBackground::ColorsTo( const eeColorA& Color ) {
for ( eeUint i = 0; i < mColor.size(); i++ )
mColor[i] = Color;
}
void cUIBackground::Colors( const eeColorA& TopLeftColor, const eeColorA& BottomLeftColor, const eeColorA& BottomRightColor, const eeColorA& TopRightColor ) {
mColor[0] = TopLeftColor;
if ( mColor.size() < 2 )
mColor.push_back( BottomLeftColor );
else
mColor[1] = BottomLeftColor;
if ( mColor.size() < 3 )
mColor.push_back( BottomRightColor );
else
mColor[2] = BottomRightColor;
if ( mColor.size() < 4 )
mColor.push_back( TopRightColor );
else
mColor[3] = TopRightColor;
}
const std::vector<eeColorA>& cUIBackground::Colors() {
return mColor;
}
void cUIBackground::Color( const eeColorA& Col ) {
mColor[0] = Col;
}
const EE_PRE_BLEND_FUNC& cUIBackground::Blend() const {
return mBlendMode;
}
void cUIBackground::Blend( const EE_PRE_BLEND_FUNC& blend ) {
mBlendMode = blend;
}
const eeUint& cUIBackground::Corners() const {
return mCorners;
}
void cUIBackground::Corners( const eeUint& corners ) {
mCorners = corners;
}
}}