Thanks for your suggestion, I'll try to get the cvs updates up and running. TortoiseCVS is a good tool to do so, isn't it?
Considering the code example my SDLTest.dpr looks like this:
Code:
program SDLTest;
uses
windows,
SysUtils,
SDL;
var
screen_ : PSDL_Surface;
procedure display_bmp(file_name : PChar);
var
image : PSDL_Surface;
begin
// Load the BMP file into a surface
image := SDL_LoadBMP(file_name);
if (image = nil) then
begin
MessageBox(0, PChar(Format('Couldn''t load %s : %s',
[file_name, SDL_GetError])), 'Error', MB_OK or MB_ICONHAND);
exit;
end;
if (image.format.palette and screen_.format.palette) then
begin
SDL_SetColors(screen_, @image.format.palette.colors[0], 0, image.format.palette.ncolors);
end;
// Blit onto the screen surface
if (SDL_BlitSurface(image, nil, screen_, nil) < 0) then
MessageBox(0, PCHar(Format('BlitSurface error : %s', [SDL_GetError])), 'Error', MB_OK or MB_ICONHAND);
SDL_UpdateRect(screen_, 0, 0, image.w, image.h);
// Free the allocated BMP surface
SDL_FreeSurface(image);
end;
begin
// Initialize the SDL library
if (SDL_Init(SDL_INIT_VIDEO) < 0) then begin
MessageBox(0, PChar(Format('Couldn''t initialize SDL : %s',
[SDL_GetError])), 'Error', MB_OK or MB_ICONHAND);
// Clean up on exit
SDL_Quit;
exit;
end;
(*
* Initialize the display in a 640x480 8-bit palettized mode,
* requesting a software surface
*)
screen_ := SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE or SDL_ANYFORMAT);
display_bmp('./auweia.bmp');
if (screen_ = nil) then begin
MessageBox(0, PChar(Format('Couldn''t set 640x480x8 video mode : %s',
[SDL_GetError])), 'Error', MB_OK or MB_ICONHAND);
SDL_Quit;
exit;
end;
end.
It is taken directly from the "Object Pascal SDL Doc.chm" file and Delphi complains about the following line:
Code:
if (image.format.palette and screen_.format.palette) then
with the message "Operator is not applicable to this operands." (hopefully proper translated from german)
Bookmarks