Blitz3D+ Command Reference

HidePointer

Parameters

None.

Description

Hides the system mouse pointer over your game.

Games rarely want the Windows arrow on screen. Hide it and you are free to draw your own crosshair, hand or targeting reticle with DrawImage at MouseX,MouseY, or to hide the pointer entirely for a mouse-look camera that recentres it every frame with MoveMouse.

Hiding the pointer changes nothing about the input itself: MouseX, MouseY, MouseDown and the rest carry on exactly as before. Bring the arrow back with ShowPointer when you open a menu or an options screen where a normal pointer feels right.

The command works in both windowed and full-screen modes. Full-screen modes start with the pointer already hidden for you, and it comes back automatically when the graphics mode is closed, so you only need HidePointer explicitly when you are running windowed or have shown the pointer yourself.

Calling it twice is harmless - the visibility is a simple on/off flag, so one ShowPointer always brings the arrow back no matter how many times you hid it.

See also: ShowPointer, MoveMouse, MouseX, MouseY, Graphics.

Example

; HidePointer Example
; -------------------

Graphics 640,480,0,2
SetBuffer BackBuffer()

; Hide the Windows pointer over our window - a game crosshair is
; drawn in its place. (Windowed modes only; see also ShowPointer.)
HidePointer
hidden=1

While Not KeyDown(1)

    Cls

    ; Space toggles between HidePointer and ShowPointer
    If KeyHit(57) Then
        hidden=1-hidden
        If hidden Then
            HidePointer ; the documented command - hide the pointer
        Else
            ShowPointer
        End If
    End If

    If hidden Then
        ; Our own crosshair replaces the hidden Windows pointer
        Color 255,255,0
        Oval MouseX()-10,MouseY()-10,20,20,False
        Line MouseX()-14,MouseY(),MouseX()+14,MouseY()
        Line MouseX(),MouseY()-14,MouseX(),MouseY()+14
        Color 255,255,255
    End If

    Text 0,0,"Space: toggle HidePointer / ShowPointer   Esc: exit"
    If hidden Then
        Text 0,20,"Pointer hidden - the game draws its own crosshair"
    Else
        Text 0,20,"Windows pointer visible - custom crosshair off"
    End If

    Flip

Wend

End

Index