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 - ImNewToSFML

Pages: [1]
1
Yes, I didn't call it. Still when I click the close button of the SFML window, it closes.
Very sorry, I had another piece of code that was blocking it.
Also, is there any pre-built button class or do we have to make it on our own using Text(s)? Thanks!

2
Window / How to prevent window.close() and do some other activity instead?
« on: September 27, 2021, 03:03:37 pm »
I'm new to SFML, using C++.

How to prevent window.close() and do some other activity instead in case of the
Event::EventType::Closed:
event?

For example, if I want the user to either save or discard a file made, how would I do that?

This is the part of code from the SFML tutorial, a bit modified.
sf::Event e;
        while (sfmlWin.pollEvent(e)) {

            switch (e.type) {
            case sf::Event::EventType::Closed:

                using namespace sf;

                Text t;

                t.setString("Something.");
               
                sfmlWin.draw(t);


            }
        }

Thanks in advance!


Pages: [1]
anything