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

Author Topic: Closing a window  (Read 8663 times)

0 Members and 1 Guest are viewing this topic.

BMB

  • Newbie
  • *
  • Posts: 21
    • View Profile
Closing a window
« on: December 19, 2011, 03:36:21 pm »
Why is it that a window created with SFML cannot be closed with the X button in its title bar? And how can I catch this click to make it close?
I am using SFML2 and Windows XP, if it makes a difference.

Oneiros

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Closing a window
« Reply #1 on: December 19, 2011, 03:45:44 pm »
http://www.sfml-dev.org/documentation/2.0/
Quote from: "http://www.sfml-dev.org/documentation/2.0/"
Code: [Select]

         // Process events
         sf::Event event;
         while (window.PollEvent(event))
         {
             // Close window : exit
             if (event.Type == sf::Event::Closed)
                 window.Close();
         }

BMB

  • Newbie
  • *
  • Posts: 21
    • View Profile
Closing a window
« Reply #2 on: December 19, 2011, 04:22:37 pm »
Quote from: "Oneiros"
http://www.sfml-dev.org/documentation/2.0/
Quote from: "http://www.sfml-dev.org/documentation/2.0/"
Code: [Select]

         // Process events
         sf::Event event;
         while (window.PollEvent(event))
         {
             // Close window : exit
             if (event.Type == sf::Event::Closed)
                 window.Close();
         }

Thank you. I must of missed it.