video_switch (var res,var
depth,var window)
Switches the screen to the resolution given by res,
to the color depth given by depth and to fullscreen
(window = 1) and
window mode (window = 2). 0 means no change for
either parameter. The video_mode, video_depth, video_screen,
and screen_size variables are automatically set to their
new values.
Parameters:
res - video mode number that determines the screen
resolution.
| 0 |
no change |
| 1 |
320x200 (legacy) |
| 2 |
320x240 (legacy) |
| 3 |
320x400 (legacy) |
| 4 |
400x300 (legacy) |
| 5 |
512x384 (legacy) |
| 6 |
640x480 (flythrough default mode) |
| 7 |
800x600 |
| 8 |
1024x768
|
| 9 |
1280x1024 |
| 10 |
1400x1050 |
| 11 |
1600x1200 |
| 12 |
1920x1200 |
depth - color depth
| 0 |
no change |
| 16 |
16 bit / high color |
| 32 |
32 bit / true color |
window - fullscreen or window mode
| 0 |
no change |
| 1 |
fullscreen |
| 2 |
window |
Returns:
0 if the video mode can't be set, otherwise the number
of the new mode.
Modifies:
| video_mode |
new resolution |
| video_depth |
new color depth |
| 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 must not be changed immediately in an entity or panel event,
otherwise rendering errors can occur.
Use a wait(1) before changing the resolution in an event.
- Fullscreen video modes below 6 (640x480) are legacy
modes and not supported by most video cards. Fullscreen modes
6, 7, and 8 are working almost everywhere.
-
Most video cards always run in 32 bit / True Color mode regardeless
of the depth setting.
-
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. For a fullscreen display on further monitors see video_window.
Example:
if(video_switch(7,0,0) == 0)
{
video_switch(6,0,0);
}
See also:
video_mode,
video_depth, video_screen,
screen_size, video_window, video_set ► latest
version online