[fpc-pascal]Weird problem
James Mills
prologic at comcen.com.au
Sun Nov 24 04:41:25 CET 2002
Hi,
Sorry to bother you folks, with something that's probably very simple.
But, the code attached does not work, it will not load the splash.bmp
for some strange reason.
However, if I copy the code in the procedure displaySplash in gfx.pas
over to main.pas about displaySplash, like so...
procedure mainLoop;
var
done: Boolean;
filename: String;
begin
filename := dataDir + '/images/splash.bmp';
image := SDL_loadBMP(@filename[1]);
if (image = nil) then
begin
writeLn('Couldn''t load ' + filename);
halt(1);
end;
if (SDL_BlitSurface(image, nil, screen, nil) < 0) then
begin
writeLn('BlitSurface error:' {+ SDL_GetError()});
end;
SDL_updateRect(screen, 0, 0, image^.w, image^.h);
SDL_freeSurface(image);
//displaySplash;
done := FALSE;
while (done = FALSE) do
begin
if (SDL_PollEvent(event) > 0) then
begin
if (event^.eventtype = SDL_EventQuit) then
begin
done := TRUE;
end;
end;
end;
cleanUp;
end;
It will work. It won't work if it's called from the gfx library I'm
trying to build up for a game I'm developing, in SDL.
Could someone explain/help me please.
thanks in advance.
James
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.pas
Type: text/x-pascal
Size: 355 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20021124/bec4ac31/attachment.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfx.pas
Type: text/x-pascal
Size: 964 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20021124/bec4ac31/attachment-0001.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.pas
Type: text/x-pascal
Size: 469 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20021124/bec4ac31/attachment-0002.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: si.pas
Type: text/x-pascal
Size: 49 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20021124/bec4ac31/attachment-0003.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: startup.pas
Type: text/x-pascal
Size: 706 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20021124/bec4ac31/attachment-0004.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: version.pas
Type: text/x-pascal
Size: 433 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20021124/bec4ac31/attachment-0005.pas>
More information about the fpc-pascal
mailing list