Inheritance: System.DisposableBase
Beispiel #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="Game"></param>
		internal Mouse ( Game Game ) : base(Game)
		{
			this.device	=	Game.InputDevice;

			device.MouseScroll += device_MouseScroll;
			device.MouseMove += device_MouseMove;
		}
Beispiel #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="Game"></param>
		internal Touch ( Game game ) : base(game)
		{
			this.device = Game.InputDevice;

			device.TouchGestureTap			+= DeviceOnTouchGestureTap;
			device.TouchGestureDoubleTap	+= DeviceOnTouchGestureDoubleTap;
			device.TouchGestureSecondaryTap += DeviceOnTouchGestureSecondaryTap;
			device.TouchGestureManipulate	+= DeviceOnTouchGestureManipulate;
		}
Beispiel #3
0
		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="Game"></param>
		internal Keyboard ( Game Game ) : base(Game)
		{
			this.device	=	Game.InputDevice;

			device.KeyDown += device_KeyDown;
			device.KeyUp += device_KeyUp;

			device.FormKeyDown += device_FormKeyDown;
			device.FormKeyUp += device_FormKeyUp;
			device.FormKeyPress += device_FormKeyPress;
		}
Beispiel #4
0
		/// <summary>
		/// Handle keys
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void InputDevice_KeyDown ( object sender, InputDevice.KeyEventArgs e )
		{
			if (e.Key == Keys.F5) {
				Reload();
			}

			if (e.Key == Keys.F12) {
				GraphicsDevice.Screenshot();
			}

			if (e.Key == Keys.Escape) {
				Exit();
			}
		}
		/// <summary>
		/// Handle keys for each demo
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void InputDevice_KeyDown ( object sender, InputDevice.KeyEventArgs e )
		{
			if (e.Key == Keys.F1) {
				//DevCon.Show(this);
			}

			if (e.Key == Keys.F2) {
				Parameters.VSyncInterval = (Parameters.VSyncInterval == 0) ? 1 : 0;
			}

			if (e.Key == Keys.F5) {
				Game.Instance.Reload();
			}

			if (e.Key == Keys.F12) {
				GraphicsDevice.Screenshot();
			}

			if (e.Key == Keys.Escape) {
				Exit();
			}
		}
Beispiel #6
0
		void device_MouseScroll ( object sender, InputDevice.MouseScrollEventArgs e )
		{
			var handler = Scroll;
			if (handler!=null) {
				handler( sender, new MouseScrollEventArgs(){ WheelDelta = e.WheelDelta } );	
			}
		}
Beispiel #7
0
		void device_MouseMove ( object sender, InputDevice.MouseMoveEventArgs e )
		{
			var handler = Move;
			if (handler!=null) {
				handler( sender, new MouseMoveEventArgs(){ Position = e.Position } );	
			}
		}
Beispiel #8
0
		void device_FormKeyPress ( object sender, InputDevice.KeyPressArgs e )
		{
			var handler = FormKeyPress;
			if (handler!=null) {
				handler( sender, new KeyPressArgs(){ KeyChar = e.KeyChar } );
			}
		}
Beispiel #9
0
		void device_FormKeyUp ( object sender, InputDevice.KeyEventArgs e )
		{
			var handler = FormKeyUp;
			if (handler!=null) {
				handler( sender, new KeyEventArgs(){ Key = (Keys)e.Key } );
			}
		}
Beispiel #10
0
		void device_KeyUp ( object sender, InputDevice.KeyEventArgs e )
		{
			KeyBind bind;
			if (bindings.TryGetValue( (Keys)e.Key, out bind )) {
				try {
					if (!string.IsNullOrWhiteSpace(bind.KeyUpCommand)) {
						Game.Invoker.Push( bind.KeyUpCommand );
					}
				} catch ( Exception cmdLineEx ) {
					Log.Error("{0}", cmdLineEx.Message );
				}
			}

			var handler = KeyUp;
			if (handler!=null) {
				handler( sender, new KeyEventArgs(){ Key = (Keys)e.Key } );
			}
		}
Beispiel #11
0
		/// <summary>
		/// Handle keys for each demo
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void InputDevice_KeyDown ( object sender, InputDevice.KeyEventArgs e )
		{
			if (e.Key == Keys.F1) {
				//DevCon.Show(this);
			}

			if (e.Key == Keys.F2) {
				Parameters.ToggleVSync();
			}

			if (e.Key == Keys.F5) {
				Reload();
			}

			if (e.Key == Keys.F12) {
				GraphicsDevice.Screenshot();
			}

			if (e.Key == Keys.Escape) {
				Exit();
			}
		}
Beispiel #12
0
		void InputDevice_KeyPress ( object sender, InputDevice.KeyPressArgs e )
		{
			Log.Message("Key press : {0}", e.KeyChar );
		}
Beispiel #13
0
		void InputDevice_FormKeyDown ( object sender, InputDevice.KeyEventArgs e )
		{
			Log.Message("Form key down : {0}", e.Key );
		}
Beispiel #14
0
		void InputDevice_MouseScroll ( object sender, InputDevice.MouseScrollEventArgs e )
		{
			Log.Message("...mouse scroll event : {0}", e.WheelDelta );
			scrollValue += e.WheelDelta;
		}
Beispiel #15
0
		void InputDevice_KeyUp ( object sender, InputDevice.KeyEventArgs e )
		{
			Log.Message("...key up event : {0}", e.Key );
		}