module "/pliant/language/context.pli" constant sdl_library "libSDL.so" public # Keysym structure # - The scancode is hardware dependent, and should not be used by general # applications. If no hardware scancode is available, it will be 0. # # - The 'unicode' translated character is only available when character # translation is enabled by the SDL_EnableUNICODE() API. If non-zero, # this is a UNICODE character corresponding to the keypress. If the # high 9 bits of the character are 0, then this maps to the equivalent # ASCII character: # char ch; # if ( (keysym.unicode & 0xFF80) == 0 ) { # ch = keysym.unicode & 0x7F; # } else { # An international character.. # } type SDL_keysym packed field uInt8 scancode #hardware specifict scancode field (Array Byte 3) padding0 field Int sym #SDL virtual keysym (see SDL_keysym.pli) field Int mod #Current key modifiers field uInt16 unicode #Tranlated unicode character field (Array Byte 2) padding1 #This is the mask which refers to all hotkey bindings gvar Int SDL_ALL_HOTKEYS := 0FFFFFFFFh # Function prototypes # Enable/Disable UNICODE translation of keyboard input. # This translation has some overhead, so translation defaults off. # If 'enable' is 1, translation is enabled. # If 'enable' is 0, translation is disabled. # If 'enable' is -1, the translation state is not changed. # It returns the previous state of keyboard translation. function SDL_EnableUNICODE enable -> z arg Int enable z external sdl_library "SDL_EnableUNICODE" # Enable/Disable keyboard repeat. Keyboard repeat defaults to off. # 'delay' is the initial delay in ms between the time when a key is # pressed, and keyboard repeat begins. # 'interval' is the time in ms between keyboard repeat events. gvar Int SDL_DEFAULT_REPEAT_DELAY := 500 gvar Int SDL_DEFAULT_REPEAT_INTERVAL := 30 #If 'delay' is set to 0, keyboard repeat is disabled. function SDL_EnableKeyRepeat delay interval -> z arg Int delay interval z external sdl_library "SDL_EnableKeyRepeat" # Get a snapshot of the current state of the keyboard. # Returns an array of keystates, indexed by the SDLK_* syms. # Used: # Uint8 *keystate = SDL_GetKeyState(NULL); # if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed. function SDL_GetKeyState numkeys -> u arg Int numkeys arg uInt u external sdl_library "SDL_GetKeyState" # Get the current key modifier state function SDL_GetModState -> modstate arg uInt modstate external sdl_library "SDL_GetModState" # Set the current key modifier state # This does not change the keyboard state, only the key modifier flags. function SDL_SetModState modstate arg uInt modstate external sdl_library "SDL_SetModState" # Get the name of an SDL virtual keysym function SDL_GetKeyName key -> name arg Int key arg Str name external sdl_library "SDL_GetKeyName"