// Returns whether the specified key is NOT pressed bool KeyboardState::IsKeyUp(Keys_t key) { if(XInputGetKeystroke(&Stroke) == 0) { if((Stroke.ucFlags & (byte)key) != 0) { return true; } return false; } // The keyboard was not connected...bail out. return -1; }
static void keyboard_update(void) { static SDL_keysym keysym; static XKEYBOARD_STROKE keystroke; if( 0 > XInputGetKeystroke(&keystroke) ) return; if (keystroke.ucKeyCode == 0) return; if ( keystroke.ucFlags & XKEYBOARD_KEYUP ) { SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(keystroke,&keysym, 1)); } else { SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(keystroke,&keysym, 0)); } }