Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Toggle Fullscreen?

Hi,

I know the code to automatically send the game into fullscreen but I don't know the code to reverse this operation. In other words, how would I let the player toggle fullscreen on/off?
Thanks in advance.
 
Yes I know that, but I need it scripted so that say when a switch is on it goes fullscreen and when a switch is off it becomes windowed again. I don't want the player to have to press Alt+Enter.
Any help would be really appreciated.
 
Took me 1 minute to find this using the search module. I'm not sure if it works reversed, but it should.

As far as I'm concerned, the following script should be able to turn on Fullscreen, and turn off Fullscreen if already in fullscreen, as the code appears to be virtually pressing Alt + Enter for the user.

Code:
keybd = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
keybd.call 0xA4, 0, 0, 0
keybd.call 13, 0, 0, 0
keybd.call 13, 0, 2, 0
keybd.call 0xA4, 0, 2, 0

This means, whenever you want the player to go into full screen mode, call this code in any existing script or using a call script command in event page 3.

Please note, as mentioned:

1. When NOT in full screen mode, this code will cause full screen.
2. When IN full screen mode, this code will go out of full screen mode.

I think this should work. I actually haven't tried exiting full screen with this code, though by the fact that it should press the keys for the player, it would be quite obvious.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top