video_set(var width,var height,var depth,var screen)
Like video_switch, but the width and height can now be set
individually, thus allowing arbitrary video resolutions not contained
in the 12 supported modes.
Parameters:
width |
screen/window width, or 0 for no change |
height |
screen/window height, or 0 for no change |
depth |
always 0 |
screen |
fullscreen (1) or window mode (2), or 0 for no change |
Returns:
0 if the command failed, otherwise nonzero.
Remarks:
-
This function can not be called 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.
- In window mode, arbitrary video resolutions are supported as long as
they fit on the desktop screen and sufficient video memory is
available. The 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.
- In fullscreen mode, only a few video resolutions are supported,
dependent on the 3D card.
- 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_set(800,600,0,0);
video_set(0,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.
-
When video_set is called several times within the same frame, it can fail when the OS is busy with rebuilding the window while it is resized. In this case, video_set returns 0. Just call it again in the next frame with the same parameters.
Modifies:
video_mode |
new resolution |
video_screen |
fullscreen or window mode |
screen_size |
height and width in pixel |
Speed:
Medium
Example:
// place the window at position (500,300) and remove the border
video_window(vector(500,300,0),nullvector,1,NULL);
// But a small engine window at this position (to fake the eninge into another applictaion)
video_set(100, 100, 32, 0);
See also:
video_switch, video_window ► latest
version online