Get modes

From Bennu Wiki
Revision as of 17:14, 10 April 2011 by Josebagar (talk | contribs) (Added source code sample.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Syntax

POINTER get_modes ( <INT depth>, <INT flags> )

Description

Returns a pointer to an array of available screen dimensions for the given depth and render flags, sorted largest to smallest.

Returns NULL if there are no dimensions available for a particular format, or -1 if any dimension is okay for the given format.

Parameters

INT depth - Color depth of the screen. See color_depths.
INT flags - Mode of rendering. See render flags.

Returns

POINTER : A pointer to an array of available screen dimensions

Example

import "mod_say";
import "mod_video";

Process Main()
Private
    int * modes;
Begin
    // Modes will point to an array whose values are acceptable values for resolution

    // Get 8bpp acceptable modes when in fullscreen
    modes = get_modes(8, MODE_FULLSCREEN);
    say ("8bit modes");
    say ("----------");
    if (!modes)
        say ("no video modes available!");
    elsif (modes == -1 )
        say ("any video mode available!");
    else
        while (*modes)
            say ("> " + *modes++ + " x " + *modes++ );
        end
    end
    say ("");

    // Get 16bpp acceptable modes when in fullscreen
    modes = get_modes(16, MODE_FULLSCREEN);
    say ("16bit modes");
    say ("-----------");
    if (!modes)
        say ("no video modes available!");
    elsif (modes == -1 )
        say ("any video mode available!");
    else
        while (*modes)
            say ("> " + *modes++ + " x " + *modes++ );
        end
    end
    say ("");

    // Get 24bpp acceptable modes when in fullscreen
    modes = get_modes(24, MODE_FULLSCREEN);
    say ("24bit modes");
    say ("-----------");
    if (!modes)
        say ("no video modes available!");
    elsif (modes == -1 )
        say ("any video mode available!");
    else
        while (*modes)
            say ("> " + *modes++ + " x " + *modes++ );
        end
    end
    say ("");

    // Get 32bpp acceptable modes when in fullscreen
    modes = get_modes(32, MODE_FULLSCREEN);
    say ("32bit modes");
    say ("-----------");
    if (!modes)
        say ("no video modes available!");
    elsif (modes == -1 )
        say ("any video mode available!");
    else
        while (*modes)
            say ("> " + *modes++ + " x " + *modes++ );
        end
    end
    say ("");

End

Used in example: say(), MODE_FULLSCREEN


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