video_switch (var
mode,var
depth,var screen)
Switches the screen to the resolution given by
mode,
and/or to fullscreen or
window mode. The video_mode, video_screen,
and screen_size variables are automatically set to their
new values.
Parameters:
mode - 0 for no change, or the mode number that determines the new screen
resolution (see video_mode).
depth - always 0.
screen
- a combination of the following modes:
0 = no change,
1 = fullscreen,
2 = window,
4 = only set screen_size to the desired resolution, but don't actually change the resolution, A7.7
8 = enforce 4:3 resolutions.
Returns:
0 if the video mode is not supported, otherwise the number
of the new mode.
Modifies:
video_mode |
new resolution |
video_screen |
fullscreen or window mode |
screen_size |
height and width in pixel |
Speed:
Slow
Remarks:
-
The video resolution can not be changed before the video device is initialized, which happens in the first frame under lite-C.
- The video resolution can not be changed immediately in an entity or panel event
.
Use a wait(1) before changing the resolution in an event.
-
A window - including title bar and border - can not be bigger
than the desktop.
Thus setting a 1024x768 window on a 1024x768 desktop will always fail unless you remove border and title bar.
For setting arbitrary resolutions in window mode,
use video_set.
- Switching between fullscreen and window mode and at the same time
to a different resolution might require two steps when the current
or desired resolution is the same as the desktop resolution.
Imagine you're at 1024x768 fullscreen and your desktop is also at
1024x786, and you want to switch to 600x800 window mode. This requires
two steps: first, switching from fullscreen to window mode, and
second, setting the resolution at 800x600. The first step fails
because a 1024x758 window plus title bar is bigger than the desktop. Thus video_switch returns 0. You need to switch to 600x800 fullscreen first, and then you can switch to window mode:
video_switch(7,0,0);
video_switch(0,0,2);
-
On a multi-monitor system, fullscreen video modes are normally opened on the primary monitor
unless a different monitor is selected by the -mon command line option.
Examples:
if(video_switch(7,0,0) == 0)
{
video_switch(6,0,0);
}
See also:
video_mode,
video_screen, video_aspect,
screen_size, video_window, video_set
► latest
version online