Exemplo n.º 1
0
 public void UpdateValue(ButtonState new_state)
 {
     if (new_state == ButtonState.Pressed)
     {
         if (state == KEY_STATE.KEY_IDLE)
         {
             state = KEY_STATE.KEY_DOWN;
         }
         else if (state == KEY_STATE.KEY_DOWN)
         {
             state = KEY_STATE.KEY_REPEAT;
         }
     }
     if (new_state == ButtonState.Released)
     {
         if (state == KEY_STATE.KEY_REPEAT || state == KEY_STATE.KEY_DOWN)
         {
             state = KEY_STATE.KEY_UP;
         }
         else
         {
             state = KEY_STATE.KEY_IDLE;
         }
     }
 }
Exemplo n.º 2
0
 private void GetKeyUp()
 {
     if (Keyboard.IsKeyUp((Key)_type))
     {
         _state = KEY_STATE.UN_PRESS;
     }
 }
Exemplo n.º 3
0
 public bool GetKeyPress(KEY_TYPE type)
 {
     if (GetKeyDown(type))
     {
         _state = KEY_STATE.PRESS;
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 public bool GetKeyDown(KEY_TYPE type)
 {
     if (_state != KEY_STATE.DOWN)
     {
         if (Keyboard.IsKeyDown((Key)type))
         {
             _type  = type;
             _state = KEY_STATE.DOWN;
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 public static void ChangeState(KEY_STATE state)
 {
     InputKey.I.State = state;
 }
Exemplo n.º 6
0
 private InputKey()
 {
     _type  = KEY_TYPE.NONE;
     _state = KEY_STATE.UN_PRESS;
 }