Allegro Manual
Frequently asked questions (FAQ)
What is Allegro?
Where can I get it?
How do I use it?
Does the licence mean that Allegro is public domain?
Can I use Allegro for commercial purposes?
Is Allegro compatible with licence XXX (e.g. GPL)?
Is Allegro open source (OSI) compatible?
How are modifications of the library licensed?
I took your code. Will you sue me? Your library destroyed my PC. Who do I sue?
What is this make program that I'm supposed to run?
Make doesn't work properly.
My djgpp installation is fine, but make still doesn't work properly.
When I run make, it asks me for some parameters. What do I type?
When I run make, it says "makefile has modification time in the future".
When I run make, it says "virtual memory exhausted".
When I run make, it says "conflicting types for va_list".
When I try to compile a program using Allegro, I get lots of errors like:
I give up: I can't compile this! Can you send me a precompiled version?
Compile errors scroll off the screen too quickly for me to read them!
Does the DOS version of Allegro work under Windows NT?
Does Allegro work under OpenDOS?
How can I extend the 256k limit on Mode-X video memory? I have two megs in my card.
Does DOS Allegro work with the SB-Live soundcard?
Why does DOS Allegro play sounds so much quieter than in Windows?
Why doesn't it work with my video card?
Why not use some sort of dynamic linking system?
I get an "out of environment space" error when I run fix.bat or vcvars32.bat!
I get an "out of environment space" error when I run fix.bat or vcvars32.bat!
When I run make, it says "missing separator".
I get lots of compile errors about things like "LPDIRECTDRAWSURFACE2"!
I get lots of compile errors about things like "DDEDM_STANDARDVGAMODES"!
When I run make, it says "windres: no resources".
I get an error about a missing WinMain() or main() function!
I get an error about an "unresolved external symbol _main"!
I get lots of compile errors about conflicting types for "struct BITMAP"!
In windowed mode artifacts are left on the desktop when the window is moved or when another window is placed on top of it.
In windowed mode the screen stays black unless the window is placed under another window on the desktop.
I get an error about "_mangled_main_address" being undefined!
I get an error about a duplicate definition of the "_main" symbol!
Compile errors scroll off the screen way too quickly for me to read them!
When I try to run Allegro programs, I get "error while loading shared libraries: liballeg.so.4.1: cannot open shared object file: No such file or directory".
When I try to use DGA2, I get "resolution not supported", but the X server does actually support that resolution !
When I try to use DGA2, the screen goes black and the PC completely halts!
I'm trying to compile the grabber, but it doesn't work!
When I compile Allegro, make fails with something like `Error: operands given don't match any known 386 instruction' or `Error: no such instruction `maskmovq %mm3, %mm1''.
Can I use Allegro with my <foobar> compiler?
What is this "Allegro WIP" that I see people talking about?
I got the WIP patch, but I can't apply it.
When I run the demo game, it says it can't find demo.dat.
How can I display several different images at the same time? When I show the second one it messes up the palette for the first.
How can I convert my graphics to all use the same 256 color palette?
My colors always come out wrong. And how can I make a greyscale palette with 256 different shades?
Why do I have a funny color border at the edges of my monitor?
How can I fade the screen in a truecolor graphics mode?
I tried using fade_in() and fade_out() with truecolor modes but nothing happened. What am I doing wrong?
How can I generate FLI or FLC format animations?
How can I make parts of my sprite transparent in truecolor modes? I don't understand what the docs mean by "bright pink"...
I can't get the 3D polygon functions to work!
I can't get the rotate_sprite() function to work!
I can't get the d_bitmap_proc() or d_icon_proc() GUI object to work!
Should I use regular bitmaps, RLE sprites, or compiled sprites?
How can I make my game run at the same speed on any computer?
How can I take a screenshot of my Allegro program?
How can I generate a random number?
Why not make a "lite" version of Allegro? I don't need any of the sound, maths, or GUI routines...
Will you ever add support for 3D accelerator hardware?
Why not add a MOD playing function?
Why not add networking support?
Why can't Allegro read GIF files?
My program crashes all the time. Could this be a bug in Allegro?
Can I use Allegro in my <whatever> commercial application?
When will <foobar> be finished? I can't wait...
Where can I get some fonts to use with Allegro?
Where can I find a set of instrument samples for the DIGMID driver?
How can I convert the documentation into Windows Help format?
How can I print out the documentation?
Where can I find example source code, add-on packages, and tutorials?
Why is it considered good coding practice to define PI as a constant, rather than just using the value 3.141592 in my code?
Why doesn't vsync() seem to work?
Why doesn't busy waiting on the key array work? For example, "while (!key[KEY_ENTER]);" doesn't work.
I get lots of errors when I try to compile my C++ Allegro program.
I'm still confused. Where can I get help?
How can I generate a random number?
Description
How can I generate a
random
number?
Call
srand(time(NULL))
at the beginning of your program, and then use
rand()%limit
to obtain a pseudo-random number between
0
and
limit-1
.