module "/pliant/language/context.pli"
module "/pliant/language/unsafe.pli"
module "/pliant/SDL/SDL_keyboard.pli"
constant sdl_library "libSDL.so"
public
gvar Int SDL_NOEVENT := 0
gvar Int SDL_ACTIVEEVENT := 1
gvar Int SDL_KEYDOWN := 2
gvar Int SDL_KEYUP := 3
gvar Int SDL_MOUSEMOTION := 4
gvar Int SDL_MOUSEBUTTONDOWN := 5
gvar Int SDL_MOUSEBUTTONUP := 6
gvar Int SDL_JOYAXISMOTION := 7
gvar Int SDL_JOYBALLMOTION := 8
gvar Int SDL_JOYHATMOTION := 9
gvar Int SDL_JOYBUTTONDOWN := 10
gvar Int SDL_JOYBUTTONUP := 11
gvar Int SDL_QUIT := 12
gvar Int SDL_SYSWMEVENT := 13
gvar Int SDL_EVENT_RESERVEDA := 14
gvar Int SDL_EVENT_RESERVEDB := 15
gvar Int SDL_VIDEORESIZE := 16
gvar Int SDL_VIDEOEXPOSE := 17
gvar Int SDL_EVENT_RESERVED2 := 18
gvar Int SDL_EVENT_RESERVED3 := 19
gvar Int SDL_EVENT_RESERVED4 := 20
gvar Int SDL_EVENT_RESERVED5 := 21
gvar Int SDL_EVENT_RESERVED6 := 22
gvar Int SDL_EVENT_RESERVED7 := 23
gvar Int SDL_USEREVENT := 24
gvar Int NUM_EVENTS := 32
function SDL_EVENTMASK X -> S
arg Int X S
S := 2^X
gvar Int SDL_ACTIVEEVENTMASK := SDL_EVENTMASK:SDL_ACTIVEEVENT
gvar Int SDL_KEYDOWNMASK := SDL_EVENTMASK:SDL_KEYDOWN
gvar Int SDL_KEYUPMASK := SDL_EVENTMASK:SDL_KEYUP
gvar Int SDL_MOUSEMOTIONMASK := SDL_EVENTMASK:SDL_MOUSEMOTION
gvar Int SDL_MOUSEBUTTONDOWNMASK := SDL_EVENTMASK:SDL_MOUSEBUTTONDOWN
gvar Int SDL_MOUSEBUTTONUPMASK := SDL_EVENTMASK:SDL_MOUSEBUTTONUP
gvar Int SDL_MOUSEEVENTMASK := SDL_MOUSEMOTIONMASK .or. SDL_MOUSEBUTTONDOWNMASK .or. SDL_MOUSEBUTTONUPMASK
gvar Int SDL_JOYAXISMOTIONMASK := SDL_EVENTMASK:SDL_JOYAXISMOTION
gvar Int SDL_JOYBALLMOTIONMASK := SDL_EVENTMASK:SDL_JOYBALLMOTION
gvar Int SDL_JOYHATMOTIONMASK := SDL_EVENTMASK:SDL_JOYHATMOTION
gvar Int SDL_JOYBUTTONDOWNMASK := SDL_EVENTMASK:SDL_JOYBUTTONDOWN
gvar Int SDL_JOYBUTTONUPMASK := SDL_EVENTMASK:SDL_JOYBUTTONUP
gvar Int SDL_JOYEVENTMASK := SDL_JOYAXISMOTIONMASK .or. SDL_JOYBALLMOTIONMASK .or. SDL_JOYHATMOTIONMASK .or. SDL_JOYBUTTONDOWNMASK .or. SDL_JOYBUTTONUPMASK
gvar Int VIDEORESIZEMASK := SDL_EVENTMASK:SDL_VIDEORESIZE
gvar Int VIDEOEXPOSEMASK := SDL_EVENTMASK:SDL_VIDEOEXPOSE
gvar Int SDL_QUITMASK := SDL_EVENTMASK:SDL_QUIT
gvar Int SDL_SYSWMEVENTMASK := SDL_EVENTMASK:SDL_SYSWMEVENT
gvar Int SDL_ALLEVENTS := 0FFFFFFFFh
type SDL_ActiveEvent
packed
field uInt8 type
field uInt8 gain
field uInt8 state
field Byte padding0
type SDL_KeyboardEvent
packed
field uInt8 type
field uInt8 which
field uInt8 state
field Byte padding0
field SDL_keysym keysym
type SDL_MouseMotionEvent
packed
field uInt8 type
field uInt8 which
field uInt8 state
field Byte padding0
field uInt16 x y
field Int16 xrel
field Int16 yrel
type SDL_MouseButtonEvent
packed
field uInt8 type
field uInt8 which
field uInt8 button
field uInt8 state
field uInt16 x y
type SDL_JoyAxisEvent
packed
field uInt8 type
field uInt8 which
field uInt8 axis
field Int16 value
type SDL_JoyBallEvent
packed
field uInt8 type
field uInt8 which
field uInt8 ball
field Int16 xrel
field Int16 yrel
type SDL_JoyHatEvent
packed
field uInt8 type
field uInt8 which
field uInt8 hat
field uInt8 value
type SDL_JoyButtonEvent
packed
field uInt8 type
field uInt8 which
field uInt8 button
field uInt8 state
type SDL_ResizeEvent
packed
field uInt8 type
field Int w
field Int h
type SDL_ExposeEvent
field uInt8 type
type SDL_QuitEvent
field uInt8 type
type SDL_UserEvent
field uInt8 type
field Int code
field Address data1
field Address data2
type SDL_Event
packed
field uInt8 type
field (Array Byte 19) event_data
method event active -> active_event
arg SDL_Event event
arg SDL_ActiveEvent active_event
active_event := addressof:event map SDL_ActiveEvent
method event key -> key_event
arg SDL_Event event
arg SDL_KeyboardEvent key_event
key_event := addressof:event map SDL_KeyboardEvent
method event motion -> motion_event
arg SDL_Event event
arg SDL_MouseMotionEvent motion_event
motion_event := addressof:event map SDL_MouseMotionEvent
method event button -> button_event
arg SDL_Event event
arg SDL_MouseButtonEvent button_event
button_event := addressof:event map SDL_MouseButtonEvent
method event jaxis -> jaxis_event
arg SDL_Event event
arg SDL_JoyAxisEvent jaxis_event
jaxis_event := addressof:event map SDL_JoyAxisEvent
method event jball -> jball_event
arg SDL_Event event
arg SDL_JoyBallEvent jball_event
jball_event := addressof:event map SDL_JoyBallEvent
method event jhat -> jhat_event
arg SDL_Event event
arg SDL_JoyHatEvent jhat_event
jhat_event := addressof:event map SDL_JoyHatEvent
method event jbutton -> jbutton_event
arg SDL_Event event
arg SDL_JoyButtonEvent jbutton_event
jbutton_event := addressof:event map SDL_JoyButtonEvent
method event resize -> resize_event
arg SDL_Event event
arg SDL_ResizeEvent resize_event
resize_event := addressof:event map SDL_ResizeEvent
method event expose -> expose_event
arg SDL_Event event
arg SDL_ExposeEvent expose_event
expose_event := addressof:event map SDL_ExposeEvent
method event quit -> quit_event
arg SDL_Event event
arg SDL_QuitEvent quit_event
quit_event := addressof:event map SDL_QuitEvent
method event UserEvent -> user_event
arg SDL_Event event
arg SDL_UserEvent user_event
user_event := addressof:event map SDL_UserEvent
function SDL_PumpEvents
external sdl_library "SDL_PumpEvents"
gvar Int SDL_ADDEVENT := 0
gvar Int SDL_ADDEvent := 1
gvar Int SDL_ADDEvent := 2
function SDL_PeepEvents events numevents action mask -> z
arg Address events
arg Int numevents action z
arg uInt mask
external sdl_library "SDL_PeepEvents"
function SDL_PollEvent event -> z
arg SDL_Event event; arg Int z
external sdl_library "SDL_PollEvent"
function SDL_WaitEvent event -> z
arg SDL_Event event; arg Int z
external sdl_library "SDL_WaitEvent"
function SDL_PushEvent event -> z
arg SDL_Event event; arg Int z
external sdl_library "SDL_PushEvent"