public void ProcessInput(MouseGuru mouseGuru, KeyboardGuru keyboardGuru) { if (mouseGuru.OverLapped(GetHashCode(), Utils.ToScreen(Bounds), ReponseButtons)) { Action(mouseGuru, keyboardGuru); } }
private void HandleCameraMovement(KeyboardGuru keyboardGuru) { Rectangle newPostion = Utils.CameraPostionRectangle(); float camreaSpeed = Settings.CAMERA_SPEED; if (_inputAdapter.KeyDown(Settings.KEY_FAST_CAMREA)) { camreaSpeed *= 5; } if (_inputAdapter.KeyDown(Settings.KEY_LEFT_MOVEMENT)) { newPostion.X -= camreaSpeed; } if (_inputAdapter.KeyDown(Settings.KEY_RIGHT_MOVEMENT)) { newPostion.X += camreaSpeed; } if (_inputAdapter.KeyDown(Settings.KEY_UP_MOVEMENT)) { newPostion.Y -= camreaSpeed; } if (_inputAdapter.KeyDown(Settings.KEY_DOWN_MOVEMENT)) { newPostion.Y += camreaSpeed; } if (Utils.InsideGameBounds(newPostion)) { SetCameraPostion(newPostion); } }
protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru) { _selector.Clear(); _selector.Add(_gameObject); MoveCameraToSubject(); }
private void HandleSpeedInput(GameTimer timer, KeyboardGuru keyboardGuru) { if (keyboardGuru.GetKeyState(Settings.FASTFOWARD_KEY)) { timer.Speed += Settings.TIME_FACTOR_INTERVAL; } if (keyboardGuru.GetKeyState(Settings.REWIND_KEY)) { timer.Speed += Settings.TIME_FACTOR_INTERVAL * -1; } }
/// <summary> /// Purpose: Moves the camera to the position in the game world relative /// to the MiniMap position /// <param name="mouseGuru"></param> protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru) { Rectangle newPostion = new Rectangle ( Utils.FromBoundsToWorld(mouseGuru.RawPostion, Bounds), Utils.ScreenWidth(), Utils.ScreenHeight() ); newPostion.X = Math.Abs(newPostion.X - Utils.ScreenWidth() / 2); newPostion.Y = Math.Abs(newPostion.Y - Utils.ScreenHeight() / 2); if (Utils.InsideGameBounds(newPostion)) { Utils.SetCamreaPostion(newPostion); } }
public void ProcessInput(MouseGuru mouesGuru, KeyboardGuru keyboardGuru) { foreach (UserInterlfaceContainer i in _userInterfaces) { i.ProcessInput(mouesGuru, keyboardGuru); } // Reason: Newer objects are on top thus should be processed first List <UserInputComponent> list = GetComponents <UserInputComponent>(); list.Reverse(); foreach (UserInputComponent j in list) { j.ProcessInput(mouesGuru, keyboardGuru); } _selector.ExcuteCommands(); }
protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru) { switch (_state) { case BoxSelectState.NotActive: { SetAction(InputAction.Nothing); if (mouseGuru.Down(GetHashCode(), MouseButton.LeftButton)) { _selector.Clear(); // Start Selcting SwitchSelecting(mouseGuru.ScreenPostion); _state = BoxSelectState.Active; } break; } case BoxSelectState.Active: { if (mouseGuru.Up(GetHashCode(), MouseButton.LeftButton)) { // Stop Selecting SwitchSelecting(mouseGuru.ScreenPostion); _state = BoxSelectState.NotActive; } else { _graphics.UpdatePostion(mouseGuru.ScreenPostion); } break; } } }
protected override void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru) { }
protected abstract void Action(MouseGuru mouseGuru, KeyboardGuru keyboardGuru);
public void ProcessInput(MouseGuru mouseGuru, KeyboardGuru keyboardGuru) { _baseUI.ProcessInput(mouseGuru, keyboardGuru); }