The tragedy is that it can only be used in a 32-bit version and requires max2008 or a later version. If it needs to be used in another version, it will not be necessary, but it will be troublesome. In addition, this is easier to find an engine.
View code
DOTNET. loadassembly "Microsoft. VisualBasic. dll"
DOTNET. loadassembly "Microsoft. DirectX. directinput. dll"
Global keyboarddevice
Systemguid = dotnetclass "Microsoft. DirectX. directinput. systemguid"
Keyboarddevice = dotnetobject "Microsoft. DirectX. directinput. Device" systemguid. keyboard
Cooperativelevelflags = dotnetclass "Microsoft. DirectX. directinput. cooperativelevelflags"
Thecooperativelevelflags = DOTNET. compareenums cooperativelevelflags. Background cooperativelevelflags. nonexclusive 2
Maxhwnd = dotnetobject "system. intptr" (Windows. getmaxhwnd () as integer)
Keyboarddevice. setcooperativelevel maxhwnd thecooperativelevelflags
Keyboarddevice. Acquire ()
FN timerupdate thesender theevent =
(
Global boxer, keyboarddevice
If not isvalidnode boxer do boxer = Box ()
Movestep = 1
Dxkey = dotnetclass "Microsoft. DirectX. directinput. Key"
Keyboardstate = keyboarddevice. getcurrentkeyboardstate ()
If (keyboardstate. Item dxkey. d) = true do boxer. Pos. x + = movestep
If (keyboardstate. Item dxkey. a) = true do boxer. Pos. X-= movestep
If (keyboardstate. Item dxkey. W) = true do boxer. Pos. Y + = movestep
If (keyboardstate. Item dxkey. S) = true do boxer. Pos. Y-= movestep
)
Dotnettimer = dotnetobject "system. Timers. Timer" 30
DOTNET. addeventhandler dotnettimer "elapsed" timerupdate
Dotnettimer. Start ()