internal void Update(float deltaTime, KeyboardState keyboard) { if (keyboard.IsKeyReleased(Keys.D5)) { _model.giveCash(); } }
public override async void Update(TimeSpan time) { base.Update(time); if (KeyboardState.IsKeyReleased(Keys.Enter)) { await ButtonOnClick(); } }
protected override void OnUpdateFrame(FrameEventArgs args) { if (KeyboardState.IsKeyReleased(Keys.V)) { isInvisible = !isInvisible; interval = 0; } if (KeyboardState.IsKeyReleased(Keys.R)) { Console.WriteLine("Reset"); point_count = 0; mouse_click = 0; _vertices_line = new float[500]; _vertice_bezier_count = 0; calculate = 0; interval = 1000; } if (KeyboardState.IsKeyReleased(Keys.W)) { if (n >= 2 && n < 4) { n++; point_count = 0; mouse_click = 0; _vertices_line = new float[500]; _vertice_bezier_count = 0; calculate = 0; Console.WriteLine("Titik kontrol: " + n); } } if (KeyboardState.IsKeyReleased(Keys.S)) { if (n <= 4 && n > 2) { n--; point_count = 0; mouse_click = 0; _vertices_line = new float[500]; _vertice_bezier_count = 0; calculate = 0; Console.WriteLine("Titik kontrol: " + n); } } if (KeyboardState.IsKeyReleased(Keys.D)) { interval += 10; Console.WriteLine("Interval: " + interval); } if (KeyboardState.IsKeyReleased(Keys.A)) { interval -= 10; Console.WriteLine("Interval: " + interval); } base.OnUpdateFrame(args); }
public static void HandleKeys() { if (KeyboardState.IsKeyReleased(openMap)) { if (Program.CurrentState is Play play && play.PlayMode == PlayMode.Roguelike) { Program.CurrentState = new ViewWorld(true); } else if (Program.CurrentState is ViewWorld) { Program.AudioEngine.PlaySound(Program.AudioEngine.CachedSoundFX["closeMap"]); Program.CurrentState = new Play(); } }
protected override void OnUpdateFrame(FrameEventArgs args) { if (play) { Object3D[curr - 1].Rotate(0.0f, -0.1f, 0.0f); } if (KeyboardState.IsKeyReleased(Keys.S)) { play = !play; } SlideShowAnimation(); base.OnUpdateFrame(args); }
/// <summary> /// Update method /// </summary> /// <param name="gameTime"></param> protected override void Update(TimeSpan gameTime) { KeyboardState currentKeyboardState = this.input.KeyboardState; if (currentKeyboardState.IsConnected) { if (currentKeyboardState.IsKeyPressed(Keys.Q) && lastKeyboardState.IsKeyReleased(Keys.Q)) { this.ThrowProjectile(); } if (currentKeyboardState.IsKeyPressed(Keys.A)) { this.revoluteJoint2D.MotorSpeed = 1; } else if (currentKeyboardState.IsKeyPressed(Keys.D)) { this.revoluteJoint2D.MotorSpeed = -1; } else { this.revoluteJoint2D.MotorSpeed = 0; } if (currentKeyboardState.IsKeyPressed(Keys.W)) { this.Force += 10; } else if (currentKeyboardState.IsKeyPressed(Keys.S)) { this.Force -= 10; if (this.Force < 0) { this.Force = 0; } } this.lastKeyboardState = currentKeyboardState; } }
public bool IsKeyReleased(KeyboardState keyboard, MouseState mouse) { return(keys.Exists((key) => keyboard.IsKeyReleased(key)) || mouseEnum.Exists(m => !IsKeyPressed(mouse, m))); }
public bool IsKeyReleased(Key key) { return(_nativeKeyboard.IsKeyReleased((Keys)key)); }
public bool IsKeyReleased(Keys key) { return(state.IsKeyReleased(key)); }
protected override void OnUpdateFrame(FrameEventArgs e) { #if (DEBUG) using (new DisposableStopwatch(MethodBase.GetCurrentMethod().Name, true)) #endif { if (IsFocused) { KeyboardState keyInput = KeyboardState; if (keyInput.IsKeyReleased(Keys.F)) { ToggleFullscreen(); } if (keyInput.IsKeyReleased(Keys.R)) { ToggleStars(); } if (keyInput.IsKeyReleased(Keys.C)) { ToggleCaptureType(); } if (keyInput.IsAnyKeyDown) { if (keyInput.IsKeyDown(Keys.Escape)) { Close(); } if (keyInput.IsKeyDown(Keys.W)) { camera.Position += camera.Front * CAMERA_SPEED * (float)e.Time; // Forward } if (keyInput.IsKeyDown(Keys.S)) { camera.Position -= camera.Front * CAMERA_SPEED * (float)e.Time; // Backwards } if (keyInput.IsKeyDown(Keys.A)) { camera.Position -= camera.Right * CAMERA_SPEED * (float)e.Time; // Left } if (keyInput.IsKeyDown(Keys.D)) { camera.Position += camera.Right * CAMERA_SPEED * (float)e.Time; // Right } if (keyInput.IsKeyDown(Keys.Space)) { camera.Position += camera.Up * CAMERA_SPEED * (float)e.Time; // Up } if (keyInput.IsKeyDown(Keys.LeftShift)) { camera.Position -= camera.Up * CAMERA_SPEED * (float)e.Time; // Down } if (keyInput.IsKeyDown(Keys.E)) { stars.ChangeRotationSpeed(1); } if (keyInput.IsKeyDown(Keys.T)) { stars.ChangeRotationSpeed(-1); } } // Apply the camera pitch and yaw (we clamp the pitch in the camera class) camera.Yaw += (MouseState.X - MouseState.PreviousX) * MOUSE_SENSITIVITY; camera.Pitch -= (MouseState.Y - MouseState.PreviousY) * MOUSE_SENSITIVITY; // reversed since y-coordinates range from bottom to top } base.OnUpdateFrame(e); } }
public bool IsKeyReleased(MKeys key) { return(_keyboardState.IsKeyReleased((Keys)key)); }
private void SlideShowAnimation() { // this whole part is transition animation if (KeyboardState.IsKeyReleased(Keys.A) && slide_right == false) { if (curr <= 1) { return; } Console.WriteLine(Keys.A); slide_left = true; --curr; } if (KeyboardState.IsKeyReleased(Keys.D) && slide_left == false) { if (curr >= 3) { return; } Console.WriteLine(Keys.D); slide_right = true; ++curr; } if (!slide_left && !slide_right) { return; } // transition slide right if (slide_right == true) { foreach (var i in Object3D) { i.Translate(-0.1f, 0.0f, 0.0f); } for (int i = 0; i < 3; ++i) { Obj[i].Translate(-0.2f, 0.0f, 0.0f); } ++counter; } // transition slide left if (slide_left == true) { foreach (var i in Object3D) { i.Translate(0.1f, 0.0f, 0.0f); } for (int i = 0; i < 3; ++i) { Obj[i].Translate(0.2f, 0.0f, 0.0f); } ++counter; } // reset function for animation if (counter >= max_count) { counter = 0; slide_left = false; slide_right = false; } }