Checks if D-pad direction currently pressed (held down).
Takes controller (controller handle from inpCreateController, positive integer), direction (D-pad direction constant: 0=up, 1=down, 2=left, 3=right).
Returns 1 if direction pressed, 0 if released or error.
Input
Parameters & Returns
Parameters
controllerInt
directionInt
Returns
Int
Quick Summary
Checks if D-pad direction currently pressed (held down).
Takes controller (controller handle from inpCreateController, positive integer), direction (D-pad direction constant: 0=up, 1=down, 2=left, 3=right).
Returns 1 if direction pressed, 0 if released or error.
Technical Exegesis...
Checks if D-pad direction currently pressed (held down). Takes controller (controller handle from inpCreateController, positive integer), direction (D-pad direction constant: 0=up, 1=down, 2=left, 3=right). Returns 1 if direction pressed, 0 if released or error. Queries current D-pad state, returns true every frame while direction held.
Checks if D-pad direction currently pressed (held down). Takes controller (controller handle from inpCreateController, positive integer), direction (D-pad direction constant: 0=up, 1=down, 2=left, 3=right). Returns 1 if direction pressed, 0 if released or error. Queries current D-pad state, returns true every frame while direction held.
D-pad state: 1=direction pressed this frame (held down), 0=direction not pressed (released or never pressed), continuous detection (returns 1 every frame while held), different from inpControllerDPadHit (which returns 1 only on first press frame).
Direction values: 0=up (north), 1=down (south), 2=left (west), 3=right (east), diagonal presses may activate two directions (up+left returns 1 for both up and left), direction values 0-3 only (other values return 0 or error).
Use cases: (1) Continuous movement (hold D-pad to move character continuously), (2) Menu scrolling (hold direction to scroll through options), (3) Weapon/item cycling (hold direction to rapid-cycle through inventory), (4) Camera control (hold D-pad to pan camera), (5) Multi-direction detection (check multiple directions for diagonal movement).
Common patterns: movement = If inpControllerDPadDown(controller%, 0) Then moveUp(); diagonal = If inpControllerDPadDown(controller%, 0) AND inpControllerDPadDown(controller%, 2) Then move up-left; hold scroll = If inpControllerDPadDown(controller%, 1) Then scrollTimer#=scrollTimer#+deltaTime#: If scrollTimer#>scrollDelay# Then scroll down: scrollTimer#=0.0.
D-pad vs analog stick: D-pad provides 8-way directional input (4 cardinal + 4 diagonal combinations), returns binary pressed/not pressed (no analog pressure), use for menus and discrete movement (grid-based games), analog stick provides 360-degree continuous input (see inpLeftStickHitX/Y for analog), use stick for smooth movement (3D games, racing).
DPadDown vs DPadHit: inpControllerDPadDown returns 1 every frame while held (continuous detection for sustained movement), inpControllerDPadHit returns 1 only on first press frame (single-shot detection for menu navigation), use DPadDown for character movement/camera panning (hold mechanics), use DPadHit for menu cursor movement/item selection (press-once mechanics).
Performance: fast query (~0.001ms, simple state lookup), safe for per-frame calls (intended usage pattern), no controller update required (reads cached state from last inpUpdateController).
Controller state: requires inpUpdateController called each frame (updates D-pad state from hardware), reads from cached controller state (no direct hardware access), D-pad state from previous update (call inpUpdateController before querying).
Return values: 1 if direction pressed (held down this frame), 0 if direction released (not pressed), 0 on error (invalid controller handle or direction ID).
Validation: returns 0 for invalid controller handle (prints error if handle out of range), returns 0 for invalid direction (direction not 0-3), check inpIsControllerConnected before use (avoid querying disconnected controllers).
Related: inpControllerDPadHit detects single press (first frame only), inpLeftStickHitX/Y read analog stick for smooth movement, inpUpdateController updates controller state, inpCreateController creates controller handle.