Blitz3D+ Command Reference

FindGfxMode ( width,height,depth )

Parameters

width - width in pixels, e.g. 1920

height - height in pixels, e.g. 1080

depth - colour depth in bits (use 32 on the modern runtime)

Description

Returns the mode number of the fullscreen graphics mode matching your criteria.

The result is an index from 1 to CountGfxModes() - usable with GfxModeWidth and friends - or 0 if no mode matches exactly. It is GfxModeExists with a more informative answer, handy when your options menu highlights the mode the game is currently using.

Depth is matched exactly; on the modern runtime all modes are 32-bit, so query with 32.

See also: GfxModeExists, CountGfxModes, GfxModeWidth, Graphics.

Example

; FindGfxMode Example
; -------------------

; FindGfxMode returns the mode number of a matching display mode,
; or 0 if the video card cannot do it
Print "Searching your video card's mode list..."
Print ""

mode=FindGfxMode(640,480,32)
If mode>0 Then Print "640 x 480 x 32 is graphics mode number "+mode Else Print "640 x 480 x 32 is not available"

mode=FindGfxMode(1920,1080,32)
If mode>0 Then Print "1920 x 1080 x 32 is graphics mode number "+mode Else Print "1920 x 1080 x 32 is not available"

mode=FindGfxMode(12345,678,32)
If mode>0 Then Print "12345 x 678 x 32 is graphics mode number "+mode Else Print "12345 x 678 x 32 is not available (as expected!)"

Print ""
Print "Press any key to close the example"
WaitKey

End

Index