悲劇的是,只能在32位版本下使用,需要max2008或更高版本,如果需要在其他版本下,其實也並非不可,只是會比較麻煩,此外,這種東西找個引擎來做更簡單一些
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
2maxhwnd
=dotnetobject
"system.intptr
"(windows.getmaxhwnd()
asinteger)
keyboarddevice.setcooperativelevel maxhwnd thecooperativelevelflags
keyboarddevice.acquire()
fn timerupdate thesender theevent =(
global boxer,keyboarddevice
ifnot isvalidnode boxer
doboxer
=box()
movestep =1
dxkey
=dotnetclass
"microsoft.directx.directinput.key
"keyboardstate
=keyboarddevice.getcurrentkeyboardstate()
if(keyboardstate.item dxkey.d)
==true
doboxer.pos.x
+=movestep
if(keyboardstate.item dxkey.a)
==true
doboxer.pos.x
-=movestep
if(keyboardstate.item dxkey.w)
==true
doboxer.pos.y
+=movestep
if(keyboardstate.item dxkey.s)
==true
doboxer.pos.y
-=movestep
)dotnettimer
=dotnetobject
"system.timers.timer"30
dotnet.addeventhandler dotnettimer
"elapsed
"timerupdate
dotnettimer.start()
鍵盤控制移動
pathgo 導航模組的預設固定 ip 是 192.168.31.200 預設使用者名為eaibot 預設密碼為 eaibot 開啟乙個終端,執行以下命令,啟動底盤驅動 帶平滑加減速 ssh eaibot 192.168.31.200 roslaunch dashgo driver demo.lau...
OpenGL 鍵盤控制
glut允許我們編寫程式,在裡面加入鍵盤輸入控制,包括了普通鍵,和其他特殊鍵 如f1,up 在這一章裡我們將學習如何去檢測哪個鍵被按下,可以從glut裡得到些什麼資訊,和如何處理鍵盤輸入。處理按鍵訊息,我們必須使用glut通知視窗系統,當某個鍵被按下時,哪個函式將完成所要求的操作。我們同樣是呼叫乙個...
iPhone控制鍵盤
有時候當鍵盤彈出時會把輸入框蓋住,這時候我們就沒法看到自己到底輸入的是什麼了,這時候我們就需要註冊兩個事件,那就是在鍵盤顯示的時候 把輸入框的位置放在可見的地方 當關閉鍵盤時,在將輸入框還原,以下就是解決問題的具體方法,我們只要註冊就可以了 call this method somewhere in...