public override void Update(GameTime gameTime) { m_ChangeInTheRow = false; if (Active) { m_LastValue = m_CurrentValue; if (m_InputManager.KeyPressed(m_Increase.Key) || m_InputManager.ScrollWheelDelta > 0 || m_InputManager.ButtonPressed(eInputButtons.Right)) { m_CurrentValue += m_GrowthValue; if (m_LastValue < 100) { m_Increase.Operation?.Invoke(); m_ChangeInTheRow = true; } } if (m_InputManager.KeyPressed(m_Decrease.Key) || m_InputManager.ScrollWheelDelta < 0) { m_CurrentValue -= m_GrowthValue; if (m_LastValue > 0) { m_Decrease.Operation?.Invoke(); m_ChangeInTheRow = true; } } m_CurrentValue = MathHelper.Clamp(m_CurrentValue, m_Min, m_Max); m_FillRect.Width = m_InnerRect.Width * (int)m_CurrentValue / (int)m_Max; } }
private void menu_Quit(MenuItem i_MenuItem) { if (r_InputManager.KeyPressed(Keys.Enter) || r_InputManager.ButtonPressed(eInputButtons.Left)) { this.Game.Exit(); } }
private void checkIfShootNeeded() { if (m_ShootAvailble && (m_InputManager.KeyPressed(m_Shootingkey) || (m_MouseMode && m_InputManager.ButtonPressed(k_MouseShootingButton)))) { r_ShootingMachine.Shoot(GetPositionForShootiong(), this); } }
private void getInputFromMouse() { if (m_InputManager.ButtonPressed(eInputButtons.Left)) { m_Gun.Shoot(new Vector2(Position.X + (Width / 2), Position.Y)); } if (m_HasDraw) { Position = new Vector2(Position.X + m_InputManager.MousePositionDelta.X, Position.Y); } }
private void checkForInputOperationsInvokes(int i_IndexToInvoke) { if (r_MenuRows[i_IndexToInvoke].IsLoopedItems) { bool isThereAnInvokationInput = false; foreach (MenuItem menuItem in r_MenuRows[i_IndexToInvoke].Items) { if (m_InputManager.KeyPressed(menuItem.Key)) { isThereAnInvokationInput = true; break; } else if (m_InputManager.ButtonPressed(eInputButtons.Right)) { isThereAnInvokationInput = true; break; } } if (isThereAnInvokationInput) { r_MenuRows[i_IndexToInvoke].IncreaseCurrentItem(); r_MenuRows[i_IndexToInvoke].UpdateSelectedColor(); r_MenuRows[i_IndexToInvoke].InvokeCurrentSelected(); } } else { if (r_MenuRows[i_IndexToInvoke].Items.Count == 1 && (m_InputManager.KeyPressed(r_MenuRows[i_IndexToInvoke].GetSelectedKey()) || m_InputManager.ButtonPressed(eInputButtons.Left))) { r_MenuRows[i_IndexToInvoke].InvokeCurrentSelected(); } } }
private bool invokeButtonBindActions() { bool isClicked = false; foreach (KeyValuePair <eInputButtons, Action <MenuItem> > bind in r_ButtonsToActions) { if (r_InputManager.ButtonPressed(bind.Key)) { bind.Value.Invoke(this); isClicked = true; } } return(isClicked); }
private void newShot() { bool keyBoardClickPlayer1 = m_InputManager.KeyPressed(Keys.D9); bool keyBoardClickPlayer2 = m_InputManager.KeyPressed(Keys.D3); bool mouseClick = m_InputManager.ButtonPressed(eInputButtons.Left); if (keyBoardClickPlayer1 || mouseClick) { m_Player1.Shot(); } if (keyBoardClickPlayer2) { m_Player2.Shot(); } }