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

Author Topic: program crash when use sf::String  (Read 2106 times)

0 Members and 1 Guest are viewing this topic.

langisser

  • Newbie
  • *
  • Posts: 9
    • View Profile
program crash when use sf::String
« on: January 07, 2010, 10:15:04 am »
Hi all,
  i'm a new member for this forum. my problem is when i exit program by press ECS or click exit windows then i have error R6025 pure virtual function call.
  i test again by remove code sf::String. My program don't have error when exit.
  How to fix problem.
This is simple code from Tutorial
Code: [Select]


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <iostream>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

// Load a font from a file
    sf::Font MyFont;
    if (!MyFont.LoadFromFile("cheeseburger.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);

// Process events
sf::Event Event;

    // Start game loop
    while (App.IsOpened())
    {
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // A key has been pressed
            if (Event.Type == sf::Event::KeyPressed)
            {
                // Escape key : exit
                if (Event.Key.Code == sf::Key::Escape)
{
                    App.Close();
}

                // F1 key : capture a screenshot
                if (Event.Key.Code == sf::Key::F1)
                {
                    sf::Image Screen = App.Capture();
                    Screen.SaveToFile("screenshot.jpg");
                }
            }
        }

        // Clear the screen with red color
        App.Clear(sf::Color(200, 0, 0));

App.Draw(Hello);
        // Display window contents on screen
        App.Display();
    }
    return EXIT_SUCCESS;
}

i develop on Windows 7 Ultimate/VC++ 2008

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
program crash when use sf::String
« Reply #1 on: January 07, 2010, 10:25:19 am »
Hi and welcome

This is a known bug, you'll find tons of information about it here ;)
Laurent Gomila - SFML developer

langisser

  • Newbie
  • *
  • Posts: 9
    • View Profile
program crash when use sf::String
« Reply #2 on: January 07, 2010, 02:57:36 pm »
thank you
 :D