/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseDown" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param> protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (this.input != null) { if (e.Button == MouseButtons.Left) { this.input.MouseState.LeftButton = WaveEngine.Common.Input.ButtonState.Pressed; } else if (e.Button == MouseButtons.Middle) { this.input.MouseState.MiddleButton = WaveEngine.Common.Input.ButtonState.Pressed; } else if (e.Button == MouseButtons.Right) { this.input.MouseState.RightButton = WaveEngine.Common.Input.ButtonState.Pressed; } } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } this.Focus(); }
/// <summary> /// Called when [motion notify event]. /// </summary> /// <param name="evnt">The evnt.</param> /// <returns></returns> protected override bool OnMotionNotifyEvent(EventMotion evnt) { if (input != null) { this.input.MouseState.X = (int)evnt.X; this.input.MouseState.Y = (int)evnt.Y; this.input.TouchPanelState = new TouchPanelState() { IsConnected = true }; if (this.input.MouseState.LeftButton == WaveEngine.Common.Input.ButtonState.Pressed) { this.input.TouchPanelState.AddTouchLocation(0, TouchLocationState.Pressed, (int)evnt.X, (int)evnt.Y); } } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } return(base.OnMotionNotifyEvent(evnt)); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseMove" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (input != null) { this.input.MouseState.X = e.X; this.input.MouseState.Y = e.Y; this.input.TouchPanelState = new TouchPanelState() { IsConnected = true }; if (this.input.MouseState.LeftButton == WaveEngine.Common.Input.ButtonState.Pressed) { this.input.TouchPanelState.AddTouchLocation(0, TouchLocationState.Pressed, e.X, e.Y); } } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseMove" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (input != null) { this.input.MouseState.X = e.X; this.input.MouseState.Y = e.Y; } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } }
/// <summary> /// Called when [motion notify event]. /// </summary> /// <param name="evnt">The evnt.</param> /// <returns></returns> protected override bool OnMotionNotifyEvent(EventMotion evnt) { if (input != null) { this.input.MouseState.X = (int)evnt.X; this.input.MouseState.Y = (int)evnt.Y; } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } return(base.OnMotionNotifyEvent(evnt)); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.KeyDown" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.KeyEventArgs" /> that contains the event data.</param> protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (input == null) { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } else { return; } } #region Key mapping switch (e.KeyCode) { case System.Windows.Forms.Keys.A: this.input.KeyboardState.A = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.B: this.input.KeyboardState.B = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Back: this.input.KeyboardState.Back = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.C: this.input.KeyboardState.C = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.CapsLock: this.input.KeyboardState.CapsLock = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Crsel: this.input.KeyboardState.Crsel = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D: this.input.KeyboardState.D = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D0: this.input.KeyboardState.D0 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D1: this.input.KeyboardState.D1 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D2: this.input.KeyboardState.D2 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D3: this.input.KeyboardState.D3 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D4: this.input.KeyboardState.D4 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D5: this.input.KeyboardState.D5 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D6: this.input.KeyboardState.D6 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D7: this.input.KeyboardState.D7 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D8: this.input.KeyboardState.D8 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.D9: this.input.KeyboardState.D9 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Delete: this.input.KeyboardState.Delete = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Down: this.input.KeyboardState.Down = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.E: this.input.KeyboardState.E = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Enter: this.input.KeyboardState.Enter = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Escape: this.input.KeyboardState.Escape = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Execute: this.input.KeyboardState.Execute = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F: this.input.KeyboardState.F = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F1: this.input.KeyboardState.F = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F10: this.input.KeyboardState.F10 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F11: this.input.KeyboardState.F11 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F12: this.input.KeyboardState.F12 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F2: this.input.KeyboardState.F2 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F3: this.input.KeyboardState.F3 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F4: this.input.KeyboardState.F4 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F5: this.input.KeyboardState.F5 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F6: this.input.KeyboardState.F6 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F7: this.input.KeyboardState.F7 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F8: this.input.KeyboardState.F8 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.F9: this.input.KeyboardState.F9 = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.G: this.input.KeyboardState.G = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.H: this.input.KeyboardState.H = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.I: this.input.KeyboardState.I = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.J: this.input.KeyboardState.J = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.K: this.input.KeyboardState.K = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.L: this.input.KeyboardState.L = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Left: this.input.KeyboardState.Left = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.LMenu: this.input.KeyboardState.LeftAlt = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.LControlKey: this.input.KeyboardState.LeftControl = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.LShiftKey: this.input.KeyboardState.LeftShift = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.LWin: this.input.KeyboardState.LeftWindows = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.M: this.input.KeyboardState.M = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.N: this.input.KeyboardState.N = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.O: this.input.KeyboardState.O = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.P: this.input.KeyboardState.P = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Q: this.input.KeyboardState.Q = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.R: this.input.KeyboardState.R = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Right: this.input.KeyboardState.Right = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.RMenu: this.input.KeyboardState.RightAlt = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.RControlKey: this.input.KeyboardState.RightControl = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.RShiftKey: this.input.KeyboardState.RightShift = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.RWin: this.input.KeyboardState.RightWindows = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.S: this.input.KeyboardState.S = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Space: this.input.KeyboardState.Space = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Subtract: this.input.KeyboardState.Subtract = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.T: this.input.KeyboardState.T = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Tab: this.input.KeyboardState.Tab = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.U: this.input.KeyboardState.U = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Up: this.input.KeyboardState.Up = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.V: this.input.KeyboardState.V = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.W: this.input.KeyboardState.W = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.X: this.input.KeyboardState.X = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Y: this.input.KeyboardState.Y = WaveEngine.Common.Input.ButtonState.Pressed; break; case System.Windows.Forms.Keys.Z: this.input.KeyboardState.Z = WaveEngine.Common.Input.ButtonState.Pressed; break; #endregion } #endregion }
/// <summary> /// Called when [motion notify event]. /// </summary> /// <param name="evnt">The evnt.</param> /// <returns></returns> protected override bool OnMotionNotifyEvent(EventMotion evnt) { if (input != null) { this.input.MouseState.X = (int)evnt.X; this.input.MouseState.Y = (int)evnt.Y; } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } return base.OnMotionNotifyEvent(evnt); }
/// <summary> /// Called when [motion notify event]. /// </summary> /// <param name="evnt">The evnt.</param> /// <returns></returns> protected override bool OnMotionNotifyEvent(EventMotion evnt) { if (input != null) { this.input.MouseState.X = (int)evnt.X; this.input.MouseState.Y = (int)evnt.Y; this.input.TouchPanelState = new TouchPanelState() { IsConnected = true }; if (this.input.MouseState.LeftButton == WaveEngine.Common.Input.ButtonState.Pressed) { this.input.TouchPanelState.AddTouchLocation(0, TouchLocationState.Pressed, (int)evnt.X, (int)evnt.Y); } } else { this.input = WaveServices.Input; if (this.input != null) { this.input.IsEnabled = false; } } return base.OnMotionNotifyEvent(evnt); }