Пример #1
0
 private void UpdateButtonState(WiiRemoteButton wiiRemoteButton, bool newState)
 {
     if (newState)
     {
         if (buttonStates[wiiRemoteButton] == WiiRemoteButtonState.NONE || buttonStates[wiiRemoteButton] == WiiRemoteButtonState.UP)
         {
             buttonStates[wiiRemoteButton] = WiiRemoteButtonState.DOWN;
         }
         else if (buttonStates[wiiRemoteButton] == WiiRemoteButtonState.DOWN)
         {
             buttonStates[wiiRemoteButton] = WiiRemoteButtonState.HOLD;
         }
     }
     else
     {
         if (buttonStates[wiiRemoteButton] == WiiRemoteButtonState.DOWN || buttonStates[wiiRemoteButton] == WiiRemoteButtonState.HOLD)
         {
             buttonStates[wiiRemoteButton] = WiiRemoteButtonState.UP;
         }
         else if (buttonStates[wiiRemoteButton] == WiiRemoteButtonState.UP)
         {
             buttonStates[wiiRemoteButton] = WiiRemoteButtonState.NONE;
         }
     }
 }
Пример #2
0
 public bool GetButton(WiiRemoteButton wiiRemoteButton, WiiRemoteButtonState wiiRemoteButtonState)
 {
     if (buttonStates[wiiRemoteButton] == wiiRemoteButtonState)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Returns true if the given button is pressed down, else false.
 /// </summary>
 /// <param name="wiiRemoteButton">WiiRemoteButton</param>
 /// <returns>true if the given button is pressed down, else false</returns>
 public bool GetWiimoteButtonDown(WiiRemoteButton wiiRemoteButton)
 {
     return(wiiRemote.GetButton(wiiRemoteButton, WiiRemoteButtonState.DOWN));
 }
 /// <summary>
 /// Returns true if the given button is hold down, else false.
 /// </summary>
 /// <param name="wiiRemoteButton">WiiRemoteButton</param>
 /// <returns>true if the given button is hold down, else false</returns>
 public bool GetWiimoteButtonHold(WiiRemoteButton wiiRemoteButton)
 {
     return(wiiRemote.GetButton(wiiRemoteButton, WiiRemoteButtonState.HOLD));
 }
 /// <summary>
 /// Returns true if the given button is released, else false.
 /// </summary>
 /// <param name="wiiRemoteButton">WiiRemoteButton</param>
 /// <returns>true if the given button is released, else false</returns>
 public bool GetWiimoteButtonUp(WiiRemoteButton wiiRemoteButton)
 {
     return(wiiRemote.GetButton(wiiRemoteButton, WiiRemoteButtonState.UP));
 }