JoyV# ( [port] )
Parameters
| port (optional) - which joystick to read; 0, the first attached stick (default) |
Description
|
Returns the joystick's second extra slider axis as a float from -1.0 to 1.0. The sibling of JoyU: joystick hardware can carry two slider channels beyond the main axes, and JoyV reads the second. Twin-throttle setups and HOTAS gear are where it earns its keep - one slider per engine, or throttle on U and radar range on V. Like all sliders it holds its position, so it suits "set and leave" values rather than steering. The range runs -1.0 to 1.0 with 0.0 at centre travel, and JoyVDir offers the digital -1/0/1 reading of the same axis. Even sticks with one slider often have nothing wired to the second, and ordinary gamepads have none at all - both cases read 0.0 here forever. Offer JoyV as a luxury binding, with JoyU (and the keyboard) covering everyone else. The modern Blitz3D+ runtime does not implement joystick input yet: JoyType always reports 0 and JoyV always returns 0.0 there, whatever is plugged in - so for now the example shows its no-joystick screen. See also: JoyU, JoyVDir, JoyX, JoyZ, JoyType. |
Example
; JoyV Example ; ------------ Graphics 640,480,0,2 SetBuffer BackBuffer() While Not KeyDown(1) Cls ; JoyV returns the stick's second extra slider as a float from ; -1.0 to 1.0. JoyU reads the first slider - on sticks with a ; single throttle, JoyV often has nothing wired to it. v#=JoyV() u#=JoyU() If JoyType()=0 Then Text 0,0,"Esc: exit" Text 0,60,"No joystick detected - plug in a stick with two sliders." Text 0,80,"With one attached, the right-hand gauge follows the V slider." Else Text 0,0,"Move the second slider Esc: exit" End If ; A gauge for each slider, filling from the centre For g=0 To 1 gx=260+g*90 If g=0 Then value#=u Else value#=v Color 90,90,90 Rect gx,140,50,240,False Line gx,260,gx+50,260 ; centre (value 0) mark Color 255,220,0 If value>0 Then Rect gx+2,260-value*118,46,value*118 If value<0 Then Rect gx+2,261,46,-value*118 Color 255,255,255 If g=0 Then Text gx+25,390,"U",True Else Text gx+25,390,"V",True Next Text 0,20,"JoyV() = "+v Text 0,40,"(JoyU() = "+u+")" Flip Wend End
Index