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

Author Topic: Program Hangs On Exit  (Read 2090 times)

0 Members and 1 Guest are viewing this topic.

Andershizzle

  • Newbie
  • *
  • Posts: 16
    • View Profile
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!

Andershizzle

  • Newbie
  • *
  • Posts: 16
    • View Profile
Program Hangs On Exit
« Reply #1 on: August 29, 2009, 10:04:15 pm »
Scratch this. I'm assuming I was just doing something wrong the way I had it set up with VS 2008. I'm no longer using VS 2008 due to it not being 'native' and requiring frameworks to be downloaded and now I'm using MinGW and it compiles it and runs perfectly. So yeah, delete/lock this.

 

anything