程式語言 - FreeBASIC - Simple DirectMedia Layer (SDL) v1.2 - Fill Color



參考資訊:
https://www.freebasic.net/
https://sourceforge.net/projects/fbc/files/
https://www.freebasic.net/wiki/ProPgPointers
https://www.freebasic.net/forum/viewtopic.php?t=23216
https://www.freebasic.net/forum/viewtopic.php?f=14&t=21725

main.bas

#include "SDL.bi"

dim rt as SDL_Rect 
dim video as SDL_Surface ptr
 
SDL_Init(SDL_INIT_VIDEO)
video = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE)
SDL_FillRect(video, @(*video).clip_rect, SDL_MapRGB((*video).format, &hff, &h00, &h00))

rt.x = 50
rt.y = 50
rt.w = 30
rt.h = 30
SDL_FillRect(video, @rt, SDL_MapRGB((*video).format, &h00, &hff, &h00))

rt.x = 100
rt.y = 100
rt.w = 50
rt.h = 100
SDL_FillRect(video, @rt, SDL_MapRGB((*video).format, &h00, &h00, &hff))

SDL_Flip(video)
SDL_Delay(3000)
SDL_Quit

編譯、執行

$ fbc main.bas -i /opt/fbc/include/freebasic/SDL
$ ./main

完成