______ ___ ___
/\ _ \ /\_ \ /\_ \
\ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ __ ___ ____
\ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ /'__`\ /\__`\ /'___/
\ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \__/\ \L\ \\/ __ \/\____`\
\ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/\_\ \ __//\____/\/\____/
\/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/\/_/\ \ \/ \/___/ \/___/
/\____/ \ \_\
Version 4.4.5-1 \_/__/ \/_/
A wrapper to use the Allegro library with Pascal compilers
by Ñuño Martínez, July, 20th, 2016.
- Release programs
- Help needed
- Contact info
Allegro.pas is a wrapper to allow Pascal compilers (such as Free Pascal)
to use the Allegro library.
I wrote it to use it by myself, so I didn't included all functionality of
Allegro. Anyway, I'll fix it and complete it as I'm using it (or as other
users do). Any collaboration will be welcomed.
Cross-platform support for Windows and GNU/Linux, both 32 and 64 bit. Should
be easy to use on POSIX systems as MacOS and BSD but this wasn't tested yet.
If you do it please tell us your experience.
Drawing functions including putpixel, line, rectangles, sprites, etc.
Supports clipping, translucency, lighting and can draw directly to the
screen or to memory bitmaps.
Full-screen or windowed modes and 8, 15, 16, 24 and 32 bits per pixel.
FLI/FLC animation player.
Plays background MIDI music and up to 64 simultaneous sound effects. Samples
can be looped (forwards, backwards, or bidirectionally), and the volume, pan,
pitch, etc, can be adjusted while they are playing.
Easy access to the mouse, keyboard, joystick, and high resolution timer
Routines for reading and writing LZSS compressed files.
GUI dialog manager and file selector.
3D textured polygons with and without transparency. Also included z-buffer
and s-buffer algorithms.
Allegro & Allegro.pas are gift-ware. They were created by a number of people
working in cooperation, and is given to you freely as a gift. You may use,
modify, redistribute, and generally hack it about in any way you like, and
you do not have to give us anything in return. However, if you like this
product you are encouraged to thank us by making a return gift to the Allegro
community. This could be by writing an add-on package, providing a useful
bug report, making an improvement to the library, or perhaps just releasing
the sources of your program so that other people can learn from them. If you
redistribute parts of this code or make a game using it, it would be nice if
you mentioned Allegro somewhere in the credits, but you are not required to
do this. We trust you not to abuse our generosity.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Before to intall Allegro.pas you need to install an additional library
(Allegro) and a compatible Pascal compiler (i.e. Free Pascal).
The Allegro library
You should remember: "Allegro.pas is a wrapper to use the Allegro library
with Pascal compilers". Allegro and Allegro.pas are different projects and
it's important to not mix them. So you need the original Allegro library to
make Allegro.pas works.
Current Allegro.pas version is compatible with the 4.4 branch of the Allegro
library. That means it can link with any version that starts with numbers 4.4
(i.e. 4.4.0 RC, 4.4.0, 4.4.1, etc.) but not with previous (4.2, 3.0) or
more modern ones (4.9, 5.0).
If you're a Windows user you can get a pre-compiled version of Allegro from
Note that this version might be older than the last released by Allegro, but
it works fairly stable.
Linux users' best option is to download the sources from Allegro's site and
compile by themselves. There are complete instructions to do this in the
The Pascal compiler
NOTE: Current version ISN'T compatible with Delphi because it can't share
variables with dynamic libraries (at least not the versions I use),
but compatibility should be back in Allegro.pas version 5.
The best compiler to use Allegro.pas is Free Pascal (AKA: FPC) which can be
installed separately or with the Lazarus IDE.
Both FPC and Lazarus are easy to install. Just go to its webpage at
http://www.freepascal.org/ or http://www.lazarus.freepascal.org/,
select the Download section, get the package that fits better with your
system and follow the instructions.
Compile demonstration and examples
To compile the examples and the demonstration game, open a command console
and go to the directory where you did extract the distributed parchive of
Allegro.pas (i.e. use "cd allegro.pas"). Then, if you're using Windows
run the "fix.bat" file and follow the on screen instructions, if you're
using GNU/Linux or similar then run the "fix.sh" script. Finally run "make";
this should build the examples and the demonstration game. If there's an
error then be sure you have Allegro, Free Pascal and any additional library
correctly installed and configured. If you have problems read the "Contact
Use Allegro.pas in your programs
To use Allegro.pas in your games you need to setup your compilers to be able
to compile it. You can write settings to fpc.cfg configuration file or use
them directly as command line parameters.
Use "-FuUnitPath" and "-FiIncludePath" parameters for the Allegro.pas' "lib"
directores. Example: fpc -FuD:\allegro.pas\lib -FiD:\allegro.pas\lib
Note that Allegro uses C and Assembler and it's optimised in a very low
level. So some parts of Allegro might conflict with some FPC options. For
example, a known issue is option "-Ct" that conflicts with interruption
functions generating a run-time error 202 ("Stack overflow error") but it
isn't true. Just don't use such options as they're not necessary in most
Also there are some 3D polygon drawing modes that might not work correctly on
15, 16, 24 nor 32 bits per pixel graphics modes. See unit "al3d"
documentation for more information.
There's an updated copy of the full installation process at the Allegro.pas'
wiki page at http://allegro-pas.sourceforge.net/wiki/
If you have "pasdoc" (http://pasdoc.sipsolutions.net/) you can build all
documentation in HTML format using "makefile docs" at command line.
Else you can download the documentation from the "Downloads" page of the
project (http://allegro-pas.sourceforge.net/download) or read it on-line
Also you should pay attention to the contents of the "resources"
Refer to Allegro's documentation to know which files your need to distribute
with your program.
You can help to improve Allegro.pas and add your name to the author's list.
We need people to test the library, to complete the documentation, to
translate it to other languages or to write more wrapper functions, develop
demos and examples.
If you want to help, read the next section and contact us!
You'll find more information at http://allegro-pas.sourceforge.net. There
are mailing-list and "wiki" pages in that site.
Another nice forum I visit is "Pascal Game Development"