Checks if mouse button currently pressed (held down).
Takes vmButtonCode (mouse button code: 0=left, 1=right, 2=middle).
Returns 1 if button pressed, 0 if released.
Input
Parameters & Returns
Parameters
vmButtonCodeInt
Returns
Int
Quick Summary
Checks if mouse button currently pressed (held down).
Takes vmButtonCode (mouse button code: 0=left, 1=right, 2=middle).
Returns 1 if button pressed, 0 if released.
Technical Exegesis...
Checks if mouse button currently pressed (held down). Takes vmButtonCode (mouse button code: 0=left, 1=right, 2=middle). Returns 1 if button pressed, 0 if released. Queries current mouse button state, returns true every frame while button held.
Button state: 1=button pressed this frame (held down), 0=button not pressed (released or never pressed), continuous detection (returns 1 every frame while held), different from inpIsMouseHit (which returns 1 only on first press frame).
Checks if mouse button currently pressed (held down). Takes vmButtonCode (mouse button code: 0=left, 1=right, 2=middle). Returns 1 if button pressed, 0 if released. Queries current mouse button state, returns true every frame while button held.
Button state: 1=button pressed this frame (held down), 0=button not pressed (released or never pressed), continuous detection (returns 1 every frame while held), different from inpIsMouseHit (which returns 1 only on first press frame).
Button codes: 0=left button (primary, most common for selection/shooting), 1=right button (secondary, context menus/aim), 2=middle button (scroll wheel click, less common), button codes 0-2 only (additional buttons not supported by default).
Use cases: (1) Continuous shooting (hold left button for auto-fire), (2) Object dragging (hold left button to drag object continuously), (3) Camera rotation (hold right button to rotate camera with mouse movement), (4) Zoom control (hold middle button for smooth zoom), (5) Hold-to-charge mechanics (hold button to charge attack/shot).
Common patterns: auto-fire = If inpIsMouseDown(0) Then fire bullet; drag object = If inpIsMouseDown(0) Then objectX#=objectX#+inpGetMouseXSpeed(): objectY#=objectY#+inpGetMouseYSpeed(); camera rotate = If inpIsMouseDown(1) Then cameraYaw#=cameraYaw#+inpGetMouseXSpeed()*0.1; charge = If inpIsMouseDown(0) Then chargeTime#=chargeTime#+deltaTime#.
MouseDown vs MouseHit: inpIsMouseDown returns 1 every frame while held (continuous detection, use for auto-fire/dragging/camera control), inpIsMouseHit returns 1 only on first press frame (single-shot detection, use for single shots/UI clicks/placement), use MouseDown for sustained actions (continuous shooting, object dragging), use MouseHit for discrete actions (UI button clicks, single shots, object placement).
Object dragging: typical drag pattern = If inpIsMouseHit(0) Then start drag (record initial position), If inpIsMouseDown(0) Then update drag (move object with mouse), If Not inpIsMouseDown(0) AND wasDragging Then end drag (release object).
Camera control: hold right button to rotate camera, pattern = If inpIsMouseDown(1) Then yaw#=yaw#+inpGetMouseXSpeed()*sensitivity#: pitch#=pitch#-inpGetMouseYSpeed()*sensitivity#, allows continuous smooth rotation while button held.
Charge mechanics: hold button to charge attack, pattern = If inpIsMouseDown(0) Then charge#=charge#+deltaTime#: If charge#>maxCharge# Then charge#=maxCharge#, If Not inpIsMouseDown(0) AND charge#>0.0 Then fire charged shot: charge#=0.0.
Performance: very fast query (~0.0001ms, simple state lookup), safe for per-frame calls (negligible overhead), no polling required (system tracks button states automatically).
Button codes validation: codes 0-2 valid (left, right, middle), invalid codes return 0 (no error, just false), left button (0) most common (primary interaction button).
Return values: 1 if button pressed (held down this frame), 0 if button released (not pressed), 0 on error (invalid button code, out of range).