Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Stop the Windows  (Read 1735 times)

0 Members and 3 Guests are viewing this topic.

fedot89

  • Newbie
  • *
  • Posts: 3
    • View Profile
Stop the Windows
« on: November 15, 2010, 10:37:04 am »
Why after i compile my window dont stop? he disapaire very fast.

getch(); Failed

Here is the code.


Code: [Select]

////////////////////////////////////////////////////////////
// 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");

    // Load a font from a file
    sf::Font MyFont;
    if (!MyFont.LoadFromFile("comic.ttf", 50))
        return EXIT_FAILURE;

    // Create a graphical string
    sf::String Hello;
    Hello.SetText("Hello !\nHow are you ?");
    Hello.SetFont(MyFont);
    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;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Stop the Windows
« Reply #1 on: November 15, 2010, 10:42:11 am »
Maybe MyFont.LoadFromFile returns false.
Laurent Gomila - SFML developer

fedot89

  • Newbie
  • *
  • Posts: 3
    • View Profile
Stop the Windows
« Reply #2 on: November 15, 2010, 10:51:49 am »
where i find some fonts?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Stop the Windows
« Reply #3 on: November 15, 2010, 11:04:57 am »
C:\Windows\Fonts for default fonts, www.dafont.com to download additional (free or not) fonts.
Laurent Gomila - SFML developer