コード例 #1
0
ファイル: InputForwarder.cs プロジェクト: bryanedds/Xi
 private void DirectionDownRepeat(GameTime gameTime, Direction2D direction, Focusable focusable)
 {
     directionPressedElapsedTime[(int)direction] += (float)gameTime.ElapsedGameTime.TotalSeconds;
     if (directionPressedElapsedTime[(int)direction] <= repeatRate.FirstDelay) return;
     directionPressedElapsedTime2[(int)direction] += (float)gameTime.ElapsedGameTime.TotalSeconds;
     if (directionPressedElapsedTime2[(int)direction] <= repeatRate.RepeatDelay) return;
     directionPressedElapsedTime2[(int)direction] = 0;
     focusable.NotifyDirectionInput(gameTime, InputType.Repeat, direction);
 }
コード例 #2
0
ファイル: InputForwarder.cs プロジェクト: bryanedds/Xi
 private void DirectionInput(GameTime gameTime, Direction2D direction, ButtonState directionButtonState, Focusable focusable)
 {
     if (directionButtonState == ButtonState.Pressed)
     {
         if (isDirectionPressed[(int)direction] != ButtonState.Pressed) focusable.NotifyDirectionInput(gameTime, InputType.ClickDown, direction);
         DirectionDownRepeat(gameTime, direction, focusable);
         focusable.NotifyDirectionInput(gameTime, InputType.Down, direction);
     }
     else if (directionButtonState != ButtonState.Pressed)
     {
         if (isDirectionPressed[(int)direction] == ButtonState.Pressed)
         {
             DirectionUp(direction);
             focusable.NotifyDirectionInput(gameTime, InputType.ClickUp, direction);
         }
         // OPTIMIZATION: this functionality is not worth the speed cost
         //DirectionUpRepeat(gameTime, direction);
         //screen.NotifyDirectionInput(gameTime, InputType.Up, direction);
     }
     isDirectionPressed[(int)direction] = directionButtonState;
 }