mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Updated Cocoa example
Now load correctly a font instead of displaying nothing at all.
This commit is contained in:
parent
abd842510e
commit
757a785ed7
@ -14,6 +14,7 @@ set(XIBS MainMenu)
|
||||
# all resource files
|
||||
set(RESOURCES ${SRCROOT}/resources/logo.png
|
||||
${SRCROOT}/resources/icon.icns
|
||||
${SRCROOT}/resources/sansation.ttf
|
||||
${SRCROOT}/resources/blue.png
|
||||
${SRCROOT}/resources/green.png
|
||||
${SRCROOT}/resources/red.png
|
||||
|
@ -54,11 +54,17 @@ struct SFMLmainWindow
|
||||
unsigned int ww = renderWindow.getSize().x;
|
||||
unsigned int wh = renderWindow.getSize().y;
|
||||
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.setFont(font);
|
||||
}
|
||||
|
||||
sf::RenderWindow renderWindow;
|
||||
sf::Font font;
|
||||
sf::Text text;
|
||||
sf::Texture logo;
|
||||
sf::Sprite sprite;
|
||||
|
BIN
examples/cocoa/resources/sansation.ttf
Normal file
BIN
examples/cocoa/resources/sansation.ttf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user