#[repr(C)]pub struct SDL_KeyboardEvent {
pub type: SDL_EventType,
pub reserved: Uint32,
pub timestamp: Uint64,
pub windowID: SDL_WindowID,
pub which: SDL_KeyboardID,
pub scancode: SDL_Scancode,
pub key: SDL_Keycode,
pub mod: SDL_Keymod,
pub raw: Uint16,
pub down: bool,
pub repeat: bool,
}Expand description
Keyboard button event structure (event.key.*)
The key is the base SDL_Keycode generated by pressing the scancode
using the current keyboard layout, applying any options specified in
SDL_HINT_KEYCODE_OPTIONS. You can get the SDL_Keycode corresponding to the
event scancode and modifiers directly from the keyboard layout, bypassing
SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode().
§Availability
This struct is available since SDL 3.2.0.
§See also
Fields§
§type: SDL_EventType§reserved: Uint32§timestamp: Uint64In nanoseconds, populated using SDL_GetTicksNS()
windowID: SDL_WindowIDThe window with keyboard focus, if any
which: SDL_KeyboardIDThe keyboard instance id, or 0 if unknown or virtual
scancode: SDL_ScancodeSDL physical key code
key: SDL_KeycodeSDL virtual key code
mod: SDL_Keymodcurrent key modifiers
raw: Uint16The platform dependent scancode for this event
down: booltrue if the key is pressed
repeat: booltrue if this is a key repeat
Trait Implementations§
Source§impl Clone for SDL_KeyboardEvent
impl Clone for SDL_KeyboardEvent
Source§fn clone(&self) -> SDL_KeyboardEvent
fn clone(&self) -> SDL_KeyboardEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SDL_KeyboardEvent
impl Debug for SDL_KeyboardEvent
Source§impl Default for SDL_KeyboardEvent
impl Default for SDL_KeyboardEvent
Source§fn default() -> SDL_KeyboardEvent
fn default() -> SDL_KeyboardEvent
Returns the “default value” for a type. Read more
Source§impl Hash for SDL_KeyboardEvent
impl Hash for SDL_KeyboardEvent
Source§impl PartialEq for SDL_KeyboardEvent
impl PartialEq for SDL_KeyboardEvent
impl Copy for SDL_KeyboardEvent
impl Eq for SDL_KeyboardEvent
impl StructuralPartialEq for SDL_KeyboardEvent
Auto Trait Implementations§
impl Freeze for SDL_KeyboardEvent
impl RefUnwindSafe for SDL_KeyboardEvent
impl Send for SDL_KeyboardEvent
impl Sync for SDL_KeyboardEvent
impl Unpin for SDL_KeyboardEvent
impl UnwindSafe for SDL_KeyboardEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more