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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Andershizzle

Pages: 1 [2]
16
Window / Program Hangs On Exit
« on: August 27, 2009, 06:49:55 am »
Okay first off, HOLY COW THAT WAS THE HARDEST ANTI BOT REGISTRATION THING I'VE EVER DONE.

Secondly, the real issue.

Anyways, I'm new to SFML, and LOVING IT SO MUCH so far. There's just one teency weency problem...

Well, when I debug my solution, everything runs fine. However when I hit the Esc key it exits but doesn't stop debugging. After about 1-2 minutes I will get a debug line saying that the program returned 0. And then it's done debugging. For debugging this isn't a problem because I can hit "stop debugging" to make it end immediately when I'm done.

But the big issue is that when I run the 'Release' exe file, it does the same thing. The process Window 2.exe is open for 1-2 minutes after I exit. I could just end process but I mean, seriously? The process should end itself when the program is exited.

Anyways, here's my code. Help me out ^^ Thanks!

Code: [Select]



////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>


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

    // Get a reference to the input manager associated to our window, and store it for later use
    const sf::Input& Input = App.GetInput();

sf::Image MaleBaseSheet;
if(!MaleBaseSheet.LoadFromFile("sprite/MaleBaseSheet.png"))
return EXIT_FAILURE;

sf::Sprite MaleBase(MaleBaseSheet);
MaleBase.SetSubRect(sf::IntRect(0, 0, 50, 80));
MaleBase.SetPosition(500.f, 500.f);




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

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }


//Clear Screen
App.Clear();

        // Display window on screen
App.Draw(MaleBase);

        App.Display();
    }

    return EXIT_SUCCESS;
}




Well when I hit exit it correctly executes App.Close() and the window closes. The issue is that the process continues to run after the "return EXIT_SUCCESS" is executed and doesn't completely shut down for about 1-2 minutes. Any fix? This is probably going to be pretty important down the line...

Thanks!

Pages: 1 [2]