/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="useKeyboard"></param> /// <param name="useMouse"></param> /// <param name="useGamepad"></param> /// <param name="ownMouse"></param> public override void Initialize( Axiom.Graphics.RenderWindow parent, bool useKeyboard, bool useMouse, bool useGamepad, bool ownMouse ) { Contract.Requires( parent.GetType().Name == "OpenTKWindow", "RenderSystem", "OpenTK InputManager requires OpenTK OpenGL Renderer." ); this.parent = parent; INativeWindow window = (INativeWindow)parent[ "nativewindow" ]; if ( window == null ) return; keyboard = window.InputDriver.Keyboard[ 0 ]; //keyboard = window.Keyboard; if ( useMouse ) { mouse = window.InputDriver.Mouse[ 0 ]; if ( ownMouse ) { this.ownMouse = true; System.Windows.Forms.Cursor.Hide(); } // mouse starts out in the center of the window center.X = parent.Width / 2; center.Y = parent.Height / 2; if ( ownMouse ) { center = window.PointToScreen( center ); System.Windows.Forms.Cursor.Position = center; mouseX = oldX = center.X; mouseY = oldY = center.Y; } else { System.Drawing.Point center2 = window.PointToScreen( center ); System.Windows.Forms.Cursor.Position = center2; mouseX = oldX = center.X; mouseY = oldY = center.Y; } } }