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.


Topics - u

Pages: [1]
1
Window / sf::Event::Close not fired in fullscreen mode.
« on: February 11, 2014, 01:09:02 pm »
Hi.

I recently started using SFML and it's been a pure pleasure.

One thing I noticed is that windows in full screen mode doesn't seem to fire window close events. Is this the intended behavior?

In the following example it is possible to close the application using the escape key, but it isn't possible to close it using [alt]+[f4]. Notice that using [alt]+[f4] works just fine for windowed applications on the same system.

#include <SFML/Graphics.hpp>

int main(int argc, char **argv) {
        // Open window.
        sf::RenderWindow window(sf::VideoMode(1024, 768), "untitled", sf::Style::Fullscreen);

        // Render and event loop.
        while (window.isOpen()) {
                // Poll events until the event queue is empty.
                sf::Event event;
                while (window.pollEvent(event)) {
                        // Window close event.
                        if (event.type == sf::Event::Closed) {
                                window.close();
                        }
                        // The escape key was pressed.
                        if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                                window.close();
                        }
                }

                // Clear the window with black color.
                window.clear(sf::Color::Black);

                // Display window updates.
                window.display();
        }

        return 0;
}
 

Cheers /u

Pages: [1]