AL_STR gives me 'identifier not found' error, even tough I seem to have all the necessary units in the uses clause.
Type AL_STR is defined inside unit al5base.pas.
Just to be clear: i've downloaded the file allegro-pas.5.2.alpha-2-src-pas.zip from
here.
Other than that i was lazy and
- extracted all the units from allegro-pas.5.2.alpha-2-src-pas.zip\allegro.pas\lib into the root of my project dir
- extracted the files common.pas and ex_font.pas from allegro-pas.5.2.alpha-2-src-pas.zip\allegro.pas\examples into that same directory
- extracted the directory allegro-pas.5.2.alpha-2-src-pas.zip\allegro.pas\bin\examples\data to the same directory (directory data has become a subdir of my project dir, with all data files located inside there).
- Extracted the binary package from allegro website, so that all dll files are inside my project directory (observant readers might attack me right now -> sue me for using a VM)
All the al_draw_text calls in the allegro.pas examples use literal strings, eg:
al_draw_text (f1, al_map_rgb (255, 0, 0), 10, 10, 0, 'red');
Well, it takes about 5 iseconds to add a variable named reddish typed as PChar and add the text 'reddish' to that just before doing that call and replace
al_draw_text (f1, al_map_rgb (255, 0, 0), 10, 10, 0, 'red');
with
al_draw_text (f1, al_map_rgb (255, 0, 0), 10, 10, 0, reddish);
Whether I use {$H+} for ansistrings in the unit in which the string array is declared or the main program I still get the failed assertion.
I have not changed anything else inside the original ex_font.pas example code.... ok ok ok. if you look at the attached picture you caught me of a little lie
Very confusing!
It's getting confusing for me as well now (*). All i can tell you right now that it works for me doing it such a lazy unfashionable manner.
Of course in a more fashioned manner you would have to place the allegro units somewhere more appropriate and make sure fpc is able to locate those units but, other then that it should not matter much.
(*) please state the target for which you are compiling, which version of FPC you are using (and version of lazarus in case using lazarus as well)
As an additional bonus, post the output you get from invoking "fpc -B -va ex_font.pas" from the command-line. The compiler i very good at telling what is wrong albeit it takes the compiler a few lines to make some definitive conclusion. (you can pipe it to a file, using: "fpc -B -va ex_font.pas >mylogfile.txt"