@# @# This is the source for the Allegro common mistakes, in a weird custom @# format. Read makedoc.c for a description of what is going on... @# @external-css=allegro.css @document_title=Common mistakes
END_OF_MAIN
to
mangle your main() function and supply its own that is required by the
platform. Allegro assumes that main() returns an integer, as required
by various C standards. If you change the return type of your main() to
something else Allegro's main() will get confused and return some
nonsense value which some system can recognize as an error and crash
your program.
@@ Semicolon at END_OF_MAIN.
allegro_init()
would be called) this
condition is violated. You need to postpone calls to Allegro functions
to after initializing Allegro.
@@ Calling set_color_depth without resetting graphic mode.
set_color_depth()
tells Allegro which color depth to use the next time a
graphic mode is set or bitmap is created or loaded. It doesn't change
the color depth of the current graphic mode or existing bitmaps. You
need to be sure that all your bitmaps and/or graphic mode are in the
same color depth or Allegro will be forced to do slow color conversions
between them.
@@ Destroying global objects like `screen'.
Unlike other bitmaps `screen' is created by calling set_gfx_mode()
and
must not be destroyed by calling destroy_bitmap()
. The proper way to
destroy `screen' is calling set_gfx_mode(GFX_TEXT, 0, 0, 0, 0)
.