Mode is ok

From Bennu Wiki
Jump to: navigation, search


Definition

INT mode_is_ok ( <INT width> , <INT height> , <INT depth>, <INT flags> )

Returns 0 if the requested mode is not supported under any bit depth,or returns the bits-per-pixel of the closest available mode with the given width, height and requested flags.

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 : Whether the specified mode can be used.

0 - The specified mode cannot be used.
>0 - The bits-per-pixel of the closest available mode for the given width, height and flags.


Example

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

Process Main()
Begin
    if (is_mode_ok(640,400,16,0))
     set_mode(640,400,16);
    else
     set_mode(640,480,16);
    end
    Repeat
        frame;
    Until(key(_ESC)||exit_status)
End

Used in example: is_mode_ok(),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()