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

Author Topic: Switching between windowed mode and fullscreen  (Read 3146 times)

0 Members and 1 Guest are viewing this topic.

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Switching between windowed mode and fullscreen
« on: February 27, 2010, 05:09:07 am »
Hi,

Is it possible to switch between windowed mode and full screen mode, while a program is running?
I can't find a setting for this in SFML 1.5...

I use a sf::RenderWindow, if that is of consequence.

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Switching between windowed mode and fullscreen
« Reply #1 on: February 27, 2010, 08:22:07 am »
I think the only way to do it is to recreate the window. I'm not sure if this will cause issues while you are getting input and moving sprites and things though.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
Switching between windowed mode and fullscreen
« Reply #2 on: February 27, 2010, 11:16:13 am »
Yes, App.create is the way to go. It takes just a little bit, the game doesn't continue till the operation is done, so it doesn't affect the play if you manage the elapsed time correctly.
I don't think you need input while switching between video modes  :wink:
Pluma - Plug-in Management Framework

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Switching between windowed mode and fullscreen
« Reply #3 on: February 27, 2010, 04:40:49 pm »
That was what I tried doing, but it crashed and burned. Or so I thought...

I had tied the Create method to the F12 key in the event loop, and apparently, you shouldn't do that with Visual C++... So, no problem, everything works as it should.

Thanks for the helpful answers!

Oh, and I am not making a game, so timing isn't much of an issue. I am making a kind polygon drawing tool, which is indeed meant to be used for a game, when it's done.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Switching between windowed mode and fullscreen
« Reply #4 on: February 27, 2010, 04:57:46 pm »
F12 is a special key that triggers the debugger :)
Laurent Gomila - SFML developer

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Switching between windowed mode and fullscreen
« Reply #5 on: February 27, 2010, 09:23:03 pm »
Yes, and I even got a message about it, but being a windows user of many years, I have developed a habit of mostly just skimming error messages. So when I saw something with assert, and a file that wasn't mine, then I just assumed I had done something wrong in my code.  :?

Anyway, it seems like F10 and/or F11 are also reserved by Visual Studio, because those events didn't work reliably, either. Using F1 and F2 resolves that, so that is probably it. :)