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

Author Topic: close console at the same time as window?  (Read 1126 times)

0 Members and 1 Guest are viewing this topic.

TheHobHobbit

  • Newbie
  • *
  • Posts: 4
    • View Profile
close console at the same time as window?
« on: April 25, 2020, 11:30:59 pm »
so I've got my program working with a console (for debugging information) and the window (for my game) and I've got the basic outline I've found in tutorials and seen in the forums:

while(mainWindow.isOpen()){
sf::Event event;
while (mainWindow.pollEvent(event)){if (event.type == sf::Event::Closed){
mainWindow.close();
}

but I've added "quitEverything = true;" after "mainWindow.close();" to tell the other threads I'm using to terminate. this is all working as intended.

but when hit X to close the window, I have to go manually close the console as well. I know how to get rid of the console altogether, but I kind of need my debug info.

asking because I can't seem to find anything on forums or Google, can I tell the console to close as well when quitEverything is true?

something like

if (quitEverything){sf::Console::close();}  ? does this exist?

I know I can close the console first and they both close, but I often put the game window fullscreen, so it's mildly annoying to close it and then the console as well.

thanks in advance for answers!



Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: close console at the same time as window?
« Reply #1 on: April 26, 2020, 09:06:37 am »
The console should close automatically when your app exits. Have you tried simple examples, and debugged what happens to your threads when you quit? Do they really exit as intended?
Laurent Gomila - SFML developer

av8r

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: close console at the same time as window?
« Reply #2 on: April 26, 2020, 09:13:26 pm »
Are you using Visual Studio Community 2019?

The console window remains open with this prompt after debugging:

Quote
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .