SFML community forums
Help => Window => Topic started by: Reborn on May 09, 2014, 11:48:12 pm
-
Hey,
i want that my game window render it's pictures, while it isn't the foreground window how i can i do that?
-
It does that by default. If your main game loop looks anything like the one in the tutorials, it will keep getting executed (and drawing stuff) until the window is closed. When the window loses focus, all that does is generate an sf::Event::LostFocus, which you're free to ignore.
Are you experiencing a problem of some kind that makes you think this isn't the default behavior?
-
First Thanks for the quick answer.
I want make possible to resize my window, but i want to keep the aspect ratio. So i added
case WM_SIZE:
case WM_SIZING:
in the WindowImplWin32.cpp, at first just for trying purposes, i think, so can i set the width to the new hight from my window. But when i resize the window, my game stop polling events from the stack, so i cant handle WM_SIZING-Events.
-
Uhh well modifying SFML source code isn't the solution to your problem. Instead use the view and/or the setSize function.
-
You can easily do this with regular SFML using the Resized event and sf::Views. There's no reason to start modifying the library. Please go read *all* of the official SFML tutorials (they're not that long).
-
Not the ratio of my View, i mean the ratio of my Window, i know the tutorial already. And i want show the changes in realtime, so i haveto catch the WM_SIZING - Message. I don't know another reason.
-
Oh, you want the aspect ratio to be maintained while the user is resizing the window, rather than simply "snapping" to the closest size matching the ratio after the user lets go.
This is definitely not something SFML currently provides, and I have no idea if it's possible to implement this in a portable way. But if you get it working on one or more platforms, please do tell us how you did it.
-
The only portable way to implement it with SFML is to handle events in a separate thread. You won't get Resized events during resize though, so you'll have to call window.getSize() in another thread to react to size changes in realtime.
-
Ok i think i understand. Thank you.