Skip to content

D binding to the Allegro5 game development library

License

Notifications You must be signed in to change notification settings

TiberiuGal/DAllegro5

 
 

Repository files navigation

This is a D1.0 and D2 binding to the Allegro 5 library: http://liballeg.org/

Should work fine with Allegro 5.0.6. Pretty much all of the cross-platform functions are bound.
Non cross-platform functions are absent, but they will be added eventually.

If you want to use the unstable version of Allegro, you can look in the 5.1 branch of this project.

Tested with LDC/Tango and DMD/Phobos compilers on Linux 64 bit and DMD/Tango on Windows 32 bit (XP).

Installation
============

You have two options here. You can copy all the modules into your project, and just use them like that.
Alternatively, you can compile the binding into a static library for convenience:

Linux:

If you have LDC:

./build_lib_ldc.sh
./build_example_ldc.sh

If you have LDC2:

./build_lib_ldc2.sh
./build_example_ldc2.sh

If you have DMD:

./build_lib_dmd.sh
./build_example_dmd.sh

Windows:

If you have MinGW compiled libraries (< 4.6):

build_lib_dmd.bat

If you have MSVC/DMC compiled DLLs:

build_lib_dmd.bat -version=ALLEGRO_MSVC

Compiling the example
=====================

Linux:

If you have LDC:

./build_example_ldc.sh

If you have DMD:

./build_example_dmd.sh

Try the example by running:

./example

It should run and not crash.

Windows:

build_example_dmd.bat

Try the example by running:

example.exe

It should run and not crash.

General Notes
=============

This binding is equipped with pragma(lib) constructs that should allow you to not have to specify which Allegro libraries to link to. It only works this way in D2, however. It expects libraries to be named the same way they are named by the build process or generated by the import library generator script (Windows only). Monolith libraries are not supported. This mechanism can be overriden by using the version ALLEGRO_NO_PRAGMA_LIB.

The module allegro5.d_util contains some utility functions for converting between D strings and ALLEGRO_USTR.

Windows Notes
=============

* You will need to generate the import libraries for Allegro's dll files using implib.exe that you can download here: http://ftp.digitalmars.com/bup.zip

You can then use the create_import_libs.bat to create the import libraries. The script expects the Allegro DLLs to be in the same directory as the script. It also expects the implib to be callable from the command line (place it in PATH or into the directory alongside the script). E.g. if your directory had these DLL's in it:

allegro-5.0.dll
allegro_primitives-5.0.dll

Running the script will produce these import libraries:

allegro.lib
allegro_primitives.lib

* Note that if you are using MSVC or DMC compiled DLLs you will need to set the version to ALLEGRO_MSVC when compiling your own programs as well as when building the library.

* You can obtain pre-built libraries at http://www.allegro.cc/files/

* To remove the console window that spawns whenever you run an Allegro program create a file with a .def extension with these contents:

EXETYPE NT
SUBSYSTEM WINDOWS

Then pass it to dmd when compiling like this:

dmd <your usual stuff goes here> file.def

Bugs
====

On Windows Allegro windows will spawn without window borders (seems to happen only on XP). I don't know why this happens yet.

About

D binding to the Allegro5 game development library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published