fn mk_keysym<S, K>(scancode: S,
             keycode: K,
             keymod: Mod) -> sys::SDL_Keysym
where S: Into<Option<Scancode>>,
      K: Into<Option<Keycode>>,
{
    let scancode = scancode.into()
        .map(|sc| unsafe { transmute::<u32, sys::SDL_Scancode>(sc as u32) })
        .unwrap_or(sys::SDL_Scancode::SDL_SCANCODE_UNKNOWN);
    let keycode = keycode.into()
        .map(|kc| kc as sys::SDL_Keycode)
        .unwrap_or(sys::SDLK_UNKNOWN as i32);
    let keymod = keymod.bits() as u16;
    sys::SDL_Keysym {
        scancode: scancode,
        sym: keycode,
        mod_: keymod,
        unused: 0,
    }
}
/// Helper function to make converting scancodes
/// and keycodes to primitive `SDL_Keysym` types.
Helper function to make converting scancodes
and keycodes to primitive `SDL_Keysym` types.
Helper function to make converting scancodes and keycodes to primitive ` SDL_Keysym ` types .
fn mk_keysym<S, K>(scancode: S,
             keycode: K,
             keymod: Mod) -> sys::SDL_Keysym
where S: Into<Option<Scancode>>,
      K: Into<Option<Keycode>>,
{
    let scancode = scancode.into()
        .map(|sc| unsafe { transmute::<u32, sys::SDL_Scancode>(sc as u32) })
        .unwrap_or(sys::SDL_Scancode::SDL_SCANCODE_UNKNOWN);
    let keycode = keycode.into()
        .map(|kc| kc as sys::SDL_Keycode)
        .unwrap_or(sys::SDLK_UNKNOWN as i32);
    let keymod = keymod.bits() as u16;
    sys::SDL_Keysym {
        scancode: scancode,
        sym: keycode,
        mod_: keymod,
        unused: 0,
    }
}
fn mk_keysym < S , K > ( scancode : S , keycode : K , keymod : Mod ) -> sys :: SDL_Keysym where S : Into < Option < Scancode > > , K : Into < Option < Keycode > > , { let scancode = scancode . into ( ) . map ( | sc | unsafe { transmute :: < u32 , sys :: SDL_Scancode > ( sc as u32 ) } ) . unwrap_or ( sys :: SDL_Scancode :: SDL_SCANCODE_UNKNOWN ) ; let keycode = keycode . into ( ) . map ( | kc | kc as sys :: SDL_Keycode ) . unwrap_or ( sys :: SDLK_UNKNOWN as i32 ) ; let keymod = keymod . bits ( ) as u16 ; sys :: SDL_Keysym { scancode : scancode , sym : keycode , mod_ : keymod , unused : 0 , } }
Helper function to make converting scancodes
and keycodes to primitive `SDL_Keysym` types.
Helper function to make converting scancodes and keycodes to primitive ` SDL_Keysym ` types .
scancode
S
keycode
K
keymod
Mod
scancode
S
keycode
K
keymod
Mod