Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
//////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include <SFML/Graphics.hpp> //////////////////////////////////////////////////////////// /// Entry point of application /// /// \return Application exit code /// //////////////////////////////////////////////////////////// int main() { // Create main window sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Fonts"); // Create a graphical string sf::String Hello; Hello.SetText("Hello !\nHow are you ?"); Hello.SetColor(sf::Color(0, 128, 128)); Hello.SetPosition(100.f, 100.f); Hello.SetRotation(15.f); Hello.SetSize(50.f); // You can also use the constructor sf::String Bonjour("Salut !\nComment ça va ?", sf::Font::GetDefaultFont(), 30.f); Bonjour.SetColor(sf::Color(200, 128, 0)); Bonjour.SetPosition(200.f, 300.f); // Start game loop while (App.IsOpened()) { // Process events sf::Event Event; while (App.GetEvent(Event)) { // Close window : exit if (Event.Type == sf::Event::Closed) App.Close(); } // Make the second string rotate Bonjour.Rotate(App.GetFrameTime() * 100.f); // Clear screen App.Clear(); // Draw our strings App.Draw(Hello); App.Draw(Bonjour); // Finally, display rendered frame on screen App.Display(); } return EXIT_SUCCESS; } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Käsekönig« (13.04.2012, 01:03)
[...]wenn es SFML 2 ist, ist es der berüchtigte Default Font Crash). [...]
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 |
sf::Font fnt; fnt.LoadFromFile("C:/Windows/Fonts/arial.ttf"); // Pfad ggf. anpassen //... Hello.SetFont(fnt); // ... sf::String Bonjour("Salut !\nComment ça va ?", fnt, 30.f); //... |
Zitat von »MSDN«
Linkertoolwarnung LNK4098... Diese Warnung wird bei dem Versuch ausgegeben, unterschiedliche Typen oder Debug- und Nicht-Debugversionen der Laufzeitbibliothek im selben Programm zu verwenden.
Zitat
Wenn ich das hier zu meinen libs rein schreib, kommt immer noch der Konflikt mit LIBCMT.
/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib
Werbeanzeige