Name
ChangeDisplayMode -- switch between window and full screen mode (V4.5)
Synopsis
ChangeDisplayMode(mode[, table])
Deprecated syntax
ChangeDisplayMode(mode[, width, height, table])
Function
This function can be used to change the display mode to the mode specified in the mode parameter. This can be one of the following modes:

#DISPMODE_FULLSCREEN:
Switch to full screen mode. Note that this will switch the monitor's resolution which might not be supported on all systems. Alternatively, you can also use #DISPMODE_FULLSCREENSCALE (see below) which will simply scale the display to the monitor's resolution. If you choose to use #DISPMODE_FULLSCREEN, you can pass the desired monitor resolution in the Width and Height tags of the optional table argument (see below). If you don't set Width and Height, the best monitor resolution for the display's current dimensions will be chosen automatically. If the display is already in full screen mode and you pass #DISPMODE_FULLSCREEN in the mode argument, ChangeDisplayMode() can be used to change the current monitor resolution to a different one.

#DISPMODE_WINDOWED:
Switch to windowed mode. This mode can be used to switch a display back to windowed mode. Obviously, it only makes sense to use this mode on displays which are currently full screen.

#DISPMODE_FULLSCREENSCALE:
Switch into scaled full screen mode. This mode will make the display full screen without changing the monitor's resolution. Instead, the display's graphics will be scaled to the monitor's current resolution. Thus, they will fill the whole screen even though the monitor didn't change its resolution. By default, Hollywood's auto scaling engine will be used for scaling but you can set the LayerScale tag in the optional table argument (see below) to True to use the layer scaling engine instead. See Scaling engines for details. Note, however, that #DISPMODE_FULLSCREENSCALE can become quite slow on platforms which don't support hardware-accelerated scaling. (V9.0)

#DISPMODE_MODESWITCH:
This switches between display modes. If the display is currently windowed, it will switch to full screen. If the display is currently full screen, it will switch to windowed. Note that the full screen mode chosed by #DISPMODE_MODESWITCH can be both, #DISPMODE_FULLSCREEN and #DISPMODE_FULLSCREENSCALE. #DISPMODE_MODESWITCH uses the same logic as the ALT+RETURN hotkey that switches a Hollywood display between full screen and windowed mode. See the documentation of the ScaleSwitch tag in the documentation of the @DISPLAY preprocessor command for details. See DISPLAY for details. (V9.0)

Starting with Hollywood 6.0 this function accepts an optional table argument which allows you to configure further options:

Width:
If mode is #DISPMODE_FULLSCREEN, this tag can be used to specify the width of the resolution the monitor should be switched to. You can also pass the special constant #NATIVE here to indicate that Hollywood should use the monitor's native width.

Height:
If mode is #DISPMODE_FULLSCREEN, this tag can be used to specify the height of the resolution the monitor should be switched to. You can also pass the special constant #NATIVE here to indicate that Hollywood should use the monitor's native height.

LayerScale:
If mode is #DISPMODE_FULLSCREENSCALE, this tag can be used to make Hollywood use the layer scaling engine instead of the auto scaling engine. See Scaling engines for details. Defaults to False. (V9.0)

KeepProportions:
If mode is #DISPMODE_FULLSCREENSCALE, you can activate proportional scaling by setting this tag to True. Defaults to False. (V9.0)

SmoothScale:
If mode is #DISPMODE_FULLSCREENSCALE, you can activate interpolated scaling by setting this tag to True. Defaults to False. (V9.0)

Monitor:
This tag allows you to specify the monitor that should be used. Monitors are counted from 1 which is the primary monitor. By default, the monitor currently associated with the active display is used.

Backfill:
This tag allows you to configure the backfill setting for this display. The table you have to specify here has to follow the same conventions as its counterpart that can be passed to the Backfill tag of the @DISPLAY preprocessor command. See DISPLAY for details.

Note that starting with Hollywood 6.0 it is possible to have more than one display in full screen mode since Hollywood 6.0 introduces support for multiple monitors. This makes it possible to have several displays running in full screen mode on separate displays.

To find out whether or not the desired display mode can be handled by the current monitor, use the GetDisplayModes() function.

Inputs
mode
mode to switch into (see above)
table
optional: table configuring further options (see above) (V6.0)
Example
ChangeDisplayMode(#DISPMODE_FULLSCREEN, {Width = 1024, Height = 768})
NPrint("We are now in full screen mode. Press left mouse to return\n" ..
   "to windowed mode.")
WaitLeftMouse
ChangeDisplayMode(#DISPMODE_WINDOWED)
NPrint("We are back in windowed mode now.")
WaitLeftMouse
The code above goes into 1024x768 full screen mode, waits for left mouse button to be pressed and then returns to windowed mode again.

Show TOC