mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +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
|
# 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
|
||||||
|
@ -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;
|
||||||
|
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