[fpc-pascal]Allegro

Matt Emson memsom at interalpha.co.uk
Tue Feb 13 10:41:31 CET 2001


Hi Ray,

I'd love to get a copy of your source (including your alterations to Allegro.pas.)
I've converted about 5 of the demos myself, as well as writing a few of my own
just messing around, so maybe we could combine efforts. I'm more interested
in writing an OO wrapper to the Allegro.pas unit, so if you can send me the
bit's you've converted, I'll probably be able to get it working with both Delphi
*and* FPC in 'Delphi' mode ;)

I've noticed the author has made some errors too... There are a few classics:


function Load_BMP(filename: PAL_Char; pal: PAL_Rbg): PAL_Bitmap; cdecl;

should actually read (and works as):

function Load_BMP(filename: PAL_Char; pal: PAL_Palette): PAL_Bitmap; cdecl;


(I gleaned this by reading the demos.. the docs kind of contradict themselves..)


Because the resulting value in 'pal' after the call is actually the Bitmaps
Palette. So if you then call (totally OTTOMH so don't quote me):

var
  abmp: PAL_Bitmap;
  apal: PAL_Palette;
begin
  abmp := Load_BMP(PChar('c:\afile.bmp'), pal);
  Set_Palette(pal^); //if you don't call this the colours are not correct!!

  blit(abmp, screen, 0, 0, 0, 0, abmp^.w, abmp^.h);
end;

>The Delphi wrapper doesn't handle external variables correctly becuase of a

>limition with Delphi.  The modifcations I made overcame this limitation.

Can you ellabourate on this more?? Which version of Delphi?

>I have only wrapped a dozen or so functions and converted the exmem.c
>and exmidi.c demos that come with Allegro and they both seem to work fine.


To be honest, a lot of the functionality does more than you'd need on a daily
basis. 

>I know very little about Object Pascal, Delphi and Free Pascal so I have no

>idea what is the best way to get it working ... I'm just happy that it works
the
>way I have done it.

I'm willing to look at the code and give you some pointers if you like.

>I estimate it would take about 1 full day to convert the Delphi wrapper to

>work with Free Pascal (by manually modification).  I was hoping to do a similar

>thing as the allegro.pas author and write a "htopas" type program to do it

>automatically.

I think I'd personally like to 'snapshot' the version that works, get everything
working well and *then* worry about the current version. So long as nothing
changes too radically, it should just be an 'adding additional stuff' rather
than a complete re-write.

>If anyone wants a copy of my test programs let me know.

Me, me, me ;)

Thanks,

Matt




More information about the fpc-pascal mailing list