mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 02:26:29 +03:00
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 ).
This commit is contained in:
@@ -32,10 +32,10 @@ cTextCache::~cTextCache() {
|
||||
void cTextCache::Create( cFont * font, const std::wstring& text, eeColorA FontColor, eeColorA FontShadowColor ) {
|
||||
mFont = font;
|
||||
mText = text;
|
||||
UpdateCoords();
|
||||
Color( FontColor );
|
||||
ShadowColor( FontShadowColor );
|
||||
Cache();
|
||||
UpdateCoords();
|
||||
}
|
||||
|
||||
cFont * cTextCache::Font() const {
|
||||
@@ -52,8 +52,10 @@ std::wstring& cTextCache::Text() {
|
||||
}
|
||||
|
||||
void cTextCache::UpdateCoords() {
|
||||
mRenderCoords.resize( mText.size() * 4 );
|
||||
mColors.resize( mText.size() * 4, mFontColor );
|
||||
Uint32 size = (Uint32)mText.size() * 4;
|
||||
|
||||
mRenderCoords.resize( size );
|
||||
mColors.resize( size, mFontColor );
|
||||
}
|
||||
|
||||
void cTextCache::Text( const std::wstring& text ) {
|
||||
@@ -103,10 +105,11 @@ void cTextCache::Text( const std::string& text ) {
|
||||
}
|
||||
|
||||
void cTextCache::Cache() {
|
||||
if ( NULL != mFont && mText.size() )
|
||||
if ( NULL != mFont && mText.size() ) {
|
||||
mFont->CacheWidth( mText, mLinesWidth, mCachedWidth, mNumLines );
|
||||
else
|
||||
}else {
|
||||
mCachedWidth = 0;
|
||||
}
|
||||
|
||||
mCachedCoords = false;
|
||||
}
|
||||
@@ -129,25 +132,20 @@ const std::vector<eeFloat>& cTextCache::LinesWidth() {
|
||||
|
||||
void cTextCache::Draw( const eeFloat& X, const eeFloat& Y, const Uint32& Flags, const eeFloat& Scale, const eeFloat& Angle, const EE_PRE_BLEND_FUNC& Effect ) {
|
||||
if ( NULL != mFont ) {
|
||||
eeColorA FontColor = mFont->Color();
|
||||
eeColorA FontShadowColor = mFont->ShadowColor();
|
||||
|
||||
mFont->Color( mFontColor );
|
||||
mFont->ShadowColor( mFontShadowColor );
|
||||
|
||||
if ( mFlags != Flags ) {
|
||||
mFlags = Flags;
|
||||
mCachedCoords = false;
|
||||
}
|
||||
|
||||
glTranslatef( X, Y, 0.f );
|
||||
|
||||
mFont->Draw( *this, 0, 0, Flags, Scale, Angle, Effect );
|
||||
|
||||
glTranslatef( -X, -Y, 0.f );
|
||||
|
||||
mFont->Color( FontColor );
|
||||
mFont->ShadowColor( FontShadowColor );
|
||||
|
||||
if ( Angle != 0.0f || Scale != 1.0f ) {
|
||||
mFont->Draw( *this, X, Y, Flags, Scale, Angle, Effect );
|
||||
} else {
|
||||
glTranslatef( X, Y, 0.f );
|
||||
|
||||
mFont->Draw( *this, 0, 0, Flags, Scale, Angle, Effect );
|
||||
|
||||
glTranslatef( -X, -Y, 0.f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,4 +161,12 @@ cFont * cTextCache::GetFont() const {
|
||||
return mFont;
|
||||
}
|
||||
|
||||
const eeUint& cTextCache::CachedVerts() const {
|
||||
return mVertexNumCached;
|
||||
}
|
||||
|
||||
void cTextCache::CachedVerts( const eeUint& num ) {
|
||||
mVertexNumCached = num;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user