extern cdecl lib "sdl.dll"
include "sdl.inc"
end extern
SDL_Init SDL_INIT_EVERYTHING
'SDL_SURFACE *image
SDL_SURFACE *screen
'sys hfile 'rwops pointer treated as a handle
@screen=SDL_SetVideoMode 320,240,32,SDL_DOUBLEBUF | SDL_SWSURFACE
'hfile=SDL_RWFromFile "bmp\alienmoon.bmp","rb"
'@Image=SDL_LoadBMP_RW hfile,1
'SDL_UpperBlit @image, 0, @screen, 0
'SDL_Flip @screen
'#recordof SDL_KeyboardEvent
SDL_Event Event
SDL_EnableUNICODE 1
cr=chr(13,10)
tab=chr(9)
do
if SDL_PollEvent(@Event)
'print event.type
select event.type
case SDL_xQUIT : exit do
case SDL_KEYDOWN :
print "Keyboard Event Data:" cr cr+
"type " tab hex(event.key.type) cr+
"which " tab hex(event.key.which) cr+
"state " tab hex(event.key.state) cr+
"scancode" tab hex(event.key.keysym.scancode) cr+
"sym " tab hex(event.key.keysym.sym) cr+
"mod " tab hex(event.key.keysym.mod) cr+
"unicode " tab hex(event.key.keysym.unicode) cr+
""
if event.key.keysym.sym=27 then exit do
case SDL_KEYUP :
case SDL_MOUSEMOTION :
case SDL_MOUSEBUTTONDOWN : 'exit do
case SDL_MOUSEBUTTONUP :
end select
end if
Sdl_Delay(10)
end do
'SDL_FreeSurface @image
SDL_FreeSurface @screen
SDL_Quit