程式語言 - Free Pascal - Simple DirectMedia Layer (SDL) v1.2 - Load BMP



參考資訊:
https://www.freepascal.org/
https://wiki.lazarus.freepascal.org/FPC_and_SDL
https://sourceforge.net/projects/freepascal/files/

main.pp

program app;
 
uses sdl;
 
var
    bmp : PSDL_Surface;
    screen : PSDL_Surface;
 
begin
    SDL_Init(SDL_INIT_VIDEO);
    screen := SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE);
    bmp := SDL_LoadBMP('main.bmp'); 
    SDL_BlitSurface(bmp, nil, screen, nil);
    SDL_Flip(screen);
    SDL_FreeSurface(bmp);
    SDL_Delay(3000);
    SDL_Quit;
end.

編譯、執行

$ fpc main.pp
$ ./main