module "/pliant/language/context.pli"
module "/pliant/SDL/SDL.pli"
function main -> ret
arg Int ret
var Pointer:SDL_Surface screen src
var SDL_Event event
if (SDL_Init SDL_INIT_VIDEO) < 0
console "Could not Initialize Video!" eol
ret := 1
return
screen :> (SDL_SetVideoMode 640 480 8 SDL_SWSURFACE)
if not (exists screen)
console "Could not set video mode"
ret := 1
SDL_Quit
return
src :> SDL_LoadBMP "SDL.bmp"
SDL_SetColors screen src:format:palette:colors 0 src:format:palette:ncolors
SDL_BlitSurface src null screen null
SDL_UpdateRect screen 0 0 0 0
var CBool done := false
while not done
while (SDL_PollEvent:event > 0)
if event:type = SDL_KEYUP
done := true
SDL_FreeSurface src
SDL_Quit
ret := 0
return
main