I am making an options menu in the BGE and I want to know how to make a button that toggles fullscreen on and off for the blender game?

  • $\begingroup$ Would it be acceptable to just have the cam move into a closer position that would make it appear that the menu was fullscreen? $\endgroup$ – Scalia Dec 18 '14 at 16:03

This is simply done with a small python script using the bge.render.setFullScreen() function.

cont = bge.logic.getCurrentController()

if cont.sensors['MouseOver'].hitObject.name == 'Cube' and cont.sensors['Lclick'].getButtonStatus(bge.events.LEFTMOUSE) == bge.logic.KX_INPUT_JUST_ACTIVATED:
    if bge.render.getFullScreen() == True:

You then add the script to your button with these logic bricks.
logic bricks

The MouseOver and Lclick mouse sensors are used to start the script when the button is clicked.
Look through the Blend file for a full working example.
(*Note* you will need to start the Standalone player for full screen to work.)

  • 1
    $\begingroup$ Thank you this worked i just needed to rename some of my stuff to make it work i had a plane named Fullscreen so i changed the part of the script that said cube to Fullscreen and as for my sensers i just renamed them to what you already had in the script which was Lclick and MouseOver $\endgroup$ – sketcherskt Dec 19 '14 at 5:41

In order to do exactly that and not quickly toggle back to windowed, with a keyboard sensor named keyboard:

from bge import render
def fullScreenMode(cont):
    if cont.sensors["keyboard"].getKeyStatus(events.F11KEY) == logic.KX_INPUT_ACTIVE:
        if render.getFullScreen() == False:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.