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; } } }
private void GetKeyUp() { if (Keyboard.IsKeyUp((Key)_type)) { _state = KEY_STATE.UN_PRESS; } }
public bool GetKeyPress(KEY_TYPE type) { if (GetKeyDown(type)) { _state = KEY_STATE.PRESS; return(true); } return(false); }
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); }
public static void ChangeState(KEY_STATE state) { InputKey.I.State = state; }
private InputKey() { _type = KEY_TYPE.NONE; _state = KEY_STATE.UN_PRESS; }