public static bool GetActionHeld(PlayerIndex player, ActionTypes action) { //if (GetActionDown(player, action)) // pressDic[player] |= action; // bool b = GamePad.GetState(player).IsButtonDown(InputMapping.GetMappedButton(action)) || (Keyboard.GetState().IsKeyDown(InputMapping.GetMappedKey(action)) && player == keyboardPlayerIndex);//(pressDic[player] & action) > 0; // //if (GetActionUp(player, action)) // pressDic[player] &= ~action; return(b); }
public static bool GetActionUp(PlayerIndex player, ActionTypes action) { GamePadState currentGState = GamePad.GetState(player); KeyboardState currentKState = Keyboard.GetState(); bool n = currentGState.IsButtonUp(InputMapping.GetMappedButton(action)) || (currentKState.IsKeyUp(InputMapping.GetMappedKey(action)) && player == keyboardPlayerIndex); bool o = oldGState[player].IsButtonDown(InputMapping.GetMappedButton(action)) || (oldKState.IsKeyDown(InputMapping.GetMappedKey(action)) && player == keyboardPlayerIndex); oldGState[player] = currentGState; oldKState = currentKState; return(n && o); }