Added FontSprite class for font sprite support ( XNA Font Sprites ).

--HG--
branch : dev-2.1
This commit is contained in:
Martín Lucas Golini
2018-01-22 00:17:48 -03:00
parent 04e4646130
commit fba9460bfd
11 changed files with 349 additions and 5 deletions

View File

@@ -4,10 +4,12 @@ EE::Window::Window * win = NULL;
FontTrueType * fontTest;
FontTrueType * fontTest2;
FontBMFont * fontBMFont;
FontSprite * fontSprite;
Text text;
Text text2;
Text text3;
Text text4;
Text text5;
void mainLoop() {
// Clear the screen buffer
@@ -33,6 +35,8 @@ void mainLoop() {
text4.draw( ( win->getWidth() - text4.getTextWidth() ) * 0.5f, 590 );
text5.draw( ( win->getWidth() - text5.getTextWidth() ) * 0.5f, 640 );
// Draw frame
win->display();
}
@@ -92,6 +96,14 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
text4.setCharacterSize( 45 );
text4.setFillColor( Color::Black );
fontSprite = FontSprite::New( "alagard" ); // Alagard - Hewett Tsoi ( https://www.dafont.com/alagard.font )
fontSprite->loadFromFile( "assets/fonts/custom_alagard.png", Color::Magenta, 32, -4 );
text5.setFont( fontSprite );
text5.setString( "Lorem ipsum dolor sit amet, consectetur adipisicing elit." );
text5.setCharacterSize( 38 );
//text5.setFillColor( Color::Black );
// Application loop
win->runMainLoop( &mainLoop );
}