Inheritance: System.DisposableBase
Exemplo n.º 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;
		}
Exemplo n.º 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;
		}
Exemplo n.º 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;
		}
Exemplo n.º 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();
			}
		}
Exemplo n.º 5
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.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();
			}
		}
Exemplo n.º 6
0
		void device_MouseScroll ( object sender, InputDevice.MouseScrollEventArgs e )
		{
			var handler = Scroll;
			if (handler!=null) {
				handler( sender, new MouseScrollEventArgs(){ WheelDelta = e.WheelDelta } );	
			}
		}
Exemplo n.º 7
0
		void device_MouseMove ( object sender, InputDevice.MouseMoveEventArgs e )
		{
			var handler = Move;
			if (handler!=null) {
				handler( sender, new MouseMoveEventArgs(){ Position = e.Position } );	
			}
		}
Exemplo n.º 8
0
		void device_FormKeyPress ( object sender, InputDevice.KeyPressArgs e )
		{
			var handler = FormKeyPress;
			if (handler!=null) {
				handler( sender, new KeyPressArgs(){ KeyChar = e.KeyChar } );
			}
		}
Exemplo n.º 9
0
		void device_FormKeyUp ( object sender, InputDevice.KeyEventArgs e )
		{
			var handler = FormKeyUp;
			if (handler!=null) {
				handler( sender, new KeyEventArgs(){ Key = (Keys)e.Key } );
			}
		}
Exemplo n.º 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 } );
			}
		}
Exemplo n.º 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();
			}
		}
Exemplo n.º 12
0
		void InputDevice_KeyPress ( object sender, InputDevice.KeyPressArgs e )
		{
			Log.Message("Key press : {0}", e.KeyChar );
		}
Exemplo n.º 13
0
		void InputDevice_FormKeyDown ( object sender, InputDevice.KeyEventArgs e )
		{
			Log.Message("Form key down : {0}", e.Key );
		}
Exemplo n.º 14
0
		void InputDevice_MouseScroll ( object sender, InputDevice.MouseScrollEventArgs e )
		{
			Log.Message("...mouse scroll event : {0}", e.WheelDelta );
			scrollValue += e.WheelDelta;
		}
Exemplo n.º 15
0
		void InputDevice_KeyUp ( object sender, InputDevice.KeyEventArgs e )
		{
			Log.Message("...key up event : {0}", e.Key );
		}