; 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