Frequently Asked Questions
Outdated: somebody should sift through and update this where needed - eg. Allegro on C90 is dubious. Remove this block when done.
Every question on this page has really, truly been asked frequently.
Is Allegro C or C++?
With the exception of a few DirectX files that are required to be C++, Allegro is programmed according to the C90 standard.
Is Allegro compatible with C++? Is it compatible with C?
Yes and yes. Also, thank you for finding the answer to your question here, in the FAQ. You are off to a good start.
Is Allegro compatible with non-C language X?
Is Allegro thread-safe?
Which branch/version of Allegro should I use?
If you have just started learning C/C++, use whichever branch is easiest to install on your system. If you have C/C++ experience and want to see what the Allegro API has to offer, use the work-in-progress branch. If you formerly programmed in Allegro 4, spend an afternoon bringing yourself up to speed with the Allegro 5 API and use the work-in-progress branch.
Why do I get undefined symbol errors?
Because you aren't linking correctly to Allegro. Try adding the
-lallegro switch to your compile command. Add an additional
-lallegro_main for Mac.
How do I statically link?
Sacrifice a virgin maiden to the gods of Mt Allegrohorn.
How do I build an executable that runs on any Linux distro?
Link to and distribute monolithic Allegro builds for both 64- and 32-bit platforms.
- Allegro.cc forum posts by Elias in "Linking allegro statically" and by Arthur Kalliokoski and bamccaig in "How to compile for a release from linux for all linux platforms?"
Why does Allegro register too many key/mouse presses?
Because you're not using events.
How do I switch between full-screen and windowed modes?
For full-screen, use ALLEGRO_FULLSCREEN_WINDOWED and scale the buffer with a transformation.
For windowed, use ALLEGRO_WINDOWED.
- Achieving Resolution Independence
- Allegro.cc forum post by Thomas Fjellstrom in "Fullscreen in Linux Mint"
How do I open GIF animations?
Should I use memory or video bitmaps?
The answer is not entirely straightforward, but here are some facts:
- Video bitmaps are generally faster than memory bitmaps.
- Converting bitmaps between memory and video is generally slow.
- Testing helps.
How do I prevent the task bar from appearing on top of a full-screen display?
How do I create a multi-threaded application?
How do I use Allegro with a UI engine like Awesomium?
Attach a shader as necessary to convert the UI engine's pixel format to one compatible with Allegro. Copy the pixel data to a locked video bitmap. Unlock and draw the bitmap.