Allegro

From ArchWiki

Allegro is, as their website states,

a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such as creating windows, accepting user input, loading data, drawing images, playing sounds, etc. and generally abstracting away the underlying platform. However, Allegro is not a game engine: you are free to design and structure your program as you like.

Installation

Install the allegro package.

For the development version, install the allegro-gitAUR package.

There is also a package for the legacy version of Allegro, allegro4, which you can use for source which it requires.

Note: Allegro 5 is not backwards compatible with Allegro 4. Developing new applications using Allegro 4 is discouraged.

Use

Once installed, include the necessary base header into necessary source files:

main.c
#include <allegro5/allegro5.h>

If your main function is inside a C++ file, then it must have this signature: int main(int argc, char **argv)

Troubleshooting

  • A common first mistake is to forget to link against the Allegro libraries. For an overview, use pkg-config --list-all .
  • Another trap for young players is to forget to include and initialise the necessary modules. Each module is a header, which needs to be included in the source file. Make sure you initialised it with the correct command and linked against the module, see above. For the exact details, refer to the manual.

See also