CREATESCREEN

Top  Previous  Next

Syntax

INT = CREATESCREEN(width as int,height as int, BPP as int, opt handler=NULL as UINT)

Description

Creates a full screen exclusive DirectX screen complete with front and back buffers. Triple buffering is automatically used if enough memory is available.

Parameters

width - width of the DirectX screen

height - Height of the DirectX screen

BPP - Bits per pixel, one of  8, 16, 24 or 32.

handler - Optional. Address of a windows handler to pass messages to.

Return value

0 if screen was successfully created and < 0 on failure

Remarks

CREATESCREEN or ATTACHSCREEN must be used successfully before any sprite, map or 2D drawing commands are used. The return value should always be tested since not every screen mode will be available on all video cards. It is safe to assume that the system screen size and bit depth will be available. The optional handler allows using a standard windows handler with your full screen program to process messages sent to the internal window. This allows seamless integration standard event driven code with linear 2D code.

See Also: CLOSESCREEN, ATTACHSCREEN

Example usage

IF CREATESCREEN( 800, 600, 32) < 0
    MESSAGEBOX 0,"Error creating screen","error"
ENDIF
FILLSCREEN 0
WRITETEXT 0, 0, "Press any key to close"
FLIP
WAITKEY
CLOSESCREEN
END