Set mode

From Bennu Wiki
Jump to: navigation, search


Syntax

INT set_mode ( <INT width> , <INT height> , [<INT depth>] , [<INT flags>] )

Description

Sets the screen resolution of your program, and optionally the colordepth of the screen and any render flags for extra options. If this command is not used, the default settings will take effect (320x240 at 32 bpp).

Some much used resolutions are: 320x240, 640x480, 800x600, 1024x768 and 1280x1024.

Parameters

INT width - Width of the screen in pixels.
INT height - Height of the screen in pixels.
INT [depth] - Color depth of the screen. See color_depths.
INT [flags] - Mode of rendering. See render flags.

Returns

INT : -1: error, setting the mode has failed
INT : 0: sucess

INT : true (in versions prior rc282)


Notes

Any fpg files you load must have the same or a lower colordepth as you set for the screen.

Uncommon resolutions can also be used, for example 399x10, which will be the actual size of the window if you run in windowed mode. At full screen black edges might appear.

There is another method of calling set_mode(): with one parameter. In this parameter you must use the 4 right digits for the height and the rest fot the width. For example to set a 320x200 mode you can use set_mode(3200200). The maximum height that allow this method is 9999 pixels. This method is deprecated and its use is disadvised.

Example

import "mod_video"
import "mod_key"
import "mod_wm"

Process Main()
Begin
    set_mode(640,480,16);
    Repeat
        frame;
    Until(key(_ESC)||exit_status)

End

Used in example: set_mode(), key(), exit_status


Mod_video
Globals None
Imported:
DumptypeFadingFpsFrametimeFullscreenGraphmodeM7RestoretypeScalemodeScaleresolutionScaleresolutionaspectratioScaleresolutionorientation
Constants None
Imported:
BACKGROUNDCOMPLETEDUMPCOMPLETERESTORECSCREENDOUBLEBUFFERHWSURFACEM1024X768M1280X1024M320X200M320X240M320X400M360X240M376X282M400X300M512X384M640X400M640X480M800X600MODE16BITSMODE16BPPMODE2XSCALEMODE8BITSMODE8BPPMODEDOUBLEBUFFERMODEFRAMELESSMODEFULLSCREENMODEHARDWAREMODEMODALMODEWAITVSYNCMODEWINDOWNORESTOREPARTIALDUMPPARTIALRESTORESCALEHQ2XSCALENOFILTERSCALENONESCALENORMAL2XSCALESCALE2XSCALESCANLINE2XSCREEN
Locals None
Imported:
AngleCnumberCtypeSpecial:Badtitle/NS108:FileFlagsHeightRegionResolutionSizeSizexSizeyXXgraphYZ
Functions Getmodes()Modeisok()Setfps()Setmode()