DirectInputEnabled ( )
Parameters
| None. |
Description
|
Reports whether the runtime is reading input through DirectInput. Classic Blitz3D could take keyboard and mouse readings either from ordinary Windows messages or from DirectInput, which gave lower latency and raw, unfiltered key state at the price of playing badly with dialogs and text entry. DirectInputEnabled told you which of the two was currently in charge, and EnableDirectInput switched between them. On the modern runtime this always returns 0, including straight after a call to EnableDirectInput 1. There is no DirectInput layer any more: keyboard and mouse state comes from the window message queue and gamepads come from XInput, so there is nothing for the flag to describe. KeyDown, KeyHit, MouseX and the joystick commands all work exactly the same either way. Treat it as a compatibility read-out. An old options screen that displays the input mode will show "off" forever, which is honest - the mode it is asking about no longer exists. If you want to know what the runtime is actually built on, SystemProperty is the command with real answers. See also: EnableDirectInput, KeyDown, MouseX, JoyType, SystemProperty. |
Example
; DirectInputEnabled Example ; -------------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Ask before touching anything startup=DirectInputEnabled() want=0 While Not KeyDown(1) Cls ; Space asks for DirectInput to be switched on or off If KeyHit(57) Then want=1-want EnableDirectInput want End If ; Live proof that the keyboard and mouse are working regardless Color 255,220,80 Oval MouseX()-8,MouseY()-8,16,16,1 Color 255,255,255 Text 0,0,"Space: ask for DirectInput on/off Move the mouse Esc: exit" Text 0,20,"DirectInputEnabled() = "+DirectInputEnabled() Text 0,40,"At startup it was "+startup+", we last asked for "+want Text 0,60,"Mouse "+MouseX()+","+MouseY()+" Space held: "+KeyDown(57) Text 0,420,"The modern runtime reads the keyboard and mouse from the" Text 0,440,"window message queue and gamepads through XInput, so there is" Text 0,460,"no DirectInput layer and this query always answers 0." Flip Wend End
Index