Files
eepp/src/ui/cuigfx.cpp
spartanj e5744e349c Added a mutex on HaikuTTF, to fix a problem ( a.k.a. bug ) with multiple concurrence on FT calls.
Added Icon possibility to cUIPushButton.
Added default fonts for ui themes and global default font for all ui themes.
Changed how cUIGfx get shapes, now accept a new instance without shape.
Fixed how padding works on cUITextBox and cUITextInput.
Fixed font rendering in cTextCache when some text rendered with angle or/and scale ( it was breaking the model view matrix ).
Fixed a miscounting of the number of vertex for the cached text.
Fixed HaikuTTF destroy singleton ( now release fine the memory ).
2010-10-18 04:38:24 -03:00

77 lines
1.5 KiB
C++

#include "cuigfx.hpp"
namespace EE { namespace UI {
cUIGfx::cUIGfx( const cUIGfx::CreateParams& Params ) :
cUIControlAnim( Params ),
mShape( Params.Shape ),
mColor( Params.ShapeColor ),
mRender( Params.ShapeRender )
{
mType |= UI_TYPE_GET(UI_TYPE_GFX);
if ( NULL != mShape && ( ( Flags() & UI_AUTO_SIZE ) || ( Params.Size.x == -1 && Params.Size.y == -1 ) ) )
Size( mShape->Size() );
if ( mColor.voidRGB ) {
mColor.Alpha = (Uint8)mAlpha;
mColor.voidRGB = false;
}
}
cUIGfx::~cUIGfx() {
}
void cUIGfx::Shape( cShape * shape ) {
mShape = shape;
if ( NULL != mShape && ( ( Flags() & UI_AUTO_SIZE ) ) )
Size( mShape->Size() );
}
void cUIGfx::Draw() {
cUIControlAnim::Draw();
if ( mVisible ) {
if ( NULL != mShape )
mShape->Draw( (eeFloat)mScreenPos.x, (eeFloat)mScreenPos.y, mColor, 0.f, 1.f, mBlend, mRender );
}
}
void cUIGfx::Alpha( const eeFloat& alpha ) {
cUIControlAnim::Alpha( alpha );
mColor.Alpha = (Uint8)alpha;
}
cShape * cUIGfx::Shape() const {
return mShape;
}
const eeRGBA& cUIGfx::Color() const {
return mColor;
}
void cUIGfx::Color( const eeRGBA& color ) {
mColor = color;
Alpha( color.A() );
}
const EE_RENDERTYPE& cUIGfx::RenderType() const {
return mRender;
}
void cUIGfx::RenderType( const EE_RENDERTYPE& render ) {
mRender = render;
}
void cUIGfx::OnSizeChange() {
if ( NULL != mShape && Flags() & UI_FIT_TO_CONTROL ) {
mShape->DestWidth( (eeFloat)mSize.x );
mShape->DestHeight( (eeFloat)mSize.y );
}
cUIControlAnim::OnSizeChange();
}
}}