Updated Cocoa example

Now load correctly a font instead of displaying nothing at all.
This commit is contained in:
Marco Antognini 2012-08-20 19:26:30 +02:00
parent abd842510e
commit 757a785ed7
3 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,7 @@ set(XIBS MainMenu)
# all resource files # all resource files
set(RESOURCES ${SRCROOT}/resources/logo.png set(RESOURCES ${SRCROOT}/resources/logo.png
${SRCROOT}/resources/icon.icns ${SRCROOT}/resources/icon.icns
${SRCROOT}/resources/sansation.ttf
${SRCROOT}/resources/blue.png ${SRCROOT}/resources/blue.png
${SRCROOT}/resources/green.png ${SRCROOT}/resources/green.png
${SRCROOT}/resources/red.png ${SRCROOT}/resources/red.png

View File

@ -55,10 +55,16 @@ struct SFMLmainWindow
unsigned int wh = renderWindow.getSize().y; unsigned int wh = renderWindow.getSize().y;
sprite.setPosition(sf::Vector2f(ww, wh) / 2.f); sprite.setPosition(sf::Vector2f(ww, wh) / 2.f);
if (!font.loadFromFile(resPath + "/sansation.ttf")) {
NSLog(@"Couldn't load the font");
}
text.setColor(sf::Color::White); text.setColor(sf::Color::White);
text.setFont(font);
} }
sf::RenderWindow renderWindow; sf::RenderWindow renderWindow;
sf::Font font;
sf::Text text; sf::Text text;
sf::Texture logo; sf::Texture logo;
sf::Sprite sprite; sf::Sprite sprite;

Binary file not shown.