DQBmouseDetected
FUNCTION

Prototype

DECLARE FUNCTION DQBmouseDetected ()

Parameters

Returns

An INTEGER value holding the mouse initialization result: > 0 Mouse not detected > -1 Mouse detected and successfully initialized

Description

Returns true if a mouse has been detected on your system; you should call this before calling any other mouse routine.

Notes:

It is recommended that you also call DQBresetMouse just after setting mode 13h by calling SCREEN 13, before using any other mouse routine.

Example

*****************************************************************************

' All integers for speed
DEFINT A-Z

'$INCLUDE:'DIRECTQB.BI'

' Let's initialize the library with one extra layer and no sounds nor EMS
IF DQBinit(1, 0, 0) THEN DQBclose: PRINT DQBerror$: END

' Checks if a mouse has been detected
IF NOT DQBmouseDetected THEN
    ' Mouse has not been detected
    PRINT "This demo requires a mouse to run!"
    DQBclose
    END
END IF

DQBinitVGA

' Resets the mouse cursor and range
DQBresetMouse

' Sets a new mouse range
DQBsetMouseRange 6, 6, 314, 148

DO
    ' Let's clear layer 1
    DQBclearLayer 1

    DQBbox 1, 5, 5, 315, 149, 32

    ' Prints some stats
    DQBprint 1, "PRESS ANY KEY TO EXIT DEMO", 0, 170, 40

    ' Prepares our info string
    Info$ = "Mouse is at" + str$(DQBmouseX) + "," + str$(DQBmouseY)
    Info$ = Info$ + " - Buttons: " + str$(DQBmouseLB) + " " + str$(DQBmouseRB)

    DQBprint 1, Info$, 0, 180, 40

    ' Hides the mouse cursor before drawing to the screen
    DQBmouseHide

    ' Copies layer 1 onto the screen
    DQBcopyLayer 1, VIDEO

    ' Shows the cursor again
    DQBmouseShow

' Loops while no keys are pressed
LOOP WHILE INKEY$ = ""

' Ends program
DQBclose

*****************************************************************************