Allegro Version 4.9.2 (SVN) |
Thread local storageSome of Allegro’s “global” state is thread-specific. For example, each thread in the program will have it’s own target bitmap, and calling al_set_target_bitmap will only change the target bitmap of the calling thread. This reduces the problems with global state in multithreaded programs. Summary
al_set_new_display_refresh_rate
Sets the refresh rate to use for newly created displays. If the refresh rate is not available, al_create_display will fail. A list of modes with refresh rates can be found with al_get_num_display_modes and al_get_display_mode, documented above. See Alsoal_set_new_display_flags
Sets various flags for display creation. flags is a bitfield containing any reasonable combination of the following:
0 can be used for default values. al_set_new_bitmap_format
Sets the pixel format for newly created bitmaps. format is one of the same values as used for al_set_new_display_format. The default format is 0 and means the display driver will choose the best format. al_set_new_bitmap_flags
Sets the flags to use for newly created bitmaps. Valid flags are:
al_set_blender
Sets the function to use for blending for the current thread. Blending means, the source and destination colors are combined in drawing operations. Assume, the source color (e.g. color of a rectangle to draw, or pixel of a bitmap to draw), is given as its red/green/blue/alpha components: sr, sg, sb, sa And this color is drawn to a destination, which already has a color: dr, dg, db, da The conceptional formula used by Allegro to draw any pixel then isr = dr * dst + sr * src * color.r The src, dst and color values are specified by this function. Valid values for src and dst are:
So for example, to restore the default of using alpha blending, you would use (pseudo code): al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, {1, 1, 1, 1}) This means, the color is not modified, all source components are multipled with the alpha component and combined with the destination according to this same alpha value. If you want to tint the result to some specific color, you can also change the color from white to some other color. Additive blending would be achieved withal_set_blender(ALLEGRO_ONE, ALLEGRO_ONE, {1, 1, 1, 1}) Copying the source to the destination (including alpha) unmodifiedal_set_blender(ALLEGRO_ONE, ALLEGRO_ZERO, {1, 1, 1, 1}) |
Set the pixel format for al displays created after this call.
void al_set_new_display_format( int format )
Sets the refresh rate to use for newly created displays.
void al_set_new_display_refresh_rate( int refresh_rate )
Sets various flags for display creation.
void al_set_new_display_flags( int flags )
Gets the current pixel format used for newly created displays.
int al_get_new_display_format( void )
Gets the current refresh rate used for newly created displays.
int al_get_new_display_refresh_rate( void )
Gets the current flags used for newly created displays.
int al_get_new_display_flags( void )
Change the current display for the calling thread.
void al_set_current_display( ALLEGRO_DISPLAY * display )
Query for the current display in the calling thread.
ALLEGRO_DISPLAY *al_get_current_display( void )
Select the bitmap to which all subsequent drawing operations in the calling thread will draw.
void al_set_target_bitmap( ALLEGRO_BITMAP * bitmap )
Return the target bitmap of the current display.
ALLEGRO_BITMAP *al_get_target_bitmap( void )
Sets the pixel format for newly created bitmaps.
void al_set_new_bitmap_format( int format )
Sets the flags to use for newly created bitmaps.
void al_set_new_bitmap_flags( int flags )
Returns the format used for newly created bitmaps.
int al_get_new_bitmap_format( void )
Returns the flags used for newly created bitmaps.
int al_get_new_bitmap_flags( void )
Sets the function to use for blending for the current thread.
void al_set_blender( int src, int dst, ALLEGRO_COLOR color )
Returns the active blender for the current thread.
void al_get_blender( int * src, int * dst, ALLEGRO_COLOR * color )
Get the number of available fullscreen display modes for the current set of display parameters.
int al_get_num_display_modes( void )
Retrieves a display mode.
ALLEGRO_DISPLAY_MODE *al_get_display_mode( int index, ALLEGRO_DISPLAY_MODE * mode )