/// private メソッド ///--------------------------------------------------------------------------- /// パッドの入力情報を格納 private void setInputState(ref InputGamePadState inputState, GamePadButtons gamePadButtons) { inputState = 0; /// 方向キー入力 if ((gamePadButtons & GamePadButtons.Up) != 0) { inputState |= InputGamePadState.Up; } if ((gamePadButtons & GamePadButtons.Down) != 0) { inputState |= InputGamePadState.Down; } if ((gamePadButtons & GamePadButtons.Left) != 0) { inputState |= InputGamePadState.Left; } if ((gamePadButtons & GamePadButtons.Right) != 0) { inputState |= InputGamePadState.Right; } /// ボタン入力 if ((gamePadButtons & GamePadButtons.Square) != 0) { inputState |= InputGamePadState.Square; } if ((gamePadButtons & GamePadButtons.Triangle) != 0) { inputState |= InputGamePadState.Triangle; } if ((gamePadButtons & GamePadButtons.Circle) != 0) { inputState |= InputGamePadState.Circle; } if ((gamePadButtons & GamePadButtons.Cross) != 0) { inputState |= InputGamePadState.Cross; } if ((gamePadButtons & GamePadButtons.Start) != 0) { inputState |= InputGamePadState.Start; } if ((gamePadButtons & GamePadButtons.Select) != 0) { inputState |= InputGamePadState.Select; } if ((gamePadButtons & GamePadButtons.L) != 0) { inputState |= InputGamePadState.L; } if ((gamePadButtons & GamePadButtons.R) != 0) { inputState |= InputGamePadState.R; } }
/// 入力情報のクリア public void Clear() { inputTrig = 0; inputScan = 0; inputFree = 0; inputRepeat = 0; inputRepeatTmp = 0; repeatStartWaitFrameCnt = 0; repeatEveryWaitFrameCnt = 0; }
/// 繰り返し入力情報を更新 private void updateInputRepeat() { inputRepeat = 0; /// 連続入力中 ///--------------------------------------------------- if (inputRepeatTmp != 0) { /// 開始時の入力が一定時間維持された連続入力とみなす if (inputRepeatTmp == inputScan) { if (repeatStartWaitFrameCnt >= repeatStartWaitFrameMax) { /// 連続入力が有効になった際の有効待機 repeatEveryWaitFrameCnt++; if (repeatEveryWaitFrameCnt >= repeatEveryWaitFrameMax) { inputRepeat = inputRepeatTmp; repeatEveryWaitFrameCnt = 0; } } else { repeatStartWaitFrameCnt++; } } /// 開始時の入力と異なったら連続入力を解除 else { inputRepeatTmp = 0; } } /// 未連続入力中 ///--------------------------------------------------- if (inputRepeatTmp == 0) { /// トリガの発生時から連続入力の判定開始 /// 最初の一回は入力として扱う if (inputTrig != 0 || inputFree != 0) { inputRepeat = inputScan; inputRepeatTmp = inputScan; repeatStartWaitFrameCnt = 0; repeatEveryWaitFrameCnt = repeatEveryWaitFrameMax; } } }
/// 繰り返し入力情報を更新 private void updateInputRepeat() { inputRepeat = 0; /// 連続入力中 ///--------------------------------------------------- if( inputRepeatTmp != 0 ){ /// 開始時の入力が一定時間維持された連続入力とみなす if( inputRepeatTmp == inputScan ){ if( repeatStartWaitFrameCnt >= repeatStartWaitFrameMax ){ /// 連続入力が有効になった際の有効待機 repeatEveryWaitFrameCnt ++; if( repeatEveryWaitFrameCnt >= repeatEveryWaitFrameMax ){ inputRepeat = inputRepeatTmp; repeatEveryWaitFrameCnt = 0; } } else{ repeatStartWaitFrameCnt ++; } } /// 開始時の入力と異なったら連続入力を解除 else{ inputRepeatTmp = 0; } } /// 未連続入力中 ///--------------------------------------------------- if( inputRepeatTmp == 0 ){ /// トリガの発生時から連続入力の判定開始 /// 最初の一回は入力として扱う if( inputTrig != 0 || inputFree != 0 ){ inputRepeat = inputScan; inputRepeatTmp = inputScan; repeatStartWaitFrameCnt = 0; repeatEveryWaitFrameCnt = repeatEveryWaitFrameMax; } } }
/// private メソッド ///--------------------------------------------------------------------------- /// パッドの入力情報を格納 private void setInputState( ref InputGamePadState inputState, GamePadButtons gamePadButtons ) { inputState = 0; /// 方向キー入力 if( (gamePadButtons & GamePadButtons.Up) != 0 ){ inputState |= InputGamePadState.Up; } if( (gamePadButtons & GamePadButtons.Down) != 0 ){ inputState |= InputGamePadState.Down; } if( (gamePadButtons & GamePadButtons.Left) != 0 ){ inputState |= InputGamePadState.Left; } if( (gamePadButtons & GamePadButtons.Right) != 0 ){ inputState |= InputGamePadState.Right; } /// ボタン入力 if( (gamePadButtons & GamePadButtons.Square) != 0 ){ inputState |= InputGamePadState.Square; } if( (gamePadButtons & GamePadButtons.Triangle) != 0 ){ inputState |= InputGamePadState.Triangle; } if( (gamePadButtons & GamePadButtons.Circle) != 0 ){ inputState |= InputGamePadState.Circle; } if( (gamePadButtons & GamePadButtons.Cross) != 0 ){ inputState |= InputGamePadState.Cross; } if( (gamePadButtons & GamePadButtons.Start) != 0 ){ inputState |= InputGamePadState.Start; } if( (gamePadButtons & GamePadButtons.Select) != 0 ){ inputState |= InputGamePadState.Select; } if( (gamePadButtons & GamePadButtons.L) != 0 ){ inputState |= InputGamePadState.L; } if( (gamePadButtons & GamePadButtons.R) != 0 ){ inputState |= InputGamePadState.R; } }