Mark Sibly 7 年之前
父节点
当前提交
2f3be1e233
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      bananas/joystick/joystick.monkey2

+ 10 - 0
bananas/joystick/joystick.monkey2

@@ -11,6 +11,15 @@ Class MyWindow Extends Window
 
 	Method New()
 		Super.New( "Joystick test",640,480 )
+		
+		JoystickDevice.JoystickAdded+=Lambda( index:Int )
+			Print "Joystick added: index="+index
+		End
+		
+		JoystickDevice.JoystickRemoved+=Lambda( index:Int )
+			Print "Joystick removed: index="+index
+		End
+		
 	End
 
 	Method OnRender( canvas:Canvas ) Override
@@ -30,6 +39,7 @@ Class MyWindow Extends Window
 			canvas.DrawText( "GUID="+joy.GUID,x,32 )
 			
 			For Local axis:=0 Until 6
+				
 				canvas.DrawText( "Axis "+axis+"="+joy.GetAxis( axis ),x,(axis+3)*16 )
 			Next