Axiom.Platforms.OpenTK.OpenTKInputReader.Capture C# (CSharp) Method

Capture() public method

Capture the current state of input.
public Capture ( ) : void
return void
		public override void Capture()
		{
			if ( mouse == null )
				return;

			NativeWindow window = (NativeWindow)parent[ "nativewindow" ];

			isVisible = window.WindowState != WindowState.Minimized && window.Focused;

			// if we aren't active, wait
			if ( window == null || !isVisible )
			{
				Thread.Sleep( 100 );
				return;
			}

			if ( !useMouseEvents )
			{
				relMouseZ = mouse.Wheel - oldZ;
				oldZ = mouse.Wheel;
				mouseButtons = mouse[ MouseButton.Left ] == true ? MouseButtons.Left : 0;
				mouseButtons = mouse[ MouseButton.Right ] == true ? MouseButtons.Right : 0;
				mouseButtons = mouse[ MouseButton.Middle ] == true ? MouseButtons.Middle : 0;
			}
			if ( ownMouse )
			{
				int mx = System.Windows.Forms.Cursor.Position.X;
				int my = System.Windows.Forms.Cursor.Position.Y;
				relMouseX = mx - center.X;
				relMouseY = my - center.Y;
				mouseX += relMouseX;
				mouseY += relMouseY;

				System.Windows.Forms.Cursor.Position = center;
			}
			else
			{
				int mx = mouse.X;
				int my = mouse.Y;
				relMouseX = mx - oldX;
				relMouseY = my - oldY;
				mouseX += relMouseX;
				mouseY += relMouseY;
				oldX = mx;
				oldY = my;
			}
		}