Allegro.pas 5.2.0Introduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers
|
Unit allegro5
Description
Wrapper of the Allegro 5 core library.
This unit defines core functions, procedures and data types, that aren't in add-ons.
See also: Getting started
Overview
Classes, Interfaces, Objects and Records
Functions and Procedures
function al_get_allegro_version: AL_UINT32; CDECL; external ALLEGRO_LIB_NAME; |
function al_run_main (argc: AL_INT; argv: AL_POINTER; user_main: ALLEGRO_USER_MAIN): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function AL_ID (const str: AL_STR): AL_INT; |
function al_get_time: AL_DOUBLE; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_rest (seconds: AL_DOUBLE); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_init_timeout (out timeout: ALLEGRO_TIMEOUT; seconds: AL_DOUBLE); CDECL; external ALLEGRO_LIB_NAME; |
function al_map_rgb (r, g, b: AL_UCHAR): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
function al_map_rgba (r, g, b, a: AL_UCHAR): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
function al_map_rgb_f (r, g, b: AL_FLOAT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
function al_map_rgba_f (r, g, b, a: AL_FLOAT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
function al_premul_rgba (r, g, b: AL_UCHAR): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
function al_premul_rgba_f (r, g, b: AL_FLOAT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unmap_rgb (color: ALLEGRO_COLOR; out r, g, b: AL_UCHAR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unmap_rgba (color: ALLEGRO_COLOR; out r, g, b, a: AL_UCHAR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unmap_rgb_f (color: ALLEGRO_COLOR; out r, g, b: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unmap_rgba_f (color: ALLEGRO_COLOR; out r, g, b, a: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_pixel_size (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_pixel_format_bits (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_pixel_block_size (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_pixel_block_width (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_pixel_block_height (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_bitmap_format (format: ALLEGRO_PIXEL_FORMAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_bitmap_flags (flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_bitmap_format: ALLEGRO_PIXEL_FORMAT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_bitmap_flags: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_add_new_bitmap_flag (flag: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_bitmap_width (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_bitmap_height (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_bitmap_format (bitmap: ALLEGRO_BITMAPptr): ALLEGRO_PIXEL_FORMAT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_bitmap_flags (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_create_bitmap (w, h: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_bitmap (Bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_put_pixel (x, y: AL_INT; color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_put_blended_pixel (x, y: AL_INT; color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_pixel (bitmap: ALLEGRO_BITMAPptr; x, y: AL_INT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_convert_mask_to_alpha (bitmap: ALLEGRO_BITMAPptr; mask_color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_clipping_rectangle (x, y, width, height: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_reset_clipping_rectangle; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_clipping_rectangle (out x, y, w, h: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_create_sub_bitmap (parent: ALLEGRO_BITMAPptr; x, y, w, h: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_is_sub_bitmap (bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_parent_bitmap (bitmap: ALLEGRO_BITMAPptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_bitmap_x (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_bitmap_y (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_reparent_bitmap (bitmap, parent: ALLEGRO_BITMAPptr; x, y, w, h: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_clone_bitmap (bitmap: ALLEGRO_BITMAPptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_convert_bitmap (bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_convert_memory_bitmaps; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_bitmap (bitmap: ALLEGRO_BITMAPptr; dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_bitmap_region (bitmap: ALLEGRO_BITMAPptr; sx, sy, sw, sh, dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_scaled_bitmap (bitmap: ALLEGRO_BITMAPptr; sx, sy, sw, sh, dx, dy, dw, dh: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_rotated_bitmap (bitmap: ALLEGRO_BITMAPptr; cx, cy, dx, dy, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_scaled_rotated_bitmap (bitmap: ALLEGRO_BITMAPptr; cx, cy, dx, dy, xscale, yscale, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_tinted_bitmap (bitmap: ALLEGRO_BITMAPptr; tint: ALLEGRO_COLOR; dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_tinted_bitmap_region (bitmap: ALLEGRO_BITMAPptr; tint: ALLEGRO_COLOR; sx, sy, sw, sh, dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_tinted_scaled_bitmap (bitmap: ALLEGRO_BITMAPptr; tint: ALLEGRO_COLOR; sx, sy, sw, sh, dx, dy, dw, dh: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_tinted_rotated_bitmap (bitmap: ALLEGRO_BITMAPptr; tint: ALLEGRO_COLOR; cx, cy, dx, dy, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_tinted_scaled_rotated_bitmap (bitmap: ALLEGRO_BITMAPptr; tint: ALLEGRO_COLOR; cx, cy, dx, dy, xscale, yscale, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_tinted_scaled_rotated_bitmap_region (bitmap: ALLEGRO_BITMAPptr; sx, sy, sw, sh: AL_FLOAT; tint: ALLEGRO_COLOR; cx, cy, dx, dy, xscale, yscale, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_fopen (const path, mode: AL_STR): ALLEGRO_FILEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_fopen_interface (const vt: ALLEGRO_FILE_INTERFACEptr; const path, mode: AL_STR): ALLEGRO_FILEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_create_file_handle (const vt: ALLEGRO_FILE_INTERFACEptr; userdata: AL_POINTER): ALLEGRO_FILEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_fclose (f: ALLEGRO_FILEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_fread (f: ALLEGRO_FILEptr; ptr: AL_POINTER; size: AL_SIZE_T): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
function al_fwrite (f: ALLEGRO_FILEptr; const ptr: AL_POINTER; size: AL_SIZE_T): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
function al_fflush (f: ALLEGRO_FILEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_ftell (f: ALLEGRO_FILEptr): AL_INT64; CDECL; external ALLEGRO_LIB_NAME; |
function al_fseek (f: ALLEGRO_FILEptr; offset: AL_INT64; whence: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_feof (f: ALLEGRO_FILEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_ferror (f: ALLEGRO_FILEptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_ferrmsg (f: ALLEGRO_FILEptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_fclearerr (f: ALLEGRO_FILEptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_fungetc (f: ALLEGRO_FILEptr; c: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_fsize (f: ALLEGRO_FILEptr): AL_INT64; CDECL; external ALLEGRO_LIB_NAME; |
function al_fgetc (f: ALLEGRO_FILEptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_fputc (f: ALLEGRO_FILEptr; c: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_fread16le (f: ALLEGRO_FILEptr): AL_INT16; CDECL; external ALLEGRO_LIB_NAME; |
function al_fread16be (f: ALLEGRO_FILEptr): AL_INT16; CDECL; external ALLEGRO_LIB_NAME; |
function al_fwrite16le (f: ALLEGRO_FILEptr; w: AL_INT16): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
function al_fwrite16be (f: ALLEGRO_FILEptr; w: AL_INT16): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
function al_fread32le (f: ALLEGRO_FILEptr): AL_INT32; CDECL; external ALLEGRO_LIB_NAME; |
function al_fread32be (f: ALLEGRO_FILEptr): AL_INT32; CDECL; external ALLEGRO_LIB_NAME; |
function al_fwrite32le (f: ALLEGRO_FILEptr; l: AL_INT32): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
function al_fwrite32be (f: ALLEGRO_FILEptr; l: AL_INT32): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
function al_fgets (f: ALLEGRO_FILEptr; const p: AL_STRptr; max: AL_SIZE_T): AL_STRptr CDECL; external ALLEGRO_LIB_NAME; |
function al_fget_ustr (f: ALLEGRO_FILEptr): ALLEGRO_USTRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_fputs (f: ALLEGRO_FILEptr; const p: AL_STR): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_fopen_slice (fp: ALLEGRO_FILEptr; initial_size: AL_SIZE_T; const mode: AL_STR): ALLEGRO_FILEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_file_interface: ALLEGRO_FILE_INTERFACEptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_file_interface (const file_interface: ALLEGRO_FILE_INTERFACEptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_standard_file_interface; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_file_userdata (f: ALLEGRO_FILEptr): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
function al_register_bitmap_loader (const ext: AL_STR; loader: ALLEGRO_IIO_LOADER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_register_bitmap_saver (const ext: AL_STR; saver: ALLEGRO_IIO_SAVER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_register_bitmap_loader_f (const ext: AL_STR; fs_loader: ALLEGRO_IIO_FS_LOADER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_register_bitmap_saver_f (const ext: AL_STR; fs_saver: ALLEGRO_IIO_FS_SAVER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_register_bitmap_identifier (const ext: AL_STR; identifier: ALLEGRO_IIO_IDENTifIER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_load_bitmap (const filename: AL_STR): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_load_bitmap_flags (const filename: AL_STR; flags: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_load_bitmap_f (fp: ALLEGRO_FILEptr; const ident: AL_STR): ALLEGRO_BITMAPptr; |
function al_load_bitmap_flags_f (fp: ALLEGRO_FILEptr; const ident: AL_STR; flags: AL_INT): ALLEGRO_BITMAPptr; |
function al_save_bitmap (const filename: AL_STR; bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_save_bitmap_f (fp: ALLEGRO_FILEptr; const ident: AL_STR; bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_identify_bitmap_f (fp: ALLEGRO_FILEptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_identify_bitmap (const filename: AL_STR): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_lock_bitmap (bitmap: ALLEGRO_BITMAPptr; format: ALLEGRO_PIXEL_FORMAT; flags: ALLEGRO_LOCK): ALLEGRO_LOCKED_REGIONptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_lock_bitmap_region (bitmap: ALLEGRO_BITMAPptr; x, y, width, height: AL_INT; format: ALLEGRO_PIXEL_FORMAT; flags: ALLEGRO_LOCK): ALLEGRO_LOCKED_REGIONptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_lock_bitmap_blocked (bitmap: ALLEGRO_BITMAPptr; flags: ALLEGRO_LOCK): ALLEGRO_LOCKED_REGIONptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_lock_bitmap_region_blocked (bitmap: ALLEGRO_BITMAPptr; x_block, y_block, width_block, height_block, flags: ALLEGRO_LOCK): ALLEGRO_LOCKED_REGIONptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unlock_bitmap (bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_is_bitmap_locked (bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_blender (op: ALLEGRO_BLEND_OPERATIONS; source, dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_blend_color (color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_blender (out op: ALLEGRO_BLEND_OPERATIONS; out source, dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_blend_color: ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_separate_blender (op: ALLEGRO_BLEND_OPERATIONS; source, dest: ALLEGRO_BLEND_MODE; alpha_op: ALLEGRO_BLEND_OPERATIONS; alpha_source, alpha_dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_separate_blender (out op: ALLEGRO_BLEND_OPERATIONS; out source, dest: ALLEGRO_BLEND_MODE; out alpha_op: ALLEGRO_BLEND_OPERATIONS; out alpha_source, alpha_dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
function ALLEGRO_EVENT_TYPE_IS_USER (t: ALLEGRO_EVENT_TYPE): AL_BOOL; inline; |
function ALLEGRO_GET_EVENT_TYPE (const str: AL_STR): AL_INT; inline; |
procedure al_init_user_event_source (source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_user_event_source (source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_emit_user_event (source: ALLEGRO_EVENT_SOURCEptr; Event: ALLEGRO_EVENTptr; dtor: ALLEGRO_EVENT_DTOR_PROC): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unref_user_event (event: ALLEGRO_USER_EVENTptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_event_source_data (source: ALLEGRO_EVENT_SOURCEptr; data: AL_POINTER); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_event_source_data (const source: ALLEGRO_EVENT_SOURCEptr): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
function al_create_event_queue: ALLEGRO_EVENT_QUEUEptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_event_queue (queue: ALLEGRO_EVENT_QUEUEptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_is_event_source_registered (queue: ALLEGRO_EVENT_QUEUEptr; source: ALLEGRO_EVENT_SOURCEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_register_event_source (queue: ALLEGRO_EVENT_QUEUEptr; source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_unregister_event_source (queue: ALLEGRO_EVENT_QUEUEptr; source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_pause_event_queue (queue: ALLEGRO_EVENT_QUEUEptr; pause: AL_BOOL); CDECL; external ALLEGRO_LIB_NAME; |
function al_is_event_queue_paused (const queue: ALLEGRO_EVENT_QUEUEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_is_event_queue_empty (queue: ALLEGRO_EVENT_QUEUEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_next_event (queue: ALLEGRO_EVENT_QUEUEptr; out ret_event: ALLEGRO_EVENT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_peek_next_event (queue: ALLEGRO_EVENT_QUEUEptr; out ret_event: ALLEGRO_EVENT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_drop_next_event (queue: ALLEGRO_EVENT_QUEUEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_flush_event_queue (queue: ALLEGRO_EVENT_QUEUEptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_wait_for_event (queue: ALLEGRO_EVENT_QUEUEptr; ret_event: ALLEGRO_EVENTptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_wait_for_event_timed (queue: ALLEGRO_EVENT_QUEUEptr; event: ALLEGRO_EVENTptr; secs: AL_FLOAT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_wait_for_event_until (queue: ALLEGRO_EVENT_QUEUEptr; event: ALLEGRO_EVENTptr; var timeout: ALLEGRO_TIMEOUT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_display_refresh_rate (refresh_rate: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_display_flags (flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_display_refresh_rate: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_display_flags: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_window_title (const title: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_window_title: AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_width (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_height (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_format (display: ALLEGRO_DISPLAYptr): ALLEGRO_PIXEL_FORMAT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_refresh_rate (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_flags (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_orientation (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_display_flag (display: ALLEGRO_DISPLAYptr; flag: AL_INT; onoff: AL_BOOL): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_create_display (w, h: AL_INT): ALLEGRO_DISPLAYptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_display (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_current_display: ALLEGRO_DISPLAYptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_target_bitmap (Bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_target_backbuffer (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_backbuffer (display: ALLEGRO_DISPLAYptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_target_bitmap: ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_acknowledge_resize (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_resize_display (display: ALLEGRO_DISPLAYptr; width, height: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_flip_display; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_update_display_region (x, y, Width, height: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_is_compatible_bitmap (bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_wait_for_vsync: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_event_source (display: ALLEGRO_DISPLAYptr): ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_display_icon (display: ALLEGRO_DISPLAYptr; icon: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_display_icons (display: ALLEGRO_DISPLAYptr; num_icons: AL_INT; var icons: array of ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_display_adapter: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_display_adapter (adapter: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_window_position (x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_new_window_position (out x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_window_position (display: ALLEGRO_DISPLAYptr; x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_window_position (display: ALLEGRO_DISPLAYptr; out x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_set_window_constraints (display: ALLEGRO_DISPLAYptr; min_w, min_h, max_w, max_h: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_window_constraints (display: ALLEGRO_DISPLAYptr; out min_w, min_h, max_w, max_h: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_apply_window_constraints (display: ALLEGRO_DISPLAYptr; onoff: AL_BOOL); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_window_title (display: ALLEGRO_DISPLAYptr; const title: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_new_display_option (option: ALLEGRO_DISPLAY_OPTIONS; value, importance: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_new_display_option (option: ALLEGRO_DISPLAY_OPTIONS; var importance: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_reset_new_display_options; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_display_option (display: ALLEGRO_DISPLAYptr; option: ALLEGRO_DISPLAY_OPTIONS; value: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_option (display: ALLEGRO_DISPLAYptr; option: ALLEGRO_DISPLAY_OPTIONS): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_hold_bitmap_drawing (hold: AL_BOOL); CDECL; external ALLEGRO_LIB_NAME; |
function al_is_bitmap_drawing_held: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_acknowledge_drawing_halt (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_acknowledge_drawing_resume (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_clipboard_text (display: ALLEGRO_DISPLAYptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_clipboard_text (display: ALLEGRO_DISPLAYptr; const text: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_clipboard_has_text (display: ALLEGRO_DISPLAYptr): AL_BOOL CDECL; external ALLEGRO_LIB_NAME; |
function al_create_config: ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_add_config_section (config: ALLEGRO_CONFIGptr; const name: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_config_value (config: ALLEGRO_CONFIGptr; const section, key, value: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_add_config_comment (config: ALLEGRO_CONFIGptr; const section, comment: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_config_value (const config: ALLEGRO_CONFIGptr; const section, key: AL_STR): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_load_config_file (const filename: AL_STR): ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_load_config_file_f (fp: ALLEGRO_FILEptr): ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_save_config_file (const filename: AL_STR; const config: ALLEGRO_CONFIGptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_save_config_file_f (fp: ALLEGRO_FILEptr; const config: ALLEGRO_CONFIGptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_merge_config_into (master: ALLEGRO_CONFIGptr; const add: ALLEGRO_CONFIGptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_merge_config (const cfg1, cfg2: ALLEGRO_CONFIGptr): ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_config (config: ALLEGRO_CONFIGptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_remove_config_section (config: ALLEGRO_CONFIGptr; const section: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_remove_config_key (config: ALLEGRO_CONFIGptr; const section, key: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_cpu_count: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_ram_size: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_clear_to_color (color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_clear_depth_buffer (x: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_draw_pixel (x, y: AL_FLOAT; color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_errno: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_errno (errnum: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_fixsqrt (x: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
function al_fixhypot (x, y: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
function al_fixatan (x: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
function al_fixatan2 (y, x: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
function al_ftofix (x: AL_DOUBLE): AL_FIXED; inline; |
function al_fixtof (x: AL_FIXED): AL_DOUBLE; inline; |
function al_fixadd (x, y: AL_FIXED): AL_FIXED; inline; |
function al_fixsub (x, y: AL_FIXED): AL_FIXED; inline; |
function al_fixmul (x, y: AL_FIXED): AL_FIXED; inline; |
function al_fixdiv (x, y: AL_FIXED): AL_FIXED; inline; |
function al_fixfloor (x: AL_FIXED): AL_FIXED; inline; |
function al_fixceil (x: AL_FIXED): AL_FIXED; inline; |
function al_itofix (x: AL_INT): AL_FIXED; inline; |
function al_fixtrunc (x: AL_FIXED): AL_INT; inline; |
function al_fixtoi (x: AL_FIXED): AL_INT; inline; |
function al_fixcos (x: AL_FIXED): AL_FIXED; inline; |
function al_fixsin (x: AL_FIXED): AL_FIXED; inline; |
function al_fixtan (x: AL_FIXED): AL_FIXED; inline; |
function al_fixacos (x: AL_FIXED): AL_FIXED; inline; |
function al_fixasin (x: AL_FIXED): AL_FIXED; inline; |
function al_get_num_display_modes: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_display_mode (index: AL_INT; out mode: ALLEGRO_DISPLAY_MODE): ALLEGRO_DISPLAY_MODEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_install_joystick: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_uninstall_joystick; CDECL; external ALLEGRO_LIB_NAME; |
function al_is_joystick_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_reconfigure_joysticks: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_num_joysticks: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick (joyn: AL_INT): ALLEGRO_JOYSTICKptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_release_joystick (j: ALLEGRO_JOYSTICKptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_active (j: ALLEGRO_JOYSTICKptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_name (j: ALLEGRO_JOYSTICKptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_num_sticks (j: ALLEGRO_JOYSTICKptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_stick_flags (j: ALLEGRO_JOYSTICKptr; stick: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_stick_name (j: ALLEGRO_JOYSTICKptr; stick: AL_INT): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_num_axes (j: ALLEGRO_JOYSTICKptr; stick: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_axis_name (j: ALLEGRO_JOYSTICKptr; stick, axis: AL_INT): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_num_buttons (j: ALLEGRO_JOYSTICKptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_button_name (j: ALLEGRO_JOYSTICKptr; buttonn: AL_INT): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_joystick_state (j: ALLEGRO_JOYSTICKptr; out ret_state: ALLEGRO_JOYSTICK_STATE); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_joystick_event_source: ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_is_keyboard_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_install_keyboard: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_uninstall_keyboard; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_keyboard_leds (leds: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_keycode_to_name (keycode: AL_INT): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_keyboard_state (out ret_state: ALLEGRO_KEYBOARD_STATE); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_clear_keyboard_state (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_key_down (var state: ALLEGRO_KEYBOARD_STATE; keycode: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_keyboard_event_source: ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_is_mouse_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_install_mouse: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_uninstall_mouse; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_mouse_num_buttons: AL_UINT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_mouse_num_axes: AL_UINT; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_mouse_xy (display: ALLEGRO_DISPLAYptr; x, y: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_mouse_z (z: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_mouse_w (w: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_mouse_axis (axis, value: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_get_mouse_state (out ret_state: ALLEGRO_MOUSE_STATE); CDECL; external ALLEGRO_LIB_NAME; |
function al_mouse_button_down (var state: ALLEGRO_MOUSE_STATE; button: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_mouse_state_axis (var state: ALLEGRO_MOUSE_STATE; axis: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_mouse_cursor_position (out ret_x, ret_y: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_grab_mouse (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_ungrab_mouse: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_mouse_wheel_precision (precision: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_mouse_wheel_precision: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_mouse_event_source: ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_memory_interface (var iface: ALLEGRO_MEMORY_INTERFACE); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_restore_memory_interface; |
function al_malloc (const n: AL_SIZE_T): AL_POINTER; inline; |
procedure al_free (p: AL_POINTER); inline; |
function al_realloc (p: AL_POINTER; const n: AL_SIZE_T): AL_POINTER; inline; |
function al_calloc (const c, n: AL_SIZE_T): AL_POINTER; inline; |
function al_malloc_with_context (n: AL_SIZE_T; line: AL_INT; const afile, func: AL_STR): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_free_with_context (ptr: AL_POINTER; line: AL_INT; const afile, func: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
function al_realloc_with_context (ptr: AL_POINTER; n: AL_SIZE_T; line: AL_INT; const afile, func: AL_STR): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
function al_calloc_with_context (n, count: AL_SIZE_T; line: AL_INT; const afile, func: AL_STR): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_num_video_adapters: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_monitor_info (adapter: AL_INT; out info: ALLEGRO_MONITOR_INFO): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_monitor_dpi (adapter: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
function al_create_mouse_cursor (sprite: ALLEGRO_BITMAPptr; xfocus, yfocus: AL_INT): ALLEGRO_MOUSE_CURSORptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_mouse_cursor (cursor: ALLEGRO_MOUSE_CURSORptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_set_mouse_cursor (display: ALLEGRO_DISPLAYptr; cursor: ALLEGRO_MOUSE_CURSORptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_system_mouse_cursor (display: ALLEGRO_DISPLAYptr; cursor_id: ALLEGRO_SYSTEM_MOUSE_CURSOR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_show_mouse_cursor (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_hide_mouse_cursor (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_render_state (state: ALLEGRO_RENDER_STATE; value: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_use_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_use_projection_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_copy_transform (out dest: ALLEGRO_TRANSFORM; var src: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_identity_transform (out trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_build_transform (out trans: ALLEGRO_TRANSFORM; x, y, sx, sy, theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_build_camera_transform (out trans: ALLEGRO_TRANSFORM; position_x, position_y, position_z, look_x, look_y, look_z, up_x, up_y, up_z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_translate_transform (var trans: ALLEGRO_TRANSFORM; x, y: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_translate_transform_3d (var trans: ALLEGRO_TRANSFORM; x, y, z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_rotate_transform (var trans: ALLEGRO_TRANSFORM; theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_rotate_transform_3d (var trans: ALLEGRO_TRANSFORM; x, y, z, theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_scale_transform (var trans: ALLEGRO_TRANSFORM; sx, sy: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_scale_transform_3D (var trans: ALLEGRO_TRANSFORM; sx, sy, sz: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_transform_coordinates (var trans: ALLEGRO_TRANSFORM; var x, y: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_transform_coordinates_3d (var trans: ALLEGRO_TRANSFORM; var x, y, z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_transform_coordinates_4d (var trans: ALLEGRO_TRANSFORM; var x, y, z, w: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_transform_coordinates_3d_projective (var trans: ALLEGRO_TRANSFORM; var x, y, z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_compose_transform (var trans, other: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_current_transform: ALLEGRO_TRANSFORMptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_current_inverse_transform: ALLEGRO_TRANSFORMptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_current_projection_transform: ALLEGRO_TRANSFORMptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_invert_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_transpose_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
function al_check_inverse (var trans: ALLEGRO_TRANSFORM; tol: AL_FLOAT): AL_BOOL; inline; |
procedure al_orthographic_transform (var trans: ALLEGRO_TRANSFORM; left, top, n, right, bottom, f: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_perspective_transform (var trans: ALLEGRO_TRANSFORM; left, top, n, right, bottom, f: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_horizontal_shear_transform (var trans: ALLEGRO_TRANSFORM; theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_vertical_shear_transform (var trans: ALLEGRO_TRANSFORM; theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
function al_create_shader (platform: ALLEGRO_SHADER_PLATFORM): ALLEGRO_SHADERptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_attach_shader_source (shader: ALLEGRO_SHADERptr; aType: ALLEGRO_SHADER_TYPE; const Source: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_attach_shader_source_file (shader: ALLEGRO_SHADERptr; aType: ALLEGRO_SHADER_TYPE; const filename: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_build_shader (shader: ALLEGRO_SHADERptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_shader_log (shader: ALLEGRO_SHADERptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_shader_platform (shader: ALLEGRO_SHADERptr): ALLEGRO_SHADER_PLATFORM; CDECL; external ALLEGRO_LIB_NAME; |
function al_use_shader (shader: ALLEGRO_SHADERptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_shader (shader: ALLEGRO_SHADERptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_sampler (const name: AL_STR; bitmap: ALLEGRO_BITMAPptr; aUnit: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_matrix (const name: AL_STR; var matrix: ALLEGRO_TRANSFORM): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_int (const name: AL_STR; i: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_float (const name: AL_STR; f: AL_FLOAT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_int_vector (const name: AL_STR; num_components: AL_INT; i: AL_INTptr; num_elems: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_float_vector (const name: AL_STR; num_components: AL_INT; f: AL_FLOATptr; num_elems: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_set_shader_bool (const name: AL_STR; b: AL_BOOL): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_default_shader_source (platform: ALLEGRO_SHADER_PLATFORM; aType: ALLEGRO_SHADER_TYPE): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_init: AL_BOOL; inline; |
function al_install_system (version: AL_INT; atexit_ptr: AL_POINTER): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_uninstall_system; CDECL; external ALLEGRO_LIB_NAME; |
function al_is_system_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_system_config: ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_system_id: ALLEGRO_SYSTEM_ID; CDECL; external ALLEGRO_LIB_NAME; |
function al_inhibit_screensaver (inhibit: AL_BOOL): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function ALLEGRO_USECS_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
function ALLEGRO_MSECS_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
function ALLEGRO_BPS_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
function ALLEGRO_BPM_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
function al_create_timer (speed_secs: AL_DOUBLE): ALLEGRO_TIMERptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_destroy_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_start_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_stop_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_resume_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_timer_started (const timer: ALLEGRO_TIMERptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
function al_get_timer_speed (const timer: ALLEGRO_TIMERptr): AL_DOUBLE; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_timer_speed (timer: ALLEGRO_TIMERptr; speed_secs: AL_DOUBLE); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_timer_count (const timer: ALLEGRO_TIMERptr): AL_INT64; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_set_timer_count (timer: ALLEGRO_TIMERptr; count: AL_INT64); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_add_timer_count (timer: ALLEGRO_TIMERptr; diff: AL_INT64); CDECL; external ALLEGRO_LIB_NAME; |
function al_get_timer_event_source (timer: ALLEGRO_TIMERptr): ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
procedure al_store_state (out state: ALLEGRO_STATE; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
procedure al_restore_state (var state: ALLEGRO_STATE); CDECL; external ALLEGRO_LIB_NAME; |
function _al_load_bitmap_f (fp: ALLEGRO_FILEptr; const ident: AL_STRptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME name 'al_load_bitmap_f'; |
function _al_load_bitmap_flags_f (fp: ALLEGRO_FILEptr; const ident: AL_STRptr; flags: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME name 'al_load_bitmap_flags_f'; |
procedure _al_set_memory_interface_ (iface: AL_POINTER); CDECL; external ALLEGRO_LIB_NAME name 'al_set_memory_interface'; |
function _al_check_inverse (var trans: ALLEGRO_TRANSFORM; tol: AL_FLOAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME name 'al_check_inverse'; |
procedure _al_join_thread (outer: ALLEGRO_THREADptr; ret_value: AL_POINTER); CDECL; external ALLEGRO_LIB_NAME name 'al_join_thread'; |
Types
Constants
Description
Functions and Procedures
function al_get_allegro_version: AL_UINT32; CDECL; external ALLEGRO_LIB_NAME; |
Returns the compiled version of the Allegro library (i.e. the dll/so/dylib file), packed into a single integer as groups of 8 bits.
You can use code like this to extract the version number:
VAR
Version: LONGINT;
Major, Minor, Revision, Release: INTEGER;
VersionStr: STRING;
BEGIN
Version := al_get_allegro_version;
Major := Version SHR 24;
Minor := (Version SHR 16) AND 255;
Revision := (Version SHR 8) AND 255;
Release := Version AND 255;
VersionStr := Format ('%d.%d.%d[%d]', [Major, Minor, Revision, Release])
END;
The release number is 0 for an unofficial version and 1 or greater for an official release. For example "5.0.2[1]" would be the (first) official 5.0.2 release while "5.0.2[0]" would be a compile of a version from the "5.0.2" branch before the official release.
Remember this version number isn't for Allegro.pas but for Allegro. In most cases will not be the same than ALLEGRO_VERSION_INT.
See also
- ALLEGRO_VERSION_INT
- Packs Allegro's version number in a simple AL_INT number.
|
function al_run_main (argc: AL_INT; argv: AL_POINTER; user_main: ALLEGRO_USER_MAIN): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
This function is useful in cases where you don't have a main function but want to run Allegro (mostly useful in a wrapper library). Under Windows and Linux this is no problem because you simply can call al_install_system. But some other system (like OSX) don't allow calling al_install_system in the main thread. al_run_main will know what to do in that case.
The passed argc and argv will simply be passed on to user_main and the return value of user_main will be returned.
Note
This is used because the way the C language works. I didn't test if Pascal do need this kind of stuff. Future versions of Allegro.pas would not include this function, so don't use it unless your really need to (and tell me if you really need it to remove this warning from documentation).
|
function AL_ID (const str: AL_STR): AL_INT; |
This function can be used to create a packed 32 bit integer from 8 bit characters, on both 32 and 64 bit machines. These can be used for various things, like custom datafile objects or system IDs. Example:
VAR
OSTYPE_LINUX: LONGINT;
BEGIN
OSTYPE_LINUX := AL_ID('TUX ');
END;
|
function al_get_time: AL_DOUBLE; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of seconds since the Allegro library was initialised. The return value is undefined if Allegro is uninitialised. The resolution depends on the used driver, but typically can be in the order of microseconds.
See also
- al_rest
- Waits for the specified number of seconds.
|
procedure al_rest (seconds: AL_DOUBLE); CDECL; external ALLEGRO_LIB_NAME; |
Waits for the specified number of seconds. This tells the system to pause the current thread for the given amount of time. With some operating systems, the accuracy can be in the order of 10ms. That is, even al_rest (0.000001) might pause for something like 10ms. Also see the other timer rutines (i.e. al_create_timer) for easier ways to time your program without using up all CPU.
See also
- al_get_time
- Returns the number of seconds since the Allegro library was initialised.
- al_init_timeout
- Sets timeout value of some number of seconds after the function call.
|
procedure al_init_timeout (out timeout: ALLEGRO_TIMEOUT; seconds: AL_DOUBLE); CDECL; external ALLEGRO_LIB_NAME; |
Sets timeout value of some number of seconds after the function call.
For compatibility with all platforms, seconds must be 2,147,483.647 seconds or less.
See also
- ALLEGRO_TIMEOUT
- Represents a timeout value.
- al_wait_for_event_until
- Waits until the event queue specified is non-empty.
|
function al_map_rgb (r, g, b: AL_UCHAR): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
Converts r, g, b (ranging from 0-255) into an ALLEGRO_COLOR, using 255 for alpha.
See also
- al_map_rgba
- Convert r, g, b, a (ranging from 0-255) into an ALLEGRO_COLOR.
- al_map_rgba_f
- Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR.
- al_map_rgb_f
- Convert r, g, b (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR, using 1.0f for alpha.
|
function al_map_rgba (r, g, b, a: AL_UCHAR): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
Convert r, g, b, a (ranging from 0-255) into an ALLEGRO_COLOR.
See also
- al_map_rgb
- Converts r, g, b (ranging from 0-255) into an ALLEGRO_COLOR, using 255 for alpha.
- al_map_rgba_f
- Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR.
- al_map_rgb_f
- Convert r, g, b (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR, using 1.0f for alpha.
|
function al_map_rgb_f (r, g, b: AL_FLOAT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
Convert r, g, b (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR, using 1.0f for alpha.
See also
- al_map_rgba
- Convert r, g, b, a (ranging from 0-255) into an ALLEGRO_COLOR.
- al_map_rgba_f
- Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR.
- al_map_rgb
- Converts r, g, b (ranging from 0-255) into an ALLEGRO_COLOR, using 255 for alpha.
|
function al_map_rgba_f (r, g, b, a: AL_FLOAT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR. seealso(al_map_rgba)
See also
- al_map_rgba_f
- Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR.
- al_map_rgb
- Converts r, g, b (ranging from 0-255) into an ALLEGRO_COLOR, using 255 for alpha.
|
function al_premul_rgba (r, g, b: AL_UCHAR): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
This is a shortcut for al_map_rgba (r * a / 255, g * a / 255, b * a / 255, a) .
By default Allegro uses pre-multiplied alpha for transparent blending of bitmaps and primitives (see al_load_bitmap_flags for a discussion of that feature). This means that if you want to tint a bitmap or primitive to be transparent you need to multiply the color components by the alpha components when you pass them to this function. For example:
VAR
c: ALLEGRO_COLOR;
bmp: ALLEGRO_BITMAPptr;
BEGIN
c := al_premul_rgba (255, 0, 0, 127);
al_draw_tinted_bitmap (bmp, c, 0, 0, 0);
END;
See also
- al_map_rgba
- Convert r, g, b, a (ranging from 0-255) into an ALLEGRO_COLOR.
- al_premul_rgba_f
- This is a shortcut for
al_map_rgba (r * a, g * a, b * a, a) .
|
function al_premul_rgba_f (r, g, b: AL_FLOAT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
This is a shortcut for al_map_rgba (r * a, g * a, b * a, a) .
By default Allegro uses pre-multiplied alpha for transparent blending of bitmaps and primitives (see al_load_bitmap_flags for a discussion of that feature). This means that if you want to tint a bitmap or primitive to be transparent you need to multiply the color components by the alpha components when you pass them to this function. For example:
VAR
c: ALLEGRO_COLOR;
bmp: ALLEGRO_BITMAPptr;
BEGIN
c := al_premul_rgba_f (1, 0, 0, 0.5);
al_draw_tinted_bitmap (bmp, c, 0, 0, 0);
END;
See also
- al_map_rgba_f
- Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR.
- al_premul_rgba
- This is a shortcut for
al_map_rgba (r * a / 255, g * a / 255, b * a / 255, a) .
|
function al_get_pixel_size (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of bytes that a pixel of the given format occupies. For blocked pixel formats (e.g. compressed formats), this returns 0.
See also
- ALLEGRO_PIXEL_FORMAT
- Pixel formats.
- al_get_pixel_format_bits
- Returns the number of bits that a pixel of the given format occupies.
|
function al_get_pixel_format_bits (format: ALLEGRO_PIXEL_FORMAT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of bits that a pixel of the given format occupies. For blocked pixel formats (e.g. compressed formats), this returns 0.
See also
- ALLEGRO_PIXEL_FORMAT
- Pixel formats.
- al_get_pixel_size
- Returns the number of bytes that a pixel of the given format occupies.
|
procedure al_set_new_bitmap_format (format: ALLEGRO_PIXEL_FORMAT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the pixel format for newly created bitmaps. The default format is ALLEGRO_PIXEL_FORMAT_ANY and means the display driver will choose the best format.
See also
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
- ALLEGRO_PIXEL_FORMAT
- Pixel formats.
- al_get_new_bitmap_format
- Returns the format used for newly created bitmaps.
|
procedure al_set_new_bitmap_flags (flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the flags to use for newly created bitmaps. Valid flags are:
- ALLEGRO_MEMORY_BITMAP
Creates a bitmap residing in system memory. Operations on, and with, memory bitmaps will not be hardware accelerated. However, direct pixel access can be relatively quick compared to video bitmaps, which depend on the display driver in use.
Note: Allegro's software rendering routines are currently somewhat unoptimised.
Note: Combining ALLEGRO_VIDEO_BITMAP with ALLEGRO_MEMORY_BITMAP flags is invalid.
- ALLEGRO_VIDEO_BITMAP
Creates a bitmap that resides in the video card memory. These types of bitmaps receive the greatest benefit from hardware acceleration.
Note: Creating a video bitmap will fail if there is no current display or the current display driver cannot create the bitmap. The latter will happen if for example the format or dimensions are not supported.
Note: Bitmaps created with this flag will be converted to memory bitmaps when the last display is destroyed. In most cases it is therefore easier to use the ALLEGRO_CONVERT_BITMAP flag instead.
Note: Combining ALLEGRO_VIDEO_BITMAP with ALLEGRO_MEMORY_BITMAP flags is invalid.
- ALLEGRO_CONVERT_BITMAP
This is the default. It will try to create a video bitmap and if that fails create a memory bitmap. Bitmaps created with this flag when there is no active display will be converted to video bitmaps next time a display is created. They also will remain video bitmaps if the last display is destroyed and then another is created again.
Note: You can combine this flag with ALLEGRO_MEMORY_BITMAP or ALLEGRO_VIDEO_BITMAP to force the initial type (and fail in the latter case if no video bitmap can be created) - but usually neither of those combinations is very useful.
You can use the display option ALLEGRO_AUTO_CONVERT_BITMAPS to control which displays will try to auto-convert bitmaps.
- ALLEGRO_NO_PRESERVE_TEXTURE
Normally, every effort is taken to preserve the contents of bitmaps, since some platforms may forget them. This can take extra processing time. If you know it doesn't matter if a bitmap keeps its pixel data, for example when it's a temporary buffer, use this flag to tell Allegro not to attempt to preserve its contents.
- ALLEGRO_ALPHA_TEST
This is a driver hint only. It tells the graphics driver to do alpha testing instead of alpha blending on bitmaps created with this flag. Alpha testing is usually faster and preferred if your bitmaps have only one level of alpha (0). This flag is currently not widely implemented (i.e., only for memory bitmaps).
- ALLEGRO_MIN_LINEAR
When drawing a scaled down version of the bitmap, use linear filtering. This usually looks better. You can also combine it with the ALLEGRO_MIPMAP flag for even better quality.
- ALLEGRO_MAG_LINEAR
When drawing a magnified version of a bitmap, use linear filtering. This will cause the picture to get blurry instead of creating a big rectangle for each pixel. It depends on how you want things to look like whether you want to use this or not.
- ALLEGRO_MIPMAP
This can only be used for bitmaps whose width and height is a power of two. In that case, it will generate mipmaps and use them when drawing scaled down versions. For example if the bitmap is 64x64, then extra bitmaps of sizes 32x32, 16x16, 8x8, 4x4, 2x2 and 1x1 will be created always containing a scaled down version of the original.
See also
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
- al_add_new_bitmap_flag
- A convenience function which does the same as
al_set_new_bitmap_flags (al_get_new_bitmap_flags OR flag);
- al_get_new_bitmap_flags
- Returns the format used for newly created bitmaps.
- al_get_bitmap_flags
- Returns the flags user to create the bitmap.
|
procedure al_add_new_bitmap_flag (flag: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
A convenience function which does the same as
al_set_new_bitmap_flags (al_get_new_bitmap_flags OR flag);
See also
- al_set_new_bitmap_flags
- Sets the flags to use for newly created bitmaps.
- al_get_new_bitmap_flags
- Returns the format used for newly created bitmaps.
- al_get_bitmap_flags
- Returns the flags user to create the bitmap.
|
function al_get_bitmap_width (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the width of a bitmap in pixels.
|
function al_get_bitmap_height (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the height of a bitmap in pixels.
|
function al_create_bitmap (w, h: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a new bitmap using the bitmap format and flags for the current thread. Blitting between bitmaps of differing formats, or blitting between memory bitmaps and display bitmaps may be slow.
Unless you set the ALLEGRO_MEMORY_BITMAP flag, the bitmap is created for the current display. Blitting to another display may be slow.
If a display bitmap is created, there may be limitations on the allowed dimensions. For example a DirectX or OpenGL backend usually has a maximum allowed texture size - so if bitmap creation fails for very large dimensions, you may want to re-try with a smaller bitmap. Some platforms also dictate a minimum texture size, which is relevant if you plan to use this bitmap with the primitives addon. If you try to create a bitmap smaller than this, this call will not fail but the returned bitmap will be a section of a larger bitmap with the minimum size. The minimun size that will work on all platforms is 32 by 32.
Some platforms do not directly support display bitmaps whose dimensions are not powers of two. Allegro handles this by creating a larger bitmap that has dimensions that are powers of two and then returning a section of that bitmap with the dimensions you requested. This can be relevant if you plan to use this bitmap with the primitives addon but shouldn't be an issue otherwise.
If you create a bitmap without ALLEGRO_MEMORY_BITMAP set but there is no current display, a temporary memory bitmap will be created instead. You can later convert all such bitmap to video bitmap and assign to a display by calling al_convert_memory_bitmaps.
On some platforms the contents of video bitmaps may be lost when your application loses focus. Allegro has an internal mechanism to restore the contents of these video bitmaps, but it is not foolproof (sometimes bitmap contents can get lost permanently) and has performance implications. If you are using a bitmap as an intermediate buffer this mechanism may be wasteful. In this case, if you do not want Allegro to manage the bitmap contents for you, you can disable this mechanism by creating the bitmap with the ALLEGRO_NO_PRESERVE_TEXTURE flag. The bitmap contents are lost when you get the ALLEGRO_EVENT_DISPLAY_LOST and ALLEGRO_EVENT_DISPLAY_HALT_DRAWING and a should be restored when you get the ALLEGRO_EVENT_DISPLAY_FOUND and when you call al_acknowledge_drawing_resume (after ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING event). You can use those events to implement your own bitmap content restoration mechanism if Allegro's does not work well enough for you (for example, you can reload them all from disk).
Note: The contents of a newly created bitmap are undefined - you need to clear the bitmap or make sure all pixels get overwritten before drawing it.
When you are done with using the bitmap you must call al_destroy_bitmap on it to free any resources allocated for it.
See also
- al_set_new_bitmap_format
- Sets the pixel format for newly created bitmaps.
- al_set_new_bitmap_flags
- Sets the flags to use for newly created bitmaps.
- al_clone_bitmap
- Creates a new bitmap with
al_create_bitmap , and copyes the pixel data from the old bitmap across.
- al_create_sub_bitmap
- Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size.
- al_convert_memory_bitmaps
- If you create a bitmap when there is no current display (for example because you have not called al_create_display in the current thread) and are using the
ALLEGRO_CONVERT_BITMAP bitmap flag (which is set by default) then the bitmap will be created successfully, but as a memory bitmap.
- al_destroy_bitmap
- Destroys the given bitmap, freeing all resources used by it.
|
procedure al_destroy_bitmap (Bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
Destroys the given bitmap, freeing all resources used by it. This function does nothing if the bitmap argument is Nil .
As a convenience, if the calling thread is currently targeting the bitmap then the bitmap will be untargeted first. The new target bitmap is unspecified.
Otherwise, it is an error to destroy a bitmap while it (or a sub-bitmap) is the target bitmap of any thread.
See also
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
|
procedure al_put_pixel (x, y: AL_INT; color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
Draws a single pixel on the target bitmap. This operation is slow on non-memory bitmaps. Consider locking the bitmap if you are going to use this function multiple times on the same bitmap. This function is not affected by the transformations or the color blenders.
See also
- ALLEGRO_COLOR
- An
ALLEGRO_COLOR structure describes a color in a device independent way.
- al_get_pixel
- Gets a pixel's color value from the specified bitmap.
- al_put_blended_pixel
- Like al_put_pixel, but the pixel color is blended using the current blenders before being drawn.
- al_lock_bitmap
- Locks an entire bitmap for reading or writing.
|
procedure al_put_blended_pixel (x, y: AL_INT; color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
Like al_put_pixel, but the pixel color is blended using the current blenders before being drawn.
|
function al_get_pixel (bitmap: ALLEGRO_BITMAPptr; x, y: AL_INT): ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
Gets a pixel's color value from the specified bitmap. This operation is slow on non-memory bitmaps. Consider locking the bitmap if you are going to use this function multiple times on the same bitmap.
See also
- ALLEGRO_COLOR
- An
ALLEGRO_COLOR structure describes a color in a device independent way.
- al_put_pixel
- Draws a single pixel on the target bitmap.
- al_lock_bitmap
- Locks an entire bitmap for reading or writing.
|
procedure al_convert_mask_to_alpha (bitmap: ALLEGRO_BITMAPptr; mask_color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
Converts the given mask color to an alpha channel in the bitmap. Can be used to convert older 4.2-style bitmaps with magic pink to alpha-ready bitmaps.
See also
- ALLEGRO_COLOR
- An
ALLEGRO_COLOR structure describes a color in a device independent way.
|
procedure al_set_clipping_rectangle (x, y, width, height: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the region of the target bitmap or display that pixels get clipped to. The default is to clip pixels to the entire bitmap.
See also
- al_get_clipping_rectangle
- Gets the clipping rectangle of the target bitmap.
- al_reset_clipping_rectangle
- Equivalent to calling
al_set_clipping_rectangle (0, 0, w, h) where w and h are the width and height of the target bitmap respectively.
|
procedure al_reset_clipping_rectangle; CDECL; external ALLEGRO_LIB_NAME; |
Equivalent to calling al_set_clipping_rectangle (0, 0, w, h) where w and h are the width and height of the target bitmap respectively.
Does nothing if there is no target bitmap.
See also
- al_set_clipping_rectangle
- Sets the region of the target bitmap or display that pixels get clipped to.
|
procedure al_get_clipping_rectangle (out x, y, w, h: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Gets the clipping rectangle of the target bitmap.
See also
- al_set_clipping_rectangle
- Sets the region of the target bitmap or display that pixels get clipped to.
|
function al_create_sub_bitmap (parent: ALLEGRO_BITMAPptr; x, y, w, h: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size. A sub-bitmap is a bitmap that shares drawing memory with a pre-existing (parent) bitmap, but possibly with a different size and clipping settings.
The sub-bitmap may originate off or extend past the parent bitmap.
See the discussion in al_get_backbuffer about using sub-bitmaps of the backbuffer.
The parent bitmap's clipping rectangles are ignored.
If a sub-bitmap was not or cannot be created then Nil is returned.
When you are done with using the sub-bitmap you must call al_destroy_bitmap on it to free any resources allocated for it.
Note that destroying parents of sub-bitmaps will not destroy the sub-bitmaps; instead the sub-bitmaps become invalid and should no longer be used for drawing - they still must be destroyed with al_destroy_bitmap however. It does not matter whether you destroy a sub-bitmap before or after its parent otherwise.
See also
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
- al_is_sub_bitmap
- Returns true if the specified bitmap is a sub-bitmap, false otherwise.
- al_get_parent_bitmap
- Returns the bitmap this bitmap is a sub-bitmap of.
|
function al_is_sub_bitmap (bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns true if the specified bitmap is a sub-bitmap, false otherwise.
See also
- al_create_sub_bitmap
- Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size.
- al_get_parent_bitmap
- Returns the bitmap this bitmap is a sub-bitmap of.
|
function al_get_parent_bitmap (bitmap: ALLEGRO_BITMAPptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns the bitmap this bitmap is a sub-bitmap of. Returns Nil if this bitmap is not a sub-bitmap. This function always returns the real bitmap, and never a sub-bitmap. This might NOT match what was passed to al_create_sub_bitmap . Consider this code, for instance:
VAR
a, b, c: ALLEGRO_BITMAPptr;
BEGIN
a := al_create_bitmap (512, 512);
b := al_create_sub_bitmap (a, 128, 128, 256, 256);
c := al_create_sub_bitmap (b, 64, 64, 128, 128);
IF (al_get_parent_bitmap (b) = a) AND (al_get_parent_bitmap (c) = a) THEN
WriteLn ('b & c are sub-bitmaps of a')
END;
The message will be printed because only a is a real bitmap, and both b and c are its sub-bitmaps.
See also
- al_create_sub_bitmap
- Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size.
- al_is_sub_bitmap
- Returns true if the specified bitmap is a sub-bitmap, false otherwise.
|
function al_get_bitmap_x (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
For a sub-bitmap, returns it's x position within the parent.
See also
- al_create_sub_bitmap
- Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size.
- al_get_parent_bitmap
- Returns the bitmap this bitmap is a sub-bitmap of.
- al_get_bitmap_y
- For a sub-bitmap, returns it's y position within the parent.
|
function al_get_bitmap_y (bitmap: ALLEGRO_BITMAPptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
For a sub-bitmap, returns it's y position within the parent.
See also
- al_create_sub_bitmap
- Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size.
- al_get_parent_bitmap
- Returns the bitmap this bitmap is a sub-bitmap of.
- al_get_bitmap_x
- For a sub-bitmap, returns it's x position within the parent.
|
procedure al_reparent_bitmap (bitmap, parent: ALLEGRO_BITMAPptr; x, y, w, h: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
For a sub-bitmap, changes the parent, position and size. This is the same as destroying the bitmap and re-creating it with al_create_sub_bitmap - except the bitmap pointer stays the same. This has many uses, for example an animation player could return a single bitmap which can just be re-parented to different animation frames without having to re-draw the contents. Or a sprite atlas could re-arrange its sprites without having to invalidate all existing bitmaps.
See also
- al_create_sub_bitmap
- Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size.
- al_get_parent_bitmap
- Returns the bitmap this bitmap is a sub-bitmap of.
|
function al_clone_bitmap (bitmap: ALLEGRO_BITMAPptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a new bitmap with al_create_bitmap , and copyes the pixel data from the old bitmap across. The newly created bitmap will be created with the current new bitmap flags, and not the ones that were used to create the original bitmap. If the new bitmap is a memory bitmap, its projection bitmap is reset to be orthographic.
See also
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
- al_set_new_bitmap_format
- Sets the pixel format for newly created bitmaps.
- al_set_new_bitmap_flags
- Sets the flags to use for newly created bitmaps.
- al_convert_bitmap
- Converts the bitmap to the current bitmap flags and format.
|
procedure al_convert_bitmap (bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
Converts the bitmap to the current bitmap flags and format. The bitmap will be as if it was created new with al_create_bitmap but retain its contents. All of this bitmap's sub-bitmaps are also converted. If the new bitmap type is memory, then the bitmap's projection bitmap is reset to be orthographic.
If this bitmap is a sub-bitmap, then it, its parent and all the sibling sub-bitmaps are also converted.
See also
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
- al_set_new_bitmap_format
- Sets the pixel format for newly created bitmaps.
- al_set_new_bitmap_flags
- Sets the flags to use for newly created bitmaps.
- al_clone_bitmap
- Creates a new bitmap with
al_create_bitmap , and copyes the pixel data from the old bitmap across.
|
procedure al_convert_memory_bitmaps; CDECL; external ALLEGRO_LIB_NAME; |
If you create a bitmap when there is no current display (for example because you have not called al_create_display in the current thread) and are using the ALLEGRO_CONVERT_BITMAP bitmap flag (which is set by default) then the bitmap will be created successfully, but as a memory bitmap. This function converts all such bitmaps to proper video bitmaps belonging to the current display.
Note that video bitmaps get automatically converted back to memory bitmaps when the last display is destroyed.
This operation will preserve all bitmap flags except ALLEGRO_VIDEO_BITMAP and ALLEGRO_MEMORY_BITMAP .
See also
- al_convert_bitmap
- Converts the bitmap to the current bitmap flags and format.
- al_create_bitmap
- Creates a new bitmap using the bitmap format and flags for the current thread.
|
procedure al_draw_bitmap (bitmap: ALLEGRO_BITMAPptr; dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Draws an unscaled, unrotated bitmap at the given position to the current target bitmap. flags can be a combination of:
Note
The current target bitmap must be a different bitmap. Drawing a bitmap to itself (or to a sub-bitmap of itself) or drawing a sub-bitmap to its parent (or another sub-bitmap of its parent) are not currently supported. To copy part of a bitmap into the same bitmap simply use a temporary bitmap instead.
Note
The backbuffer (or a sub-bitmap thereof) can not be transformed, blended or tinted. If you need to draw the backbuffer draw it to a temporary bitmap first with no active transformation (except translation). Blending and tinting settings/parameters will be ignored. This does not apply when drawing into a memory bitmap.
Parameters
- bitmap
- Origin bitmap.
- dx
- Destination x.
- dy
- Destination y.
- flags
- Read description above.
See also
- al_set_target_bitmap
- This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to.
- al_draw_bitmap_region
- Draws a region of the given bitmap to the target bitmap.
- al_draw_scaled_bitmap
- Draws a scaled version of the given bitmap to the target bitmap.
- al_draw_rotated_bitmap
- Draws a rotated version of the given bitmap to the target bitmap.
- al_draw_scaled_rotated_bitmap
- Like al_draw_rotated_bitmap, but can also scale the bitmap.
|
procedure al_draw_bitmap_region (bitmap: ALLEGRO_BITMAPptr; sx, sy, sw, sh, dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Draws a region of the given bitmap to the target bitmap.
See al_draw_bitmap for a note on restrictions on which bitmaps can be drawn where.
Parameters
- bitmap
- Origin bitmap.
- sx
- source x
- sy
- source y
- sw
- source width (width of region to blit)
- sh
- source height (height of region to blit)
- dx
- destination x
- dy
- destination y
- flags
- same as for
al_draw_bitmap
See also
- al_draw_bitmap
- Draws an unscaled, unrotated bitmap at the given position to the current target bitmap.
- al_draw_scaled_bitmap
- Draws a scaled version of the given bitmap to the target bitmap.
- al_draw_rotated_bitmap
- Draws a rotated version of the given bitmap to the target bitmap.
- al_draw_scaled_rotated_bitmap
- Like al_draw_rotated_bitmap, but can also scale the bitmap.
|
procedure al_draw_scaled_bitmap (bitmap: ALLEGRO_BITMAPptr; sx, sy, sw, sh, dx, dy, dw, dh: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Draws a scaled version of the given bitmap to the target bitmap.
See al_draw_bitmap for a note on restrictions on which bitmaps can be drawn where.
Parameters
- bitmap
- Origin bitmap.
- sx
- source x
- sy
- source y
- sw
- source width
- sh
- source height
- dx
- destination x
- dy
- destination y
- dw
- destination width
- dh
- destination height
- flags
- same as for al_draw_bitmap
See also
- al_draw_bitmap
- Draws an unscaled, unrotated bitmap at the given position to the current target bitmap.
- al_draw_bitmap_region
- Draws a region of the given bitmap to the target bitmap.
- al_draw_rotated_bitmap
- Draws a rotated version of the given bitmap to the target bitmap.
- al_draw_scaled_rotated_bitmap
- Like al_draw_rotated_bitmap, but can also scale the bitmap.
|
procedure al_draw_rotated_bitmap (bitmap: ALLEGRO_BITMAPptr; cx, cy, dx, dy, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Draws a rotated version of the given bitmap to the target bitmap.
The point at cx/cy relative to the upper left corner of the bitmap will be drawn at dx/dy and the bitmap is rotated around this point. If cx,cy is 0,0 the bitmap will rotate around its upper left corner.
Example:
VAR
w, h: SINGLE;
BEGIN
w := al_get_bitmap_width (bitmap);
h := al_get_bitmap_height (bitmap);
al_draw_rotated_bitmap (bitmap, w / 2, h / 2, x, y, ALLEGRO_PI / 2, 0)
END;
The above code draws the bitmap centered on x/y and rotates it 90° clockwise.
See al_draw_bitmap for a note on restrictions on which bitmaps can be drawn where.
Parameters
- bitmap
- Origin bitmap.
- cx
- center x (relative to the left of bitmap)
- cy
- center y (relative to the top or bitmap)
- dx
- destination x
- dy
- destination y
- angle
- angle in radians by which to rotate clockwise
- flags
- same as for al_draw_bitmap
See also
- al_draw_bitmap
- Draws an unscaled, unrotated bitmap at the given position to the current target bitmap.
- al_draw_bitmap_region
- Draws a region of the given bitmap to the target bitmap.
- al_draw_scaled_bitmap
- Draws a scaled version of the given bitmap to the target bitmap.
- al_draw_scaled_rotated_bitmap
- Like al_draw_rotated_bitmap, but can also scale the bitmap.
|
procedure al_draw_scaled_rotated_bitmap (bitmap: ALLEGRO_BITMAPptr; cx, cy, dx, dy, xscale, yscale, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Like al_draw_rotated_bitmap, but can also scale the bitmap.
The point at cx/cy in the bitmap will be drawn at dx/dy and the bitmap is rotated and scaled around this point.
See al_draw_bitmap for a note on restrictions on which bitmaps can be drawn where.
Parameters
- bitmap
- Origin bitmap.
- cx
- center x (relative to the left of bitmap)
- cy
- center y (relative to the top or bitmap)
- dx
- destination x
- dy
- destination y
- xscale
- how much to scale on the x-axis (e.g. 2 for twice the size)
- yscale
- how much to scale on the y-axis
- angle
- angle in radians by which to rotate clockwise
- flags
- same as for al_draw_bitmap
See also
- al_draw_bitmap
- Draws an unscaled, unrotated bitmap at the given position to the current target bitmap.
- al_draw_bitmap_region
- Draws a region of the given bitmap to the target bitmap.
- al_draw_scaled_bitmap
- Draws a scaled version of the given bitmap to the target bitmap.
|
procedure al_draw_tinted_bitmap (bitmap: ALLEGRO_BITMAPptr; tint: ALLEGRO_COLOR; dx, dy: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Like al_draw_bitmap but multiplies all colors in the bitmap with the given color. For example:
al_draw_tinted_bitmap (bitmap, al_map_rgba_f (0.5, 0.5, 0.5, 0.5), x, y, 0);
The above will draw the bitmap 50% transparently (r/g/b values need to be pre-multiplied with the alpha component with the default blend mode).
al_draw_tinted_bitmap(bitmap, al_map_rgba_f(1, 0, 0, 1), x, y, 0);
The above will only draw the red component of the bitmap.
See al_draw_bitmap for a note on restrictions on which bitmaps can be drawn where.
See also
- al_draw_bitmap
- Draws an unscaled, unrotated bitmap at the given position to the current target bitmap.
- al_draw_tinted_bitmap_region
- Like al_draw_bitmap_region but multiplies all colors in the bitmap with the given color.
- al_draw_tinted_scaled_bitmap
- Like al_draw_scaled_bitmap but multiplies all colors in the bitmap with the given color.
- al_draw_tinted_rotated_bitmap
- Like al_draw_rotated_bitmap but multiplies all colors in the bitmap with the given color.
- al_draw_tinted_scaled_rotated_bitmap
- Like al_draw_scaled_rotated_bitmap but multiplies all colors in the bitmap with the given color.
- al_draw_tinted_scaled_rotated_bitmap_region
- Like al_draw_tinted_scaled_rotated_bitmap but you specify an area within the bitmap to be drawn.
|
procedure al_draw_tinted_scaled_rotated_bitmap_region (bitmap: ALLEGRO_BITMAPptr; sx, sy, sw, sh: AL_FLOAT; tint: ALLEGRO_COLOR; cx, cy, dx, dy, xscale, yscale, angle: AL_FLOAT; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Like al_draw_tinted_scaled_rotated_bitmap but you specify an area within the bitmap to be drawn.
You can get the same effect with a sub bitmap:
al_draw_tinted_scaled_rotated_bitmap_region (
bitmap, sx, sy, sw, sh, tint,
cx, cy, dx, dy, xscale, yscale, angle, flags
);
sub_bitmap := al_create_sub_bitmap (bitmap, sx, sy, sw, sh);
al_draw_tinted_scaled_rotated_bitmap (
sub_bitmap, tint, cx, cy,
dx, dy, xscale, yscale, angle, flags
);
See al_draw_bitmap for a note on restrictions on which bitmaps can be drawn where.
See also
- al_draw_tinted_bitmap
- Like al_draw_bitmap but multiplies all colors in the bitmap with the given color.
|
function al_fopen (const path, mode: AL_STR): ALLEGRO_FILEptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates and opens a file (real or virtual) given the path and mode. The current file interface is used to open the file.
Depending on the stream type and the mode string, files may be opened in "text" mode. The handling of newlines is particularly important. For example, using the default stdio-based streams on DOS and Windows platforms, where the native end-of-line terminators are CR+LF sequences, a call to al_fgetc may return just one character ('\n') where there were two bytes (CR+LF ) in the file. When writing out '\n', two bytes would be written instead. (As an aside, '\n' is not defined to be equal to LF either.)
Newline translations can be useful for text files but is disastrous for binary files. To avoid this behaviour you need to open file streams in binary mode by using a mode argument containing a "b", e.g. 'rb' , 'wb .
Parameters
- path
- Path to the file to open.
- mode
- Access mode to open the file in ('r', 'w', etc.).
Returns
a file handle on success, or Nil on error. See also
- al_fclose
- Closes the given file, writing any buffered output data (if any).
- al_set_new_file_interface
- Sets the ALLEGRO_FILE_INTERFACE table for the calling thread.
- al_fopen_interface
- Opens a file using the specified interface, instead of the interface set with al_set_new_file_interface.
- al_fread
- Reads
size bytes into the buffer pointed to by ptr , from the given file.
- al_fwrite
- Write
size bytes from the buffer pointed to by ptr into the given file.
|
function al_fclose (f: ALLEGRO_FILEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Closes the given file, writing any buffered output data (if any).
Returns
True on success, False on failure.
See also
- al_fopen
- Creates and opens a file (real or virtual) given the path and mode.
|
function al_fread (f: ALLEGRO_FILEptr; ptr: AL_POINTER; size: AL_SIZE_T): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
Reads size bytes into the buffer pointed to by ptr , from the given file.
Returns
The number of bytes actually read. If an error occurs, or the end-of-file is reached, the return value is a short byte count (or zero).
al_fread does not distinguish between AL_EOF and other errors. Use al_feof and al_ferror to determine which occurred.
See also
- AL_EOF
- End of file.
- al_fgetc
- Reads and returns next byte in the given file.
- al_fwrite
- Write
size bytes from the buffer pointed to by ptr into the given file.
- al_fread16be
- Reads a 16-bit word in big-endian format (MSB first).
- al_fread16le
- Reads a 16-bit word in little-endian format (LSB first).
- al_fread32be
- Reads a 32-bit word in big-endian format (MSB first).
- al_fread32le
- Reads a 32-bit word in little-endian format (LSB first).
|
function al_fwrite (f: ALLEGRO_FILEptr; const ptr: AL_POINTER; size: AL_SIZE_T): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
Write size bytes from the buffer pointed to by ptr into the given file.
Returns
The number of bytes actually written. If an error occurs, the return value is a short byte count (or zero). See also
- al_fputc
- Writes a single byte to the given file.
- al_fputs
- Writes a string to file.
- al_fread
- Reads
size bytes into the buffer pointed to by ptr , from the given file.
- al_fwrite16be
- Writes a 16-bit word in big-endian format (MSB first).
- al_fwrite16le
- Writes a 16-bit word in little-endian format (LSB first).
- al_fwrite32be
- Writes a 32-bit word in big-endian format (MSB first).
- al_fwrite32le
- Writes a 32-bit word in little-endian format (LSB first).
|
function al_fflush (f: ALLEGRO_FILEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Flushes any pending writes to the given file.
Returns
True on success, False otherwise.
See also
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_ftell (f: ALLEGRO_FILEptr): AL_INT64; CDECL; external ALLEGRO_LIB_NAME; |
Returns the current position in the given file, or -1 on error.
On some platforms this function may not support large files.
See also
- al_fseek
- Sets the current position of the given file to a position relative to that specified by
whence , plus offset number of bytes.
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_fseek (f: ALLEGRO_FILEptr; offset: AL_INT64; whence: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets the current position of the given file to a position relative to that specified by whence , plus offset number of bytes.
whence can be:
ALLEGRO_SEEK_SET - seek relative to beginning of file
ALLEGRO_SEEK_CUR - seek relative to current file position
ALLEGRO_SEEK_END - seek relative to end of file
After a successful seek, the end-of-file indicator is cleared and all pushback bytes are forgotten.
On some platforms this function may not support large files.
Returns
True on success, False on failure.
See also
- al_ftell
- Returns the current position in the given file, or
-1 on error.
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_feof (f: ALLEGRO_FILEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if the end-of-file indicator has been set on the file, i.e. we have attempted to read past the end of the file.
This does not return True if we simply are at the end of the file. The following code correctly reads two bytes, even when the file contains exactly two bytes:
b1 := al_fgetc (f);
b2 := al_fgetc (f);
IF al_feof (f) THEN
ReportError ();
See also
- AL_EOF
- End of file.
- al_ferror
- Returns non-zero if the error indicator is set on the given file, i.e.
- al_fclearerr
- Clears the error indicator for the given file.
|
function al_ferror (f: ALLEGRO_FILEptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns non-zero if the error indicator is set on the given file, i.e. there was some sort of previous error. The error code may be system or file interface specific.
See also
- al_feof
- Returns
True if the end-of-file indicator has been set on the file, i.e.
- al_fclearerr
- Clears the error indicator for the given file.
- al_ferrmsg
- Returns a message string with details about the last error that occurred on the given file handle.
|
function al_ferrmsg (f: ALLEGRO_FILEptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns a message string with details about the last error that occurred on the given file handle. The returned string is empty if there was no error, or if the file interface does not provide more information.
See also
- al_fclearerr
- Clears the error indicator for the given file.
- al_ferror
- Returns non-zero if the error indicator is set on the given file, i.e.
|
procedure al_fclearerr (f: ALLEGRO_FILEptr); CDECL; external ALLEGRO_LIB_NAME; |
Clears the error indicator for the given file.
The standard I/O backend also clears the end-of-file indicator, and other backends should try to do this. However, they may not if it would require too much effort (e.g. PhysicsFS backend), so your code should not rely on it if you need your code to be portable to other backends.
See also
- al_ferror
- Returns non-zero if the error indicator is set on the given file, i.e.
- al_feof
- Returns
True if the end-of-file indicator has been set on the file, i.e.
|
function al_fungetc (f: ALLEGRO_FILEptr; c: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Ungets a single byte from a file. Pushed-back bytes are not written to the file, only made available for subsequent reads, in reverse order.
The number of pushbacks depends on the backend. The standard I/O backend only guarantees a single pushback; this depends on the libc implementation.
For backends that follow the standard behavior, the pushback buffer will be cleared after any seeking or writing; also calls to al_fseek and al_ftell are relative to the number of pushbacks. If a pushback causes the position to become negative, the behavior of al_fseek and al_ftell are undefined.
See also
- al_fgetc
- Reads and returns next byte in the given file.
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_fsize (f: ALLEGRO_FILEptr): AL_INT64; CDECL; external ALLEGRO_LIB_NAME; |
Returns the size of the file, if it can be determined, or -1 otherwise.
|
function al_fgetc (f: ALLEGRO_FILEptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Reads and returns next byte in the given file. Returns a negative number on end of file or if an error occurred.
See also
- al_fputc
- Writes a single byte to the given file.
- al_fungetc
- Ungets a single byte from a file.
|
function al_fputc (f: ALLEGRO_FILEptr; c: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Writes a single byte to the given file. The byte written is the value of c cast to an unsigned char.
Parameters
- c
- byte value to write.
- f
- file to write to.
Returns
the written byte (cast back to an AL_INT) on success, or negative number on error. |
function al_fread16le (f: ALLEGRO_FILEptr): AL_INT16; CDECL; external ALLEGRO_LIB_NAME; |
Reads a 16-bit word in little-endian format (LSB first).
Returns
On success, the 16-bit word. On failure, returns EOF (-1). Since -1 is also a valid return value, use al_feof to check if the end of the file was reached prematurely, or al_ferror to check if an error occurred. See also
- al_fread16be
- Reads a 16-bit word in big-endian format (MSB first).
|
function al_fread16be (f: ALLEGRO_FILEptr): AL_INT16; CDECL; external ALLEGRO_LIB_NAME; |
Reads a 16-bit word in big-endian format (MSB first).
Returns
On success, the 16-bit word. On failure, returns EOF (-1). Since -1 is also a valid return value, use al_feof to check if the end of the file was reached prematurely, or al_ferror to check if an error occurred. See also
- al_fread16le
- Reads a 16-bit word in little-endian format (LSB first).
|
function al_fwrite16le (f: ALLEGRO_FILEptr; w: AL_INT16): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
Writes a 16-bit word in little-endian format (LSB first).
Returns
The number of bytes written: 2 on success, less than 2 on an error. See also
- al_fwrite16be
- Writes a 16-bit word in big-endian format (MSB first).
|
function al_fwrite16be (f: ALLEGRO_FILEptr; w: AL_INT16): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
Writes a 16-bit word in big-endian format (MSB first).
Returns
The number of bytes written: 2 on success, less than 2 on an error. See also
- al_fwrite16le
- Writes a 16-bit word in little-endian format (LSB first).
|
function al_fread32le (f: ALLEGRO_FILEptr): AL_INT32; CDECL; external ALLEGRO_LIB_NAME; |
Reads a 32-bit word in little-endian format (LSB first).
Returns
On success, the 32-bit word. On failure, returns EOF (-1). Since -1 is also a valid return value, use al_feof to check if the end of the file was reached prematurely, or al_ferror to check if an error occurred. See also
- al_fread32be
- Reads a 32-bit word in big-endian format (MSB first).
|
function al_fread32be (f: ALLEGRO_FILEptr): AL_INT32; CDECL; external ALLEGRO_LIB_NAME; |
Reads a 32-bit word in big-endian format (MSB first).
Returns
On success, the 32-bit word. On failure, returns EOF (-1). Since -1 is also a valid return value, use al_feof to check if the end of the file was reached prematurely, or al_ferror to check if an error occurred. See also
- al_fread32le
- Reads a 32-bit word in little-endian format (LSB first).
|
function al_fwrite32le (f: ALLEGRO_FILEptr; l: AL_INT32): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
Writes a 32-bit word in little-endian format (LSB first).
Returns
The number of bytes written: 2 on success, less than 2 on an error. See also
- al_fwrite32be
- Writes a 32-bit word in big-endian format (MSB first).
|
function al_fwrite32be (f: ALLEGRO_FILEptr; l: AL_INT32): AL_SIZE_T; CDECL; external ALLEGRO_LIB_NAME; |
Writes a 32-bit word in big-endian format (MSB first).
Returns
The number of bytes written: 2 on success, less than 2 on an error. See also
- al_fwrite32le
- Writes a 32-bit word in little-endian format (LSB first).
|
function al_fgets (f: ALLEGRO_FILEptr; const p: AL_STRptr; max: AL_SIZE_T): AL_STRptr CDECL; external ALLEGRO_LIB_NAME; |
Reads a string of bytes terminated with a newline or end-of-file into the buffer given. The line terminator(s), if any, are included in the returned string. A maximum of max-1 bytes are read, with one byte being reserved for a NUL terminator.
See al_fopen about translations of end-of-line characters.
Parameters
- f
- File to read from.
- buf
- Buffer to fill.
- max
- Maximum size of buffer.
Returns
The pointer to buf on success. Returns Nil if an error occurred or if the end of file was reached without reading any bytes. See also
- al_fget_ustr
- Read a string of bytes terminated with a newline or end-of-file.
|
function al_fget_ustr (f: ALLEGRO_FILEptr): ALLEGRO_USTRptr; CDECL; external ALLEGRO_LIB_NAME; |
Read a string of bytes terminated with a newline or end-of-file. The line terminator(s), if any, are included in the returned string.
See al_fopen about translations of end-of-line characters.
Returns
On success a pointer to a new ALLEGRO_USTR structure. This must be freed eventually with al_ustr_free. Returns Nil if an error occurred or if the end of file was reached without reading any bytes. See also
- al_fgetc
- Reads and returns next byte in the given file.
- al_fgets
- Reads a string of bytes terminated with a newline or end-of-file into the buffer given.
|
function al_fputs (f: ALLEGRO_FILEptr; const p: AL_STR): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Writes a string to file. Apart from the return value, this is equivalent to al_fwrite (f, p, Length (p));
Note
depending on the stream type and the mode passed to al_fopen, newline characters in the string may or may not be automatically translated to native end-of-line sequences, e.g. CR/LF instead of LF .
Parameters
- f
- File handle to write to.
- p
- String to write.
Returns
A non-negative integer on success, EOF (-1) on error. See also
- al_fwrite
- Write
size bytes from the buffer pointed to by ptr into the given file.
|
function al_fopen_slice (fp: ALLEGRO_FILEptr; initial_size: AL_SIZE_T; const mode: AL_STR): ALLEGRO_FILEptr; CDECL; external ALLEGRO_LIB_NAME; |
Opens a slice (subset) of an already open random access file as if it were a stand alone file. While the slice is open, the parent file handle must not be used in any way.
The slice is opened at the current location of the parent file, up through initial_size bytes. The initial_size may be any non-negative integer that will not exceed the bounds of the parent file.
Seeking with ALLEGRO_SEEK_SET will be relative to this starting location. ALLEGRO_SEEK_END will be relative to the starting location plus the size of the slice.
The mode can be any combination of:
r: read access
w: write access
e: expandable
For example, a mode of 'rw' indicates the file can be read and written. (Note that this is slightly different from the stdio modes.) Keep in mind that the parent file must support random access and be open in normal write mode (not append) for the slice to work in a well defined way.
If the slice is marked as expandable, then reads and writes can happen after the initial end point, and the slice will grow accordingly. Otherwise, all activity is restricted to the initial size of the slice.
A slice must be closed with al_fclose. The parent file will then be positioned immediately after the end of the slice.
See also
- al_fopen
- Creates and opens a file (real or virtual) given the path and mode.
|
function al_get_file_userdata (f: ALLEGRO_FILEptr): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
Returns a pointer to the custom userdata that is attached to the file handle. This is intended to be used by functions that extend ALLEGRO_FILE_INTERFACE.
|
function al_register_bitmap_loader_f (const ext: AL_STR; fs_loader: ALLEGRO_IIO_FS_LOADER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Registers a handler for al_load_bitmap_f.
Parameters
- ext
- File extension. It should include the leading dot ('.') character. It will be matched case-insensitively.
- fs_loader
- The given function used to handle the loading of bitmaps files with the given extension. It may be
Nil to unregister an entry.
Returns
True on success, False on error. Returns False if unregistering an entry that doesn't exist.
See also
- al_register_bitmap_loader
- Registers a handler for al_load_bitmap.
|
function al_register_bitmap_saver_f (const ext: AL_STR; fs_saver: ALLEGRO_IIO_FS_SAVER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Registers a handler for al_save_bitmap_f.
Parameters
- ext
- File extension. It should include the leading dot ('.') character. It will be matched case-insensitively.
- fs_saver
- The given function used to handle the savint of bitmaps files with the given extension. It may be
Nil to unregister an entry.
Returns
True on success, False on error. Returns False if unregistering an entry that doesn't exist.
See also
- al_register_bitmap_saver
- Registers a handler for al_save_bitmap.
|
function al_register_bitmap_identifier (const ext: AL_STR; identifier: ALLEGRO_IIO_IDENTifIER_FUNCTION): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Registers an identify handler for al_identify_bitmap. The given function will be used to detect files for the given extension. It will be called with a single argument of type ALLEGRO_FILEptr which is a file handle opened for reading and located at the first byte of the file. The handler should try to read as few bytes as possible to safely determine if the given file contents correspond to the type with the extension and return True in that case, False otherwise. The file handle must not be closed but there is no need to reset it to the beginning.
Parameters
- ext
- The extension. It should include the leading dot ('.') character. It will be matched case-insensitively.
- identifier
- The identifier handler. It may be
Nil to unregister an entry.
Returns
True on success, False on error. Returns False if unregistering an entry that doesn't exist.
See also
- al_identify_bitmap
- This works exactly as al_identify_bitmap_f but you specify the filename of the file for which to detect the type and not a file handle.
|
function al_load_bitmap_flags (const filename: AL_STR; flags: AL_INT): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Loads an image file into a new ALLEGRO_BITMAPptr . The file type is determined by the extension, except if the file has no extension in which case al_identify_bitmap is used instead.
Note: the core Allegro library does not support any image file formats by default. You must use the al5image addon, or register your own format handler.
Parameters
- filename
- The file to load.
- flags
- It may be a combination of the following constants:
ALLEGRO_NO_PREMULTIPLIED_ALPHA By default, Allegro pre-multiplies the alpha channel of an image with the images color data when it loads it. Typically that would look something like this:
r := get_float_byte;
g := get_float_byte;
b := get_float_byte;
a := get_float_byte;
r := r * a;
g := g * a;
b := b * a;
set_image_pixel (x, y, r, g, b, a);
The reason for this can be seen in the Allegro example ex_premulalpha , ie, using pre-multiplied alpha gives more accurate color results in some cases. To use alpha blending with images loaded with pre-multiplied alpha, you would use the default blending mode, which is set with al_set_blender (ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA) .
The ALLEGRO_NO_PREMULTIPLIED_ALPHA flag being set will ensure that images are not loaded with alpha pre-multiplied, but are loaded with color values direct from the image. That looks like this:
r := get_float_byte;
g := get_float_byte;
b := get_float_byte;
a := get_float_byte;
set_image_pixel (x, y, r, g, b, a);
To draw such an image using regular alpha blending, you would use al_set_blender (ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) to set the correct blender. This has some caveats. First, as mentioned above, drawing such an image can result in less accurate color blending (when drawing an image with linear filtering on, the edges will be darker than they should be). Second, the behaviour is somewhat confusing, which is explained in the example below.
al_set_new_bitmap_format (ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA);
bmp := al_load_bitmap ('some_alpha_bitmap.png');
tmp_buffer := al_create_bitmap (SCREEN_W, SCREEN_H);
al_set_target_bitmap (tmp_buffer);
al_clear_to_color (al_map_rgba_f (0, 0, 0, 1));
al_draw_bitmap (bmp, 0, 0, 0);
al_set_target_bitmap (al_get_backbuffer (display));
al_draw_bitmap (tmp_buffer, 0, 0, 0);
To explain further, if you have a pixel with 0.5 alpha, and you're using (ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) for blending, the formula is:
a := da * dst + sa * src
Expands to:
result_a := dst_a * (1-0.5) + 0.5 *
So if you draw the image to the temporary buffer, it is blended once resulting in 0.75 alpha, then drawn again to the screen, blended in the same way, resulting in a pixel has 0.1875 as an alpha value.
ALLEGRO_KEEP_INDEX
Load the palette indices of 8-bit .bmp and .pcx files instead of the rgb colors.
ALLEGRO_KEEP_BITMAP_FORMAT
Force the resulting ALLEGRO_BITMAP to use the same format as the file.
This is not yet honoured.
Returns
A pointer to the loaded bitmap or Nil on error. See also
- al_load_bitmap
- Loads an image file into a new
ALLEGRO_BITMAPptr .
|
function al_save_bitmap (const filename: AL_STR; bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Saves an ALLEGRO_BITMAP to an image file. The file type is determined by the extension.
Note
the core Allegro library does not support any image file formats by default. You must use the al5image addon, or register your own format handler.
Returns
True on success, False on error.
See also
- al_save_bitmap_f
- Saves an ALLEGRO_BITMAP to an ALLEGRO_FILE stream.
- al_register_bitmap_saver
- Registers a handler for al_save_bitmap.
- al_init_image_addon
- Initializes the image addon.
|
function al_save_bitmap_f (fp: ALLEGRO_FILEptr; const ident: AL_STR; bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Saves an ALLEGRO_BITMAP to an ALLEGRO_FILE stream. The file type is determined by the passed ident parameter, which is a file name extension including the leading dot.
Note
the core Allegro library does not support any image file formats by default. You must use the al5image addon, or register your own format handler.
Returns
True on success, False on error. The file remains open afterwards.
See also
- al_save_bitmap
- Saves an
ALLEGRO_BITMAP to an image file.
- al_register_bitmap_saver_f
- Registers a handler for al_save_bitmap_f.
- al_init_image_addon
- Initializes the image addon.
|
function al_identify_bitmap_f (fp: ALLEGRO_FILEptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
Tries to guess the bitmap file type of the given file by reading the first few bytes. The extension, if any, of the passed filename is not taken into account - only the file contents. By default Allegro cannot recognize any file types, but calling al_init_image_addon will add detection of (some of) the types it can read. You can also use al_register_bitmap_identifier to add identification of custom file types.
Returns
a pointer to a static string with a file extension for the type, including the leading dot. For example ".png" or ".jpg". Returns Nil if the bitmap type cannot be determined. See also
- al_init_image_addon
- Initializes the image addon.
- al_identify_bitmap
- This works exactly as al_identify_bitmap_f but you specify the filename of the file for which to detect the type and not a file handle.
- al_register_bitmap_identifier
- Registers an identify handler for al_identify_bitmap.
|
function al_lock_bitmap (bitmap: ALLEGRO_BITMAPptr; format: ALLEGRO_PIXEL_FORMAT; flags: ALLEGRO_LOCK): ALLEGRO_LOCKED_REGIONptr; CDECL; external ALLEGRO_LIB_NAME; |
Locks an entire bitmap for reading or writing. If the bitmap is a display bitmap it will be updated from system memory after the bitmap is unlocked (unless locked read only).
Note: For some reason, this function seems not to work properly on Windows, neither using Delphi nor Free Pascal.
On some platforms, Allegro automatically backs up the contents of video bitmaps because they may be occasionally lost (see discussion in al_create_bitmap's documentation). If you're completely recreating the bitmap contents often (e.g. every frame) then you will get much better performance by creating the target bitmap with ALLEGRO_NO_PRESERVE_TEXTURE flag.
Note
While a bitmap is locked, you can not use any drawing operations on it (with the sole exception of al_put_pixel and al_put_blended_pixel).
Parameters
- flags
-
ALLEGRO_LOCK_READONLY The locked region will not be written to. This can be faster if the bitmap is a video texture, as it can be discarded after the lock instead of uploaded back to the card.
ALLEGRO_LOCK_WRITEONLY The locked region will not be read from. This can be faster if the bitmap is a video texture, as no data need to be read from the video card. You are required to fill in all pixels before unlocking the bitmap again, so be careful when using this flag.
ALLEGRO_LOCK_READWRITE The locked region can be written to and read from. Use this flag if a partial number of pixels need to be written to, even if reading is not needed.
- format
- Indicates the pixel format that the returned buffer will be in. To lock in the same format as the bitmap stores its data internally, call with
al_get_bitmap_format (bitmap) as the format or use ALLEGRO_PIXEL_FORMAT_ANY . Locking in the native format will usually be faster. If the bitmap format is compressed, using ALLEGRO_PIXEL_FORMAT_ANY will choose an implementation defined non-compressed format.
Returns
Nil if the bitmap cannot be locked, e.g. the bitmap was locked previously and not unlocked. It also returns Nil if the format is a compressed format.
See also
- ALLEGRO_LOCKED_REGION
- Users who wish to manually edit or read from a bitmap are required to lock it first.
- ALLEGRO_PIXEL_FORMAT
- Pixel formats.
- al_unlock_bitmap
- Unlocks a previously locked bitmap or bitmap region.
- al_lock_bitmap_region
- Like al_lock_bitmap, but only locks a specific area of the bitmap.
- al_lock_bitmap_blocked
- Like al_lock_bitmap, but allows locking bitmaps with a blocked pixel format (i.e.
- al_lock_bitmap_region_blocked
- Like al_lock_bitmap_blocked, but allows locking a sub-region, for performance.
|
function al_lock_bitmap_region (bitmap: ALLEGRO_BITMAPptr; x, y, width, height: AL_INT; format: ALLEGRO_PIXEL_FORMAT; flags: ALLEGRO_LOCK): ALLEGRO_LOCKED_REGIONptr; CDECL; external ALLEGRO_LIB_NAME; |
Like al_lock_bitmap, but only locks a specific area of the bitmap. If the bitmap is a video bitmap, only that area of the texture will be updated when it is unlocked. Locking only the region you indend to modify will be faster than locking the whole bitmap.
Note
Using the ALLEGRO_LOCK_WRITEONLY with a blocked pixel format (i.e. formats for which al_get_pixel_block_width or al_get_pixel_block_height do not return 1) requires you to have the region be aligned to the block width for optimal performance. If it is not, then the function will have to lock the region with the ALLEGRO_LOCK_READWRITE instead in order to pad this region with valid data.
See also
- ALLEGRO_LOCKED_REGION
- Users who wish to manually edit or read from a bitmap are required to lock it first.
- ALLEGRO_PIXEL_FORMAT
- Pixel formats.
- al_unlock_bitmap
- Unlocks a previously locked bitmap or bitmap region.
|
procedure al_set_blender (op: ALLEGRO_BLEND_OPERATIONS; source, dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
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 (if the bitmap has no alpha it always is assumed to be fully opaque, so 255 for 8-bit or 1.0 for floating point): s = s.r, s.g, s.b, s.a. And this color is drawn to a destination, which already has a color: d = d.r, d.g, d.b, d.a.
The conceptional formula used by Allegro to draw any pixel then depends on the op parameter:
ALLEGRO_ADD
r = d.r * df.r + s.r * sf.r
g = d.g * df.g + s.g * sf.g
b = d.b * df.b + s.b * sf.b
a = d.a * df.a + s.a * sf.a
ALLEGRO_DEST_MINUS_SRC
r = d.r * df.r - s.r * sf.r
g = d.g * df.g - s.g * sf.g
b = d.b * df.b - s.b * sf.b
a = d.a * df.a - s.a * sf.a
ALLEGRO_SRC_MINUS_DEST
r = s.r * sf.r - d.r * df.r
g = s.g * sf.g - d.g * df.g
b = s.b * sf.b - d.b * df.b
a = s.a * sf.a - d.a * df.a
Valid values for the factors sf and df passed to this function are as follows, where s is the source color, d the destination color and cc the color set with al_set_blend_color (white by default)
ALLEGRO_ZERO f = 0, 0, 0, 0
ALLEGRO_ONE f = 1, 1, 1, 1
ALLEGRO_ALPHA f = s.a, s.a, s.a, s.a
ALLEGRO_INVERSE_ALPHA f = 1 - s.a, 1 - s.a, 1 - s.a, 1 - s.a
ALLEGRO_SRC_COLOR f = s.r, s.g, s.b, s.a
ALLEGRO_DEST_COLOR f = d.r, d.g, d.b, d.a
ALLEGRO_INVERSE_SRC_COLOR f = 1 - s.r, 1 - s.g, 1 - s.b, 1 - s.a
ALLEGRO_INVERSE_DEST_COLOR f = 1 - d.r, 1 - d.g, 1 - d.b, 1 - d.a
ALLEGRO_CONST_COLOR f = cc.r, cc.g, cc.b, cc.a
ALLEGRO_INVERSE_CONST_COLOR f = 1 - cc.r, 1 - cc.g, 1 - cc.b, 1 - cc.a
So for example, to restore the default of using premultiplied alpha blending, you would use:
al_set_blender (ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
As formula:
r = d.r * (1 - s.a) + s.r * 1
g = d.g * (1 - s.a) + s.g * 1
b = d.b * (1 - s.a) + s.b * 1
a = d.a * (1 - s.a) + s.a * 1
If you are using non-pre-multiplied alpha, you could use
al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
Additive blending would be achieved with
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE);
Copying the source to the destination (including alpha) unmodified
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO);
Multiplying source and destination components
al_set_blender(ALLEGRO_ADD, ALLEGRO_DEST_COLOR, ALLEGRO_ZERO)
Tinting the source (like al_draw_tinted_bitmap)
al_set_blender(ALLEGRO_ADD, ALLEGRO_CONST_COLOR, ALLEGRO_ONE);
al_set_blend_color(al_map_rgb(0, 96, 255));
Averaging source and destination pixels
al_set_blender(ALLEGRO_ADD, ALLEGRO_CONST_COLOR, ALLEGRO_CONST_COLOR);
al_set_blend_color(al_map_rgba_f(0.5, 0.5, 0.5, 0.5));
As formula:
r = d.r * 0 + s.r * d.r
g = d.g * 0 + s.g * d.g
b = d.b * 0 + s.b * d.b
a = d.a * 0 + s.a * d.a
See also
- al_set_separate_blender
- Like
al_set_blender , but allows specifying a separate blending operation for the alpha channel.
- al_set_blend_color
- Sets the color to use for blending when using the
ALLEGRO_CONST_COLOR or ALLEGRO_INVERSE_CONST_COLOR blend functions.
- al_get_blender
- Returns the active blender for the current thread.
|
procedure al_set_blend_color (color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
Sets the color to use for blending when using the ALLEGRO_CONST_COLOR or ALLEGRO_INVERSE_CONST_COLOR blend functions. See al_set_blender for more information.
See also
- al_set_blender
- Sets the function to use for blending for the current thread.
- al_get_blend_color
- Returns the color currently used for constant color blending (white by default).
|
procedure al_get_blender (out op: ALLEGRO_BLEND_OPERATIONS; out source, dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
Returns the active blender for the current thread.
See also
- al_set_blender
- Sets the function to use for blending for the current thread.
- al_get_separate_blender
- Returns the active blender for the current thread.
|
function al_get_blend_color: ALLEGRO_COLOR; CDECL; external ALLEGRO_LIB_NAME; |
Returns the color currently used for constant color blending (white by default).
See also
- al_set_blend_color
- Sets the color to use for blending when using the
ALLEGRO_CONST_COLOR or ALLEGRO_INVERSE_CONST_COLOR blend functions.
- al_set_blender
- Sets the function to use for blending for the current thread.
|
procedure al_set_separate_blender (op: ALLEGRO_BLEND_OPERATIONS; source, dest: ALLEGRO_BLEND_MODE; alpha_op: ALLEGRO_BLEND_OPERATIONS; alpha_source, alpha_dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
Like al_set_blender , but allows specifying a separate blending operation for the alpha channel. This is useful if your target bitmap also has an alpha channel and the two alpha channels need to be combined in a different way than the color components.
See also
- al_set_blender
- Sets the function to use for blending for the current thread.
- al_get_blender
- Returns the active blender for the current thread.
- al_get_separate_blender
- Returns the active blender for the current thread.
|
procedure al_get_separate_blender (out op: ALLEGRO_BLEND_OPERATIONS; out source, dest: ALLEGRO_BLEND_MODE; out alpha_op: ALLEGRO_BLEND_OPERATIONS; out alpha_source, alpha_dest: ALLEGRO_BLEND_MODE); CDECL; external ALLEGRO_LIB_NAME; |
Returns the active blender for the current thread.
See also
- al_set_separate_blender
- Like
al_set_blender , but allows specifying a separate blending operation for the alpha channel.
- al_get_blender
- Returns the active blender for the current thread.
|
function ALLEGRO_GET_EVENT_TYPE (const str: AL_STR): AL_INT; inline; |
Makes an event type identifier, which is a 32-bit integer. Usually, but not necessarily, this will be made from four 8-bit character codes, for example:
MY_EVENT_TYPE := ALLEGRO_GET_EVENT_TYPE ('MINE');
IDs less than 1024 are reserved for Allegro or its addons. Don't use anything lower than ALLEGRO_GET_EVENT_TYPE (#0#0#4#0) .
You should try to make your IDs unique so they don't clash with any 3rd party code you may be using. Be creative. Numbering from 1024 is not creative.
If you need multiple identifiers, you could define them like this:
BASE_EVENT := ALLEGRO_GET_EVENT_TYPE ('MINE');
BARK_EVENT := BASE_EVENT + 1;
MEOW_EVENT := BASE_EVENT + 2;
SQUAWK_EVENT := BASE_EVENT + 3;
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- ALLEGRO_USER_EVENT
- An event structure that can be emitted by user event sources.
- ALLEGRO_EVENT_TYPE_IS_USER
- Returns
True if the event type is not a builtin event type, i.e.
|
procedure al_init_user_event_source (source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
Initialices an event source for emitting user events. The space for the event source must already have been allocated.
One possible way of creating custom event sources is to derive other structures with ALLEGRO_EVENT_SOURCE at the head, e.g.
TYPE
THINGptr = ˆTHING;
THING = RECORD
event_source: ALLEGRO_EVENT_SOURCE;
field1, field2: INTEGER;
END;
FUNCTION CreateThing: THINGptr;
BEGIN
RESULT := getmem (sizeof (THING));
IF RESULT <> NIL THEN
BEGIN
al_init_user_event_source (@(RESULTˆ.event_source));
RESULTˆ.field1 := 0;
RESULTˆ.field2 := 0
END
END;
The advantage here is that the THING pointer will be the same as the ALLEGRO_EVENT_SOURCE pointer. Events emitted by the event source will have the event source pointer as the source field, from which you can get a pointer to a THING by a simple cast (after ensuring checking the event is of the correct type).
However, it is only one technique and you are not obliged to use it.
The user event source will never be destroyed automatically. You must destroy it manually with al_destroy_user_event_source .
Parameters
- source
- Pointer to the variable that will store the source information.
See also
- ALLEGRO_EVENT_SOURCE
- An event source is any object which can generate events.
- al_destroy_user_event_source
- Destroys an event source initialised with al_init_user_event_source.
- al_emit_user_event
- Emits an event from a user event source.
- ALLEGRO_USER_EVENT
- An event structure that can be emitted by user event sources.
|
procedure al_destroy_user_event_source (source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
Destroys an event source initialised with al_init_user_event_source.
This does not free the memory, as that was user allocated to begin with.
Parameters
- source
- Pointer to the variable that stored the source information.
See also
- ALLEGRO_EVENT_SOURCE
- An event source is any object which can generate events.
|
function al_emit_user_event (source: ALLEGRO_EVENT_SOURCEptr; Event: ALLEGRO_EVENTptr; dtor: ALLEGRO_EVENT_DTOR_PROC): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Emits an event from a user event source. The event source must have been initialised with al_init_user_event_source.
Events are copied in and out of event queues, so after this function returns the memory pointed to by event may be freed or reused. Some fields of the event being passed in may be modified by the function.
Reference counting will be performed if dtor is not Nil . Whenever a copy of the event is made, the reference count increases. You need to call al_unref_user_event to decrease the reference count once you are done with a user event that you have received from al_get_next_event, al_peek_next_event, al_wait_for_event, etc.
Once the reference count drops to zero dtor will be called with a copy of the event as an argument. It should free the resources associated with the event, but not the event itself (since it is just a copy).
If dtor is Nil then reference counting will not be performed. It is safe, but unnecessary, to call al_unref_user_event on non-reference counted user events.
You can use al_emit_user_event to emit both user and non-user events from your user event source. Note that emitting input events will not update the corresponding input device states. For example, you may emit an event of type ALLEGRO_EVENT_KEY_DOWN, but it will not update the ALLEGRO_KEYBOARD_STATE returned by al_get_keyboard_state.
Returns
False if the event source isn't registered with any queues, hence the event wouldn't have been delivered into any queues.
See also
- ALLEGRO_USER_EVENT
- An event structure that can be emitted by user event sources.
- al_unref_user_event
- Decreases the reference count of a user-defined event.
- ALLEGRO_EVENT_DTOR_PROC
- User event destructor.
|
procedure al_set_event_source_data (source: ALLEGRO_EVENT_SOURCEptr; data: AL_POINTER); CDECL; external ALLEGRO_LIB_NAME; |
Assigns the abstract user data to the event source. Allegro does not use the data internally for anything; it is simply meant as a convenient way to associate your own data or objects with events.
See also
- al_get_event_source_data
- Returns the abstract user data associated with the event source.
|
function al_get_event_source_data (const source: ALLEGRO_EVENT_SOURCEptr): AL_POINTER; CDECL; external ALLEGRO_LIB_NAME; |
Returns the abstract user data associated with the event source. If no data was previously set, returns Nil .
See also
- al_set_event_source_data
- Assigns the abstract user data to the event source.
|
function al_create_event_queue: ALLEGRO_EVENT_QUEUEptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a new, empty event queue.
Returns
A pointer to the newly created object if successful, Nil on error. See also
- al_register_event_source
- Register the event source with the event queue specified.
- al_destroy_event_queue
- Destroys the event queue specified.
- ALLEGRO_EVENT_QUEUEptr
- An event queue holds events that have been generated by event sources that are registered with the queue.
|
procedure al_destroy_event_queue (queue: ALLEGRO_EVENT_QUEUEptr); CDECL; external ALLEGRO_LIB_NAME; |
Destroys the event queue specified. All event sources currently registered with the queue will be automatically unregistered before the queue is destroyed.
See also
- al_create_event_queue
- Creates a new, empty event queue.
- ALLEGRO_EVENT_QUEUEptr
- An event queue holds events that have been generated by event sources that are registered with the queue.
|
procedure al_register_event_source (queue: ALLEGRO_EVENT_QUEUEptr; source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
Register the event source with the event queue specified. An event source may be registered with any number of event queues simultaneously, or none. Trying to register an event source with the same event queue more than once does nothing.
See also
- al_unregister_event_source
- Unregister an event source with an event queue.
- ALLEGRO_EVENT_SOURCE
- An event source is any object which can generate events.
|
procedure al_unregister_event_source (queue: ALLEGRO_EVENT_QUEUEptr; source: ALLEGRO_EVENT_SOURCEptr); CDECL; external ALLEGRO_LIB_NAME; |
Unregister an event source with an event queue. If the event source is not actually registered with the event queue, nothing happens.
If the queue had any events in it which originated from the event source, they will no longer be in the queue after this call.
See also
- al_register_event_source
- Register the event source with the event queue specified.
|
procedure al_pause_event_queue (queue: ALLEGRO_EVENT_QUEUEptr; pause: AL_BOOL); CDECL; external ALLEGRO_LIB_NAME; |
Pauses or resumes accepting new events into the event queue (to resume, pass False for pause). Events already in the queue are unaffected.
While a queue is paused, any events which would be entered into the queue are simply ignored. This is an alternative to unregistering then re-registering all event sources from the event queue, if you just need to prevent events piling up in the queue for a while.
See also
- al_is_event_queue_paused
- Returns
True if the event queue is paused.
|
function al_is_event_queue_paused (const queue: ALLEGRO_EVENT_QUEUEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if the event queue is paused.
See also
- al_pause_event_queue
- Pauses or resumes accepting new events into the event queue (to resume, pass
False for pause).
|
function al_is_event_queue_empty (queue: ALLEGRO_EVENT_QUEUEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if the event queue specified is currently empty.
See also
- al_get_next_event
- Takes the next event out of the event queue specified, and copy the contents into
ret_event , returning True .
- al_peek_next_event
- Copies the contents of the next event in the event queue specified into
ret_event and returns True .
|
function al_get_next_event (queue: ALLEGRO_EVENT_QUEUEptr; out ret_event: ALLEGRO_EVENT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Takes the next event out of the event queue specified, and copy the contents into ret_event , returning True . The original event will be removed from the queue. If the event queue is empty, returns False and the contents of ret_event are unspecified.
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- al_peek_next_event
- Copies the contents of the next event in the event queue specified into
ret_event and returns True .
- al_wait_for_event
- Waits until the event queue specified is non-empty.
|
function al_peek_next_event (queue: ALLEGRO_EVENT_QUEUEptr; out ret_event: ALLEGRO_EVENT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Copies the contents of the next event in the event queue specified into ret_event and returns True . The original event packet will remain at the head of the queue. If the event queue is actually empty, this function returns False and the contents of ret_event are unspecified.
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- al_get_next_event
- Takes the next event out of the event queue specified, and copy the contents into
ret_event , returning True .
- al_drop_next_event
- Drops (removes) the next event from the queue.
|
function al_drop_next_event (queue: ALLEGRO_EVENT_QUEUEptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Drops (removes) the next event from the queue. If the queue is empty, nothing happens.
Parameters
- queue
- Pointer to the queue.
Returns
(True ) if an event was dropped. See also
- al_flush_event_queue
- Drops all events, if any, from the queue.
- al_is_event_queue_empty
- Returns
True if the event queue specified is currently empty.
|
procedure al_wait_for_event (queue: ALLEGRO_EVENT_QUEUEptr; ret_event: ALLEGRO_EVENTptr); CDECL; external ALLEGRO_LIB_NAME; |
Waits until the event queue specified is non-empty. If ret_event is not Nil , the first event in the queue will be copied into ret_event and removed from the queue. If ret_event is Nil the first event is left at the head of the queue.
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- al_wait_for_event_timed
- Waits until the event queue specified is non-empty.
- al_wait_for_event_until
- Waits until the event queue specified is non-empty.
- al_get_next_event
- Takes the next event out of the event queue specified, and copy the contents into
ret_event , returning True .
|
function al_wait_for_event_timed (queue: ALLEGRO_EVENT_QUEUEptr; event: ALLEGRO_EVENTptr; secs: AL_FLOAT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Waits until the event queue specified is non-empty.
Parameters
- queue
- Pointer to the queue.
- ret_event
- If it is not
Nil , the first event in the queue will be copied into ret_event and removed from the queue. If it is Nil the first event is left at the head of the queue.
- secs
- Determines approximately how many seconds to wait. If the call times out,
False is returned. Otherwise, if an event ocurred, True is returned. For compatibility with all platforms, secs must be 2,147,483.647 seconds or less.
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- al_wait_for_event
- Waits until the event queue specified is non-empty.
- al_wait_for_event_until
- Waits until the event queue specified is non-empty.
|
function al_wait_for_event_until (queue: ALLEGRO_EVENT_QUEUEptr; event: ALLEGRO_EVENTptr; var timeout: ALLEGRO_TIMEOUT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Waits until the event queue specified is non-empty.
Parameters
- queue
- Pointer to the queue.
- ret_event
- If it is not
Nil , the first event in the queue will be copied into ret_event and removed from the queue. If it is Nil the first event is left at the head of the queue.
- timeout
- Determines how long to wait. If the call times out,
False is returned. Otherwise, if an event ocurred, True is returned. For compatibility with all platforms, timeout must be 2,147,483.647 seconds or less.
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- al_init_timeout
- Sets timeout value of some number of seconds after the function call.
- al_wait_for_event
- Waits until the event queue specified is non-empty.
- al_wait_for_event_timed
- Waits until the event queue specified is non-empty.
|
procedure al_set_new_display_refresh_rate (refresh_rate: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the refresh rate to use when creating new displays on the calling thread. 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.
The default setting is zero (don't care).
See also
- al_get_new_display_refresh_rate
- Gets the requested refresh rate to be used when creating new displays on the calling thread.
|
procedure al_set_new_display_flags (flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets various flags to be used when creating new displays on the calling thread. flags is a bitfield containing any reasonable combination of the following:
ALLEGRO_WINDOWED Prefer a windowed mode.
Under multi-head X (not XRandR/TwinView), the use of more than one adapter is impossible due to bugs in X and GLX. al_create_display will fail if more than one adapter is attempted to be used.
ALLEGRO_FULLSCREEN_WINDOW Make the window span the entire screen. Unlike ALLEGRO_FULLSCREEN this will never attempt to modify the screen resolution. Instead the pixel dimensions of the created display will be the same as the desktop.
The passed width and height are only used if the window is switched out of fullscreen mode later but will be ignored initially.
Under Windows and X11 a fullscreen display created with this flag will behave differently from one created with the ALLEGRO_FULLSCREEN flag - even if the ALLEGRO_FULLSCREEN display is passed the desktop dimensions. The exact difference is platform dependent, but some things which may be different is how alt-tab works, how fast you can toggle between fullscreen/windowed mode or how additional monitors behave while your display is in fullscreen mode.
Additionally under X, the use of more than one adapter in multi-head mode or with true Xinerama enabled is impossible due to bugs in X/GLX, creation will fail if more than one adapter is attempted to be used.
ALLEGRO_FULLSCREEN Prefer a fullscreen mode.
Under X the use of more than one FULLSCREEN display when using multi-head X, or true Xinerama is not possible due to bugs in X and GLX, display creation will fail if more than one adapter is attempted to be used.
Note: Prefer using ALLEGRO_FULLSCREEN_WINDOW as it typically provides a better user experience as the monitor doesn't change resolution and switching away from your game via Alt-Tab works smoothly. ALLEGRO_FULLSCREEN is typically less well supported compared to ALLEGRO_FULLSCREEN_WINDOW .
ALLEGRO_RESIZABLE The display is resizable (only applicable if combined with ALLEGRO_WINDOWED ).
ALLEGRO_MAXIMIZED The display window will be maximized (only applicable if combined with ALLEGRO_RESIZABLE ).
ALLEGRO_OPENGL Require the driver to provide an initialized OpenGL context after returning successfully.
ALLEGRO_OPENGL_3_0 Require the driver to provide an initialized OpenGL context compatible with OpenGL version 3.0.
ALLEGRO_OPENGL_FORWARD_COMPATIBLE If this flag is set, the OpenGL context created with ALLEGRO_OPENGL_3_0 will be forward compatible only, meaning that all of the OpenGL API declared deprecated in OpenGL 3.0 will not be supported. Currently, a display created with this flag will not be compatible with Allegro drawing routines; the display option ALLEGRO_COMPATIBLE_DISPLAY will be set to false.
ALLEGRO_OPENGL_ES_PROFILE Used together with ALLEGRO_OPENGL , requests that the OpenGL context uses the OpenGL ES profile. A specific version can be requested with al_set_new_display_option. Note: Currently this is only supported by the X11/GLX driver.
ALLEGRO_DIRECT3D Require the driver to do rendering with Direct3D and provide a Direct3D device.
ALLEGRO_PROGRAMMABLE_PIPELINE Require a programmable graphics pipeline. This flag is required to use ALLEGRO_SHADERptr objects.
ALLEGRO_FRAMELESS Try to create a window without a frame (i.e. no border or titlebar). This usually does nothing for fullscreen modes, and even in windowed modes it depends on the underlying platform whether it is supported or not.
ALLEGRO_GENERATE_EXPOSE_EVENTS Let the display generate expose events.
0 can be used for default values.
See also
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
- al_get_display_option
- Returns an extra display setting of the display.
- al_set_display_option
- Changes an option that was previously set for a display.
|
function al_get_new_display_refresh_rate: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the requested refresh rate to be used when creating new displays on the calling thread.
See also
- al_set_new_display_refresh_rate
- Sets the refresh rate to use when creating new displays on the calling thread.
|
function al_get_new_display_flags: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the display flags to be used when creating new displays on the calling thread.
See also
- al_set_new_display_flags
- Sets various flags to be used when creating new displays on the calling thread.
- al_set_display_flag
- Enables or disables one of the display flags.
|
procedure al_set_new_window_title (const title: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
Sets the title that will be used when a new display is created. Allegro uses a static buffer of ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE to store this, so the length of the titme you set must be less than this.
See also
- al_set_window_title
- Sets the title on a display.
- al_get_new_window_title
- Returns the title that will be used when a new display is created.
- al_create_display
- Creates a display, or window, with the specified dimensions.
- ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE
- Max size of window titles.
|
function al_get_new_window_title: AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns the title that will be used when a new display is created. This returns the value that al_set_window_title was called with. The current implementation returns a pointer to a static buffer of which you should make a copy if you want to modify it.
See also
- al_set_window_title
- Sets the title on a display.
- al_set_new_window_title
- Sets the title that will be used when a new display is created.
- al_create_display
- Creates a display, or window, with the specified dimensions.
|
function al_get_display_width (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the width of the display. This is like SCREEN_W in Allegro 4.x.
See also
- al_get_display_height
- Gets the height of the display.
|
function al_get_display_height (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the height of the display. This is like SCREEN_H in Allegro 4.x.
See also
- al_get_display_width
- Gets the width of the display.
|
function al_get_display_flags (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the flags of the display.
In addition to the flags set for the display at creation time with al_set_new_display_flags it can also have the ALLEGRO_MINIMIZED flag set, indicating that the window is currently minimized. This flag is very platform-dependent as even a minimized application may still render a preview version so normally you should not care whether it is minimized or not.
See also
- al_set_new_display_flags
- Sets various flags to be used when creating new displays on the calling thread.
- al_set_display_flag
- Enables or disables one of the display flags.
|
function al_get_display_orientation (display: ALLEGRO_DISPLAYptr): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Return the display orientation, which can be one of the following:
ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN
ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES
ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES
ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES
ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES
ALLEGRO_DISPLAY_ORIENTATION_FACE_UP
ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN
|
function al_set_display_flag (display: ALLEGRO_DISPLAYptr; flag: AL_INT; onoff: AL_BOOL): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Enables or disables one of the display flags. The flags are the same as for al_set_new_display_flags. The only flags that can be changed after creation are:
You can use al_get_display_flags to query whether the given display property actually changed.
Returns
True if the driver supports toggling the specified flag else False .
See also
- al_set_new_display_flags
- Sets various flags to be used when creating new displays on the calling thread.
- al_get_display_flags
- Gets the flags of the display.
|
function al_create_display (w, h: AL_INT): ALLEGRO_DISPLAYptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a display, or window, with the specified dimensions. The parameters of the display are determined by the last calls to al_set_new_display_* . Default parameters are used if none are set explicitly. Creating a new display will automatically make it the active one, with the backbuffer selected for drawing.
Each display that uses OpenGL as a backend has a distinct OpenGL rendering context associated with it. See al_set_target_bitmap for the discussion about rendering contexts.
Returns
Nil on error.
See also
- al_set_new_display_flags
- Sets various flags to be used when creating new displays on the calling thread.
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
- al_set_new_display_refresh_rate
- Sets the refresh rate to use when creating new displays on the calling thread.
- al_set_new_display_adapter
- Sets the adapter to use for new displays created by the calling thread.
- al_set_new_window_title
- Sets the title that will be used when a new display is created.
- al_destroy_display
- Destroys a display.
|
procedure al_destroy_display (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
Destroys a display.
If the target bitmap of the calling thread is tied to the display, then it implies a call to al_set_target_bitmap (Nil ); before the display is destroyed.
That special case notwithstanding, you should make sure no threads are currently targeting a bitmap which is tied to the display before you destroy it.
See also
- al_set_target_bitmap
- This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to.
|
function al_get_current_display: ALLEGRO_DISPLAYptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns the display that is "current" for the calling thread, or Nil if there is none.
See also
- al_set_target_bitmap
- This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to.
|
procedure al_set_target_bitmap (Bitmap: ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to. To return to drawing to a display, set the backbuffer of the display as the target bitmap, using al_get_backbuffer. As a convenience, you may also use al_set_target_backbuffer.
Each video bitmap is tied to a display. When a video bitmap is set to as the target bitmap, the display that the bitmap belongs to is automatically made "current" for the calling thread (if it is not current already). Then drawing other bitmaps which are tied to the same display can be hardware accelerated.
A single display cannot be current for multiple threads simultaneously. If you need to release a display, so it is not current for the calling thread, call al_set_target_bitmap (Nil );
Setting a memory bitmap as the target bitmap will not change which display is current for the calling thread.
On some platforms, Allegro automatically backs up the contents of video bitmaps because they may be occasionally lost (see discussion in al_create_bitmap's documentation). If you're completely recreating the bitmap contents often (e.g. every frame) then you will get much better performance by creating the target bitmap with ALLEGRO_NO_PRESERVE_TEXTURE flag.
OpenGL note:
Framebuffer objects (FBOs) allow OpenGL to directly draw to a bitmap, which is very fast. When using an OpenGL display, if all of the following conditions are met an FBO will be created for use with the bitmap:
The GL_EXT_framebuffer_object OpenGL extension is available.
The bitmap is not a memory bitmap.
The bitmap is not currently locked.
In Allegro 5.0.0, you had to be careful as an FBO would be kept around until the bitmap is destroyed or you explicitly called al_remove_opengl_fbo on the bitmap, wasting resources. In newer versions, FBOs will be freed automatically when the bitmap is no longer the target bitmap, unless you have called al_get_opengl_fbo to retrieve the FBO id.
In the following example, no FBO will be created:
lock := al_lock_bitmap (bitmap);
al_set_target_bitmap (bitmap);
al_put_pixel (x, y, color);
al_unlock_bitmap (bitmap);
The above allows using al_put_pixel on a locked bitmap without creating an FBO.
In this example an FBO is created however:
al_set_target_bitmap (bitmap);
al_draw_line (x1, y1, x2, y2, color, 0);
An OpenGL command will be used to directly draw the line into the bitmap's associated texture.
See also
- al_get_target_bitmap
- Returns the target bitmap of the calling thread.
- al_set_target_backbuffer
- Same as
al_set_target_bitmap(al_get_backbuffer(display)); .
|
procedure al_set_target_backbuffer (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
Same as al_set_target_bitmap(al_get_backbuffer(display)); .
See also
- al_set_target_bitmap
- This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to.
- al_get_backbuffer
- Returns a special bitmap representing the back-buffer of the display.
|
function al_get_backbuffer (display: ALLEGRO_DISPLAYptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns a special bitmap representing the back-buffer of the display.
Care should be taken when using the backbuffer bitmap (and its sub-bitmaps) as the source bitmap (e.g as the bitmap argument to al_draw_bitmap). Only untransformed operations are hardware accelerated. These consist of al_draw_bitmap and al_draw_bitmap_region when the current transformation is the identity. If the tranformation is not the identity, or some other drawing operation is used, the call will be routed through the memory bitmap routines, which are slow. If you need those operations to be accelerated, then first copy a region of the backbuffer into a temporary bitmap (via the al_draw_bitmap and al_draw_bitmap_region), and then use that temporary bitmap as the source bitmap.
|
function al_get_target_bitmap: ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns the target bitmap of the calling thread.
See also
- al_set_target_bitmap
- This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to.
|
function al_acknowledge_resize (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
When the user receives a resize event (ALLEGRO_EVENT_DISPLAY_RESIZE from a resizable display, if they wish the display to be resized they must call this function to let the graphics driver know that it can now resize the display.
Adjusts the clipping rectangle to the full size of the backbuffer. This also resets the backbuffers projection transform to default orthographic transform (see al_use_projection_transform).
Note that a resize event may be outdated by the time you acknowledge it; there could be further resize events generated in the meantime.
Returns
True on success.
See also
- al_resize_display
- Resizes the display.
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
|
function al_resize_display (display: ALLEGRO_DISPLAYptr; width, height: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Resizes the display. This works on both fullscreen and windowed displays, regardless of the ALLEGRO_RESIZABLE flag.
Adjusts the clipping rectangle to the full size of the backbuffer.
Returns
True on success, or False on error.
See also
- al_acknowledge_resize
- When the user receives a resize event (ALLEGRO_EVENT_DISPLAY_RESIZE from a resizable display, if they wish the display to be resized they must call this function to let the graphics driver know that it can now resize the display.
|
procedure al_flip_display; CDECL; external ALLEGRO_LIB_NAME; |
Copies or updates the front and back buffers so that what has been drawn previously on the currently selected display becomes visible on screen. Pointers to the special back buffer bitmap remain valid and retain their semantics as the back buffer, although the contents may have changed.
Several display options change how this function behaves:
With ALLEGRO_SINGLE_BUFFER , no flipping is done. You still have to call this function to display graphics, depending on how the used graphics system works.
The ALLEGRO_SWAP_METHOD option may have additional information about what kind of operation is used internally to flip the front and back buffers.
If ALLEGRO_VSYNC is 1, this function will force waiting for vsync. If ALLEGRO_VSYNC is 2, this function will not wait for vsync. With many drivers the vsync behavior is controlled by the user and not the application, and ALLEGRO_VSYNC will not be set; in this case al_flip_display will wait for vsync depending on the settings set in the system's graphics preferences.
See also
- al_set_new_display_flags
- Sets various flags to be used when creating new displays on the calling thread.
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
- al_wait_for_vsync
- Waits for the beginning of a vertical retrace.
|
procedure al_update_display_region (x, y, Width, height: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Does the same as al_flip_display, but tries to update only the specified region. With many drivers this is not possible, but for some it can improve performance. If this is not supported, this function falls back to the behavior of al_flip_display. You can query the support for this function using al_get_display_option (display, ALLEGRO_UPDATE_DISPLAY_REGION) .
See also
- al_flip_display
- Copies or updates the front and back buffers so that what has been drawn previously on the currently selected display becomes visible on screen.
- al_get_display_option
- Returns an extra display setting of the display.
|
function al_is_compatible_bitmap (bitmap: ALLEGRO_BITMAPptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
D3D and OpenGL allow sharing a texture in a way so it can be used for multiple windows. Each ALLEGRO_BITMAPptr created with al_create_bitmap however is usually tied to a single ALLEGRO_DISPLAYptr . This function can be used to know if the bitmap is compatible with the given display, even if it is a different display to the one it was created with. It returns True if the bitmap is compatible (things like a cached texture version can be used) and False otherwise (blitting in the current display will be slow).
The only time this function is useful is if you are using multiple windows and need accelerated blitting of the same bitmaps to both.
Returns
True if the bitmap is compatible with the current display, False otherwise. If there is no current display, False is returned.
|
function al_wait_for_vsync: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Waits for the beginning of a vertical retrace. Some driver/card/monitor combinations may not be capable of this.
Note how al_flip_display usually already waits for the vertical retrace, so unless you are doing something special, there is no reason to call this function.
Returns
False if not possible, True if successful.
See also
- al_flip_display
- Copies or updates the front and back buffers so that what has been drawn previously on the currently selected display becomes visible on screen.
|
procedure al_set_display_icons (display: ALLEGRO_DISPLAYptr; num_icons: AL_INT; var icons: array of ALLEGRO_BITMAPptr); CDECL; external ALLEGRO_LIB_NAME; |
Changes the icons associated with the display (window). Multiple icons can be provided for use in different contexts, e.g. window frame, taskbar, alt-tab popup. The number of icons must be at least one.
Note
If the underlying OS requires an icon of a size not provided then one of the bitmaps will be scaled up or down to the required size. The choice of bitmap is implementation dependent.
See also
- al_set_display_icon
- Changes the icon associated with the display (window).
- al_set_window_title
- Sets the title on a display.
|
function al_get_new_display_adapter: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the video adapter index where new displays will be created by the calling thread, if previously set with al_set_new_display_adapter. Otherwise returns ALLEGRO_DEFAULT_DISPLAY_ADAPTER .
See also
- al_set_new_display_adapter
- Sets the adapter to use for new displays created by the calling thread.
|
procedure al_set_new_display_adapter (adapter: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the adapter to use for new displays created by the calling thread. The adapter has a monitor attached to it. Information about the monitor can be gotten using al_get_num_video_adapters and al_get_monitor_info.
To return to the default behaviour, pass ALLEGRO_DEFAULT_DISPLAY_ADAPTER .
See also
- al_get_num_video_adapters
- Gets the number of video "adapters" attached to the computer.
- al_get_monitor_info
- Gets information about a monitor's position on the desktop.
|
procedure al_set_new_window_position (x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets where the top left pixel of the client area of newly created windows (non-fullscreen) will be on screen, for displays created by the calling thread. Negative values are allowed on some multihead systems.
To reset to the default behaviour, pass (maxLongint, maxLongint) .
See also
- al_get_new_window_position
- Gets the position where new non-fullscreen displays created by the calling thread will be placed.
- al_set_window_position
- Sets the position on screen of a non-fullscreen display.
|
procedure al_get_new_window_position (out x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Gets the position where new non-fullscreen displays created by the calling thread will be placed.
See also
- al_set_new_window_position
- Sets where the top left pixel of the client area of newly created windows (non-fullscreen) will be on screen, for displays created by the calling thread.
|
procedure al_set_window_position (display: ALLEGRO_DISPLAYptr; x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the position on screen of a non-fullscreen display.
See also
- al_get_window_position
- Gets the position of a non-fullscreen display.
- al_set_new_window_position
- Sets where the top left pixel of the client area of newly created windows (non-fullscreen) will be on screen, for displays created by the calling thread.
|
procedure al_get_window_position (display: ALLEGRO_DISPLAYptr; out x, y: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Gets the position of a non-fullscreen display.
See also
- al_set_window_position
- Sets the position on screen of a non-fullscreen display.
|
function al_set_window_constraints (display: ALLEGRO_DISPLAYptr; min_w, min_h, max_w, max_h: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Constrains a non-fullscreen resizable display. The constraints are a hint only, and are not necessarily respected by the window environment. A value of 0 for any of the parameters indicates no constraint for that parameter.
The constraints will be applied to a display only after the al_apply_window_constraints function call. (al_get_window_constraints)
See also
- al_apply_window_constraints
- Enables or disables previously set constraints by al_set_window_constraints function.
|
function al_get_window_constraints (display: ALLEGRO_DISPLAYptr; out min_w, min_h, max_w, max_h: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Gets the constraints for a non-fullscreen resizable display.
See also
- al_set_window_constraints
- Constrains a non-fullscreen resizable display.
|
procedure al_apply_window_constraints (display: ALLEGRO_DISPLAYptr; onoff: AL_BOOL); CDECL; external ALLEGRO_LIB_NAME; |
Enables or disables previously set constraints by al_set_window_constraints function.
If enabled, the specified display will be automatically resized to new sizes to conform constraints in next cases:
The specified display is resizable, not maximized and is not in fullscreen mode.
If the appropriate current display size (width or height) is less than the value of constraint. Applied to minimum constraints.
If the appropriate current display size (width or height) is greater than the value of constraint. Applied to maximum constraints.
Constrains are not applied when a display is toggle from windowed to maximized or fullscreen modes. When a display is toggle from maximized/fullscreen to windowed mode, then the display may be resized as described above. The later case is also possible when a user drags the maximized display via mouse.
If disabled, the specified display will stop using constraints.
See also
- al_get_window_constraints
- Gets the constraints for a non-fullscreen resizable display.
- al_set_window_constraints
- Constrains a non-fullscreen resizable display.
|
procedure al_set_new_display_option (option: ALLEGRO_DISPLAY_OPTIONS; value, importance: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets an extra display option, to be used when creating new displays on the calling thread. Display options differ from display flags, and specify some details of the context to be created within the window itself. These mainly have no effect on Allegro itself, but you may want to specify them, for example if you want to use multisampling.
The importance parameter can be either:
ALLEGRO_REQUIRE - The display will not be created if the setting can not be met.
ALLEGRO_SUGGEST - If the setting is not available, the display will be created anyway with a setting as close as possible to the requested one. You can query the actual value used in that case by calling al_get_display_option after the display has been created.
ALLEGRO_DONTCARE - If you added a display option with one of the above two settings before, it will be removed again. Else this does nothing.
The supported options are:
ALLEGRO_COLOR_SIZE
This can be used to ask for a specific bit depth. For example to force a 16-bit framebuffer set this to 16.
ALLEGRO_RED_SIZE, ALLEGRO_GREEN_SIZE, ALLEGRO_BLUE_SIZE, ALLEGRO_ALPHA_SIZE
Individual color component size in bits.
ALLEGRO_RED_SHIFT, ALLEGRO_GREEN_SHIFT, ALLEGRO_BLUE_SHIFT, ALLEGRO_ALPHA_SHIFT
Together with the previous settings these can be used to specify the exact pixel layout the display should use. Normally there is no reason to use these.
ALLEGRO_ACC_RED_SIZE, ALLEGRO_ACC_GREEN_SIZE, ALLEGRO_ACC_BLUE_SIZE, ALLEGRO_ACC_ALPHA_SIZE
This can be used to define the required accumulation buffer size.
ALLEGRO_STEREO
Whether the display is a stereo display.
ALLEGRO_AUX_BUFFERS
Number of auxiliary buffers the display should have.
ALLEGRO_DEPTH_SIZE
How many depth buffer (z-buffer) bits to use.
ALLEGRO_STENCIL_SIZE
How many bits to use for the stencil buffer.
ALLEGRO_SAMPLE_BUFFERS
Whether to use multisampling (1 ) or not (0 ).
ALLEGRO_SAMPLES
If the above is 1 , the number of samples to use per pixel. Else 0 .
ALLEGRO_RENDER_METHOD
0 if hardware acceleration is not used with this display.
ALLEGRO_FLOAT_COLOR
Whether to use floating point color components.
ALLEGRO_FLOAT_DEPTH
Whether to use a floating point depth buffer.
ALLEGRO_SINGLE_BUFFER
Whether the display uses a single buffer (1 ) or another update method (0 ).
ALLEGRO_SWAP_METHOD
If the above is 0 , this is set to 1 to indicate the display is using a copying method to make the next buffer in the flip chain available, or to 2 to indicate a flipping or other method.
ALLEGRO_COMPATIBLE_DISPLAY
Indicates if Allegro's graphics functions can use this display. If you request a display not useable by Allegro, you can still use for example OpenGL to draw graphics.
ALLEGRO_UPDATE_DISPLAY_REGION
Set to 1 if the display is capable of updating just a region, and 0 if calling al_update_display_region is equivalent to al_flip_display.
ALLEGRO_VSYNC
Set to 1 to tell the driver to wait for vsync in al_flip_display, or to 2 to force vsync off. The default of 0 means that Allegro does not try to modify the vsync behavior so it may be on or off. Note that even in the case of 1 or 2 it is possible to override the vsync behavior in the graphics driver so you should not rely on it.
ALLEGRO_MAX_BITMAP_SIZE
When queried this returns the maximum size (width as well as height) a bitmap can have for this display. Calls to al_create_bitmap or al_load_bitmap for bitmaps larger than this size will fail. It does not apply to memory bitmaps which always can have arbitrary size (but are slow for drawing).
ALLEGRO_SUPPORT_NPOT_BITMAP
Set to 1 if textures used for bitmaps on this display can have a size which is not a power of two. This is mostly useful if you use Allegro to load textures as otherwise only power-of-two textures will be used internally as bitmap storage.
ALLEGRO_CAN_DRAW_INTO_BITMAP
Set to 1 if you can use al_set_target_bitmap on bitmaps of this display to draw into them. If this is not the case software emulation will be used when drawing into display bitmaps (which can be very slow).
ALLEGRO_SUPPORT_SEPARATE_ALPHA
This is set to 1 if the al_set_separate_blender function is supported. Otherwise the alpha parameters will be ignored.
ALLEGRO_AUTO_CONVERT_BITMAPS
This is on by default. It causes any existing memory bitmaps with the ALLEGRO_CONVERT_BITMAP flag to be converted to a display bitmap of the newly created display with the option set.
ALLEGRO_SUPPORTED_ORIENTATIONS
This is a bit-combination of the orientations supported by the application. The orientations are the same as for al_get_display_orientation with the additional possibilities:
ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT - means only the two portrait orientations are supported.
ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE - means only the two landscape orientations
ALLEGRO_DISPLAY_ORIENTATION_ALL - allows all four orientations.
When the orientation changes between a portrait and a landscape orientation the display needs to be resized. This is done by sending an ALLEGRO_EVENT_DISPLAY_RESIZE message which should be handled by calling al_acknowledge_resize.
ALLEGRO_OPENGL_MAJOR_VERSION
Request a specific OpenGL major version.
ALLEGRO_OPENGL_MINOR_VERSION
Request a specific OpenGL minor version.
ALLEGRO_DEFAULT_SHADER_PLATFORM
Specify the shader platform to use for the default shader. See ALLEGRO_SHADER_PLATFORM. The default is ALLEGRO_SHADER_AUTO.
See also
- al_get_new_display_option
- Retrieves an extra display setting which was previously set with al_set_new_display_option.
- al_set_new_display_flags
- Sets various flags to be used when creating new displays on the calling thread.
- al_reset_new_display_options
- This undoes any previous call to al_set_new_display_option on the calling thread.
- al_get_display_option
- Returns an extra display setting of the display.
|
function al_get_new_display_option (option: ALLEGRO_DISPLAY_OPTIONS; var importance: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Retrieves an extra display setting which was previously set with al_set_new_display_option.
|
procedure al_reset_new_display_options; CDECL; external ALLEGRO_LIB_NAME; |
This undoes any previous call to al_set_new_display_option on the calling thread.
See also
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
|
function al_set_display_option (display: ALLEGRO_DISPLAYptr; option: ALLEGRO_DISPLAY_OPTIONS; value: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Changes an option that was previously set for a display. After displays are created, they take on the options set with al_set_new_display_option. Calling al_set_new_display_option subsequently only changes options for newly created displays, and doesn't touch the options of already created displays. al_set_display_option allows changing some of these values. Not all display options can be changed or changing them will have no effect. Changing options other than those listed below is undefined.
ALLEGRO_SUPPORTED_ORIENTATIONS
This can be changed to allow new or restrict previously enabled orientations of the screen/device. See al_set_new_display_option for more information on this option.
See also
- al_get_display_option
- Returns an extra display setting of the display.
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
|
function al_get_display_option (display: ALLEGRO_DISPLAYptr; option: ALLEGRO_DISPLAY_OPTIONS): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns an extra display setting of the display.
See also
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
|
procedure al_hold_bitmap_drawing (hold: AL_BOOL); CDECL; external ALLEGRO_LIB_NAME; |
Enables or disables deferred bitmap drawing. This allows for efficient drawing of many bitmaps that share a parent bitmap, such as sub-bitmaps from a tilesheet or simply identical bitmaps. Drawing bitmaps that do not share a parent is less efficient, so it is advisable to stagger bitmap drawing calls such that the parent bitmap is the same for large number of those calls. While deferred bitmap drawing is enabled, the only functions that can be used are the bitmap drawing functions and font drawing functions. Changing the state such as the blending modes will result in undefined behaviour. One exception to this rule are the non-projection transformations. It is possible to set a new transformation while the drawing is held.
No drawing is guaranteed to take place until you disable the hold. Thus, the idiom of this function's usage is to enable the deferred bitmap drawing, draw as many bitmaps as possible, taking care to stagger bitmaps that share parent bitmaps, and then disable deferred drawing. As mentioned above, this function also works with bitmap and truetype fonts, so if multiple lines of text need to be drawn, this function can speed things up.
See also
- al_is_bitmap_drawing_held
- Returns whether the deferred bitmap drawing mode is turned on or off.
|
function al_is_bitmap_drawing_held: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns whether the deferred bitmap drawing mode is turned on or off.
See also
- al_hold_bitmap_drawing
- Enables or disables deferred bitmap drawing.
|
procedure al_acknowledge_drawing_halt (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
Call this in response to the ALLEGRO_EVENT_DISPLAY_HALT_DRAWING event. This is currently necessary for Android and iOS as you are not allowed to draw to your display while it is not being shown. If you do not call this function to let the operating system know that you have stopped drawing or if you call it to late the application likely will be considered misbehaving and get terminated.
See also
- ALLEGRO_EVENT_DISPLAY_HALT_DRAWING
- When a display receives this event it should stop doing any drawing and then call al_acknowledge_drawing_halt immediately.
- al_acknowledge_drawing_resume
- Call this in response to the event.
|
function al_get_clipboard_text (display: ALLEGRO_DISPLAYptr): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
This function returns a pointer to a string, allocated with al_malloc with the text contents of the clipboard if available. If no text is available on the clipboard then this function returns Nil . You must call al_free on the returned pointer when you don't need it anymore.
Beware that text on the clipboard on Windows may be in Windows format, that is, it may have carriage return newline combinations for the line endings instead of regular newlines for the line endings on Linux or OSX.
See also
- al_set_clipboard_text
- This function pastes the text given as an argument to the clipboard.
- al_clipboard_has_text
- This function returns true if and only if the clipboard has text available.
|
function al_set_clipboard_text (display: ALLEGRO_DISPLAYptr; const text: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
This function pastes the text given as an argument to the clipboard.
See also
- al_get_clipboard_text
- This function returns a pointer to a string, allocated with al_malloc with the text contents of the clipboard if available.
- al_clipboard_has_text
- This function returns true if and only if the clipboard has text available.
|
function al_clipboard_has_text (display: ALLEGRO_DISPLAYptr): AL_BOOL CDECL; external ALLEGRO_LIB_NAME; |
This function returns true if and only if the clipboard has text available.
See also
- al_set_clipboard_text
- This function pastes the text given as an argument to the clipboard.
- al_get_clipboard_text
- This function returns a pointer to a string, allocated with al_malloc with the text contents of the clipboard if available.
|
procedure al_add_config_section (config: ALLEGRO_CONFIGptr; const name: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
Adds a section to a configuration structure with the given name. If the section already exists then nothing happens.
See also
- al_remove_config_section
- Removes a section of a configuration.
- al_create_config
- Creates an empty configuration structure.
|
procedure al_set_config_value (config: ALLEGRO_CONFIGptr; const section, key, value: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
Sets a value in a section of a configuration. If the section doesn't yet exist, it will be created. If a value already existed for the given key, it will be overwritten. The section can be '' for the global section.
For consistency with the on-disk format of config files, any leading and trailing whitespace will be stripped from the value. If you have significant whitespace you wish to preserve, you should add your own quote characters and remove them when reading the values back in.
See also
- al_get_config_value
- Gets a pointer to an internal character buffer that will only remain valid as long as the
ALLEGRO_CONFIGptr structure is not destroyed.
|
procedure al_add_config_comment (config: ALLEGRO_CONFIGptr; const section, comment: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
Adds a comment in a section of a configuration. If the section doesn't yet exist, it will be created. The section can be '' for the global section.
The comment may or may not begin with a hash character. Any newlines in the comment string will be replaced by space characters.
See also
- al_add_config_section
- Adds a section to a configuration structure with the given name.
|
function al_get_config_value (const config: ALLEGRO_CONFIGptr; const section, key: AL_STR): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
Gets a pointer to an internal character buffer that will only remain valid as long as the ALLEGRO_CONFIGptr structure is not destroyed. Copy the value if you need a copy. The section can be '' for the global section.
Returns
Nil if section or key do not exist.
See also
- al_set_config_value
- Sets a value in a section of a configuration.
|
function al_load_config_file (const filename: AL_STR): ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
Reads a configuration file from disk. The configuration structure should be destroyed with al_destroy_config.
Returns
Pointer to configuration or Nil on error. See also
- al_load_config_file_f
- Reads a configuration file from an already open file.
- al_save_config_file
- Writes out a configuration file to disk.
- al_destroy_config
- Frees the resources used by a configuration structure.
|
function al_load_config_file_f (fp: ALLEGRO_FILEptr): ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
Reads a configuration file from an already open file.
Returns
Nil on error. The configuration structure should be destroyed with al_destroy_config. The file remains open afterwards.
See also
- al_load_config_file
- Reads a configuration file from disk.
|
function al_save_config_file (const filename: AL_STR; const config: ALLEGRO_CONFIGptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Writes out a configuration file to disk.
Returns
True on success, False on error.
See also
- al_save_config_file_f
- Writes out a configuration file to an already open file.
- al_load_config_file
- Reads a configuration file from disk.
|
function al_save_config_file_f (fp: ALLEGRO_FILEptr; const config: ALLEGRO_CONFIGptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Writes out a configuration file to an already open file.
Returns
True on success, False on error. The file remains open afterwards.
See also
- al_save_config_file
- Writes out a configuration file to disk.
|
procedure al_merge_config_into (master: ALLEGRO_CONFIGptr; const add: ALLEGRO_CONFIGptr); CDECL; external ALLEGRO_LIB_NAME; |
Merges one configuration structure into another. Values in configuration add override those in master . master is modified. Comments from add are not retained.
See also
- al_merge_config
- Merges two configuration structures, and return the result as a new configuration.
|
function al_merge_config (const cfg1, cfg2: ALLEGRO_CONFIGptr): ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
Merges two configuration structures, and return the result as a new configuration. Values in configuration cfg2 override those in cfg1 . Neither of the input configuration structures are modified. Comments from cfg2 are not retained.
See also
- al_merge_config_into
- Merges one configuration structure into another.
|
procedure al_destroy_config (config: ALLEGRO_CONFIGptr); CDECL; external ALLEGRO_LIB_NAME; |
Frees the resources used by a configuration structure. Does nothing if passed Nil .
See also
- al_create_config
- Creates an empty configuration structure.
- al_load_config_file
- Reads a configuration file from disk.
|
function al_remove_config_section (config: ALLEGRO_CONFIGptr; const section: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Removes a section of a configuration.
Returns
True if the section was removed, or False if the section did not exist.
See also
- al_add_config_section
- Adds a section to a configuration structure with the given name.
|
function al_remove_config_key (config: ALLEGRO_CONFIGptr; const section, key: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Removes a key and its associated value in a section of a configuration.
Returns
True if the entry was removed, or False if the entry did not exist.
|
function al_get_cpu_count: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of CPU cores that the system Allegro is running on has and which could be detected, or a negative number if detection failed. Even if a positive number is returned, it might be that it is not correct. For example, Allegro running on a virtual machine will return the amount of CPU's of the VM, and not that of the underlying system.
Furthermore even if the number is correct, this only gives you information about the total CPU cores of the system Allegro runs on. The amount of cores available to your program may be less due to circumstances such as programs that are currently running.
Therefore, it's best to use this for advisory purposes only. It is certainly a bad idea to make your program exclusive to systems for which this function returns a certain "desirable" number.
This function may be called prior to al_install_system or al_init.
|
function al_get_ram_size: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the size in MB of the random access memory that the system Allegro is running on has and which could be detected, or a negative number if detection failed. Even if a positive number is returned, it might be that it is not correct. For example, Allegro running on a virtual machine will return the amount of RAM of the VM, and not that of the underlying system.
Furthermore even if the number is correct, this only gives you information about the total physical memory of the system Allegro runs on. The memory available to your program may be less due to circumstances such as virtual memory, and other programs that are currently running.
Therefore, it's best to use this for advisory purposes only. It is certainly a bad idea to make your program exclusive to systems for which this function returns a certain "desirable" number.
This function may be called prior to al_install_system or al_init.
|
procedure al_clear_to_color (color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
Clears the complete target bitmap, but confined by the clipping rectangle.
See also
- al_set_clipping_rectangle
- Sets the region of the target bitmap or display that pixels get clipped to.
- al_clear_depth_buffer
- Clears the depth buffer (confined by the clipping rectangle) to the given value.
|
procedure al_clear_depth_buffer (x: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Clears the depth buffer (confined by the clipping rectangle) to the given value. A depth buffer is only available if it was requested with al_set_new_display_option and the requirement could be met by the al_create_display call creating the current display. Operations involving the depth buffer are also affected by al_set_render_state.
For example, if ALLEGRO_DEPTH_FUNCTION is set to ALLEGRO_RENDER_LESS then depth buffer value of 1 represents infinite distance, and thus is a good value to use when clearing the depth buffer.
See also
- al_clear_to_color
- Clears the complete target bitmap, but confined by the clipping rectangle.
- al_set_clipping_rectangle
- Sets the region of the target bitmap or display that pixels get clipped to.
- al_set_render_state
- Sets one of several render attributes.
- al_set_new_display_option
- Sets an extra display option, to be used when creating new displays on the calling thread.
|
procedure al_draw_pixel (x, y: AL_FLOAT; color: ALLEGRO_COLOR); CDECL; external ALLEGRO_LIB_NAME; |
Draws a single pixel at {x, y} . This function, unlike al_put_pixel, does blending and, unlike al_put_blended_pixel, respects the transformations (that is, the pixel's position is transformed, but its size is unaffected - it remains a pixel). This function can be slow if called often; if you need to draw a lot of pixels consider using al_draw_prim with ALLEGRO_PRIM_POINT_LIST from the primitives addon.
Note
This function may not draw exactly where you expect it to. See the Pixel-precise output section on the primitives addon documentation for details on how to control exactly where the pixel is drawn.
Parameters
- x
- destination x
- y
- destination y
- color
- color of the pixel
See also
- ALLEGRO_COLOR
- An
ALLEGRO_COLOR structure describes a color in a device independent way.
- al_put_pixel
- Draws a single pixel on the target bitmap.
|
function al_get_errno: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Some Allegro functions will set an error number as well as returning an error code. Call this function to retrieve the last error number set for the calling thread.
See also
- al_set_errno
- Sets the error number for the calling thread.
- AL_EDOM
- An error value returned by al_get_errno in some cases.
- AL_ERANGE
- An error value returned by al_get_errno in some cases.
|
procedure al_set_errno (errnum: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the error number for the calling thread.
See also
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_fixsqrt (x: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
This finds out the non negative square root of `x'.
If `x' is negative, al_get_errno is set to AL_EDOM and the function returns zero.
|
function al_fixhypot (x, y: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
Fixed point hypotenuse (returns the square root of `x*x + y*y').
This should be better than calculating the formula yourself manually, since the error is much smaller.
|
function al_fixatan (x: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
This function finds the inverse tangent of a value using a lookup table.
The input value must be a fixed point radian. The inverse tangent is the value whose tangent is x.
Example:
var
InverseTangent: AL_FIXED;
begin
InverseTangent := al_fixatan (al_ftofix (0.326))
en.
Returns
The inverse tangent of a fixed point value, measured as a fixed point binary format angle. See also
- al_fixtan
- This function finds the tangent of a value using a lookup table.
- al_fixatan2
- Computes the arc tangent of
y / x , but the signs of both arguments are used to determine the quadrant of the result, and x is permitted to be zero.
|
function al_fixatan2 (y, x: AL_FIXED): AL_FIXED; cdecl; external ALLEGRO_LIB_NAME; |
Computes the arc tangent of y / x , but the signs of both arguments are used to determine the quadrant of the result, and x is permitted to be zero. This function is useful to convert Cartesian coordinates to polar coordinates.
Example:
var
ResultValue: AL_FIXED;
begin
ResultValue := al_fixatan2 (al_itofix (1), 0);
ResultValue ::= al_fixatan2 (al_itofix (-1), al_itofix (-2));
ResultValue := al_fixatan2 (0, 0);
if al_get_errno <> 0 then Halt (-1)
end.
Returns
The arc tangent of y / x in fixed point binary format angle, from -128 to 128. If both x and y are zero, returns zero and sets Allegro's errno to AL_EDOM. See also
- al_fixtan
- This function finds the tangent of a value using a lookup table.
- al_fixatan
- This function finds the inverse tangent of a value using a lookup table.
|
function al_ftofix (x: AL_DOUBLE): AL_FIXED; inline; |
Converts a floating point value to fixed point.
Unlike al_itofix, this function clamps values which could overflow the type conversion, setting al_get_errno to non-zero in the process if this happens.
See also
- al_itofix
- Converts an integer to fixed point.
- al_fixtof
- Converts fixed point to floating point.
|
function al_fixtof (x: AL_FIXED): AL_DOUBLE; inline; |
Converts fixed point to floating point.
See also
- al_ftofix
- Converts a floating point value to fixed point.
|
function al_fixadd (x, y: AL_FIXED): AL_FIXED; inline; |
Safe function to add fixed point numbers clamping overflow.
Although fixed point numbers can be added with the normal '+' integer operator, that doesn't provide any protection against overflow. If overflow is a problem, you should use this function instead. It is slower than using integer operators, but if an overflow occurs it will set al_get_errno and clamp the result, rather than just letting it wrap.
Example:
var
Value: AL_FIXED;
begin
Value := al_fixadd (al_itofix (5000), al_itofix (35));
Value := al_fixadd (al_itofix (-31000), al_itofix (-3000));
if al_get_errno <> 0 then Halt (-1)
end.
Returns
The clamped result of adding x to y, setting Allegro's errno to AL_ERANGE if there was an overflow. See also
- al_fixsub
- Safe function to subtract fixed point numbers clamping underflow.
- al_fixmul
- A fixed point value can be multiplied or divided by an integer with the normal * and / operators.
- al_fixdiv
- A fixed point value can be divided by an integer with the normal / operator.
|
function al_fixsub (x, y: AL_FIXED): AL_FIXED; inline; |
Safe function to subtract fixed point numbers clamping underflow.
Although fixed point numbers can be substracted with the normal '-' integer operator, that doesn't provide any protection against overflow. If overflow is a problem, you should use this function instead. It is slower than using integer operators, but if an overflow occurs it will set al_get_errno and clamp the result, rather than just letting it wrap.
Example:
var
Value: AL_FIXED;
begin
Value := al_fixsub (al_itofix (5000), al_itofix (35));
Value = al_fixsub (al_itofix (-31000), al_itofix (3000));
if al_get_errno <> 0 then Halt (-1)
end.
Returns
The clamped result of substracting y from x, setting Allegro's errno to AL_ERANGE if there was an overflow. See also
- al_fixadd
- Safe function to add fixed point numbers clamping overflow.
- al_fixmul
- A fixed point value can be multiplied or divided by an integer with the normal * and / operators.
- al_fixdiv
- A fixed point value can be divided by an integer with the normal / operator.
|
function al_fixmul (x, y: AL_FIXED): AL_FIXED; inline; |
A fixed point value can be multiplied or divided by an integer with the normal * and / operators. To multiply two fixed point values, though, you must use this function.
Example:
var
Value: AL_FIXED;
begin
Value := al_fixmul (al_itofix (10), al_itofix (3000))
end.
Returns
The clamped result of multiplying x by y. See also
- al_fixadd
- Safe function to add fixed point numbers clamping overflow.
- al_fixsub
- Safe function to subtract fixed point numbers clamping underflow.
- al_fixdiv
- A fixed point value can be divided by an integer with the normal / operator.
|
function al_fixdiv (x, y: AL_FIXED): AL_FIXED; inline; |
A fixed point value can be divided by an integer with the normal / operator. To divide two fixed point values, though, you must use this function. If a division by zero occurs, Allegro's errno will be set and the maximum possible value will be returned, but errno is not cleared if the operation is successful. This means that if you are going to test for division by zero you should call al_set_errno (0) before calling al_fixdiv .
Example:
var
Value: AL_FIXED;
begin
Value := al_fixdiv (al_itofix (2), al_itofix (33));
Value := al_fixdiv (0, al_itofix (-30));
Value := al_fixdiv (al_itofix (-100), al_itofix (0));
if al_get_errno <> 0 then Halt (-1)
end.
Returns
The result of dividing x by y. If y is zero, returns the maximum possible fixed point value and sets Allegro's errno to AL_ERANGE. See also
- al_fixadd
- Safe function to add fixed point numbers clamping overflow.
- al_fixsub
- Safe function to subtract fixed point numbers clamping underflow.
- al_fixmul
- A fixed point value can be multiplied or divided by an integer with the normal * and / operators.
|
function al_fixfloor (x: AL_FIXED): AL_FIXED; inline; |
Returns the greatest integer not greater than x.
That is, it rounds towards negative infinity.
Example:
var
Number: AL_FIXED;
begin
Number := al_fixfloor (al_itofix (100) / 3);
Number := al_fixfloor (al_itofix (100) / 6)
end.
See also
- al_fixtoi
- Converts fixed point to integer, rounding as required to the nearest integer.
- al_fixceil
- Returns the smallest integer not less than x.
|
function al_fixceil (x: AL_FIXED): AL_FIXED; inline; |
Returns the smallest integer not less than x.
That is, it rounds towards positive infinity.
Example:
var
Number: AL_FIXED;
begin
Number := al_fixceil (al_itofix (100) / 3);
Number := al_fixceil (al_itofix (100) / 6)
end.
See also
- al_fixtoi
- Converts fixed point to integer, rounding as required to the nearest integer.
- al_fixfloor
- Returns the greatest integer not greater than x.
|
function al_itofix (x: AL_INT): AL_FIXED; inline; |
Converts an integer to fixed point.
This is the same thing as x shl 16 . Remember that overflows (trying to convert an integer greater than 32767) and underflows (trying to convert an integer lesser than -32768) are not detected even in debug builds! The values simply "wrap around".
Example:
var
Number: AL_FIXED;
begin
Number := al_itofix (100);
if al_fixtoi (Number) <> 100 then Halt (-1);
Number := al_itofix (64000);
if al_fixtoi (Number) <> 64000 then Halt (-1)
end.
Returns
The value of the integer converted to fixed point ignoring overflows. See also
- al_fixtoi
- Converts fixed point to integer, rounding as required to the nearest integer.
- al_ftofix
- Converts a floating point value to fixed point.
- al_fixtof
- Converts fixed point to floating point.
|
function al_fixtrunc (x: AL_FIXED): AL_INT; inline; |
Returns the integer part of x, which is alwais smaller than (or equal to) X in absolute value.
See also
- al_fixtoi
- Converts fixed point to integer, rounding as required to the nearest integer.
- al_itofix
- Converts an integer to fixed point.
|
function al_fixtoi (x: AL_FIXED): AL_INT; inline; |
Converts fixed point to integer, rounding as required to the nearest integer.
) In general, this is the same as x shr 16 but this won't work with negative numbers. In that case it is equivalent to not ((not x) shr 16) .
Example:
var
Value: AL_FIXED;
begin
Value := al_fixtoi (al_itofix (100) div 3);
Value := al_fixtoi (al_itofix (100) div 6)
end.
See also
- al_itofix
- Converts an integer to fixed point.
- al_fixtrunc
- Returns the integer part of x, which is alwais smaller than (or equal to) X in absolute value.
|
function al_fixcos (x: AL_FIXED): AL_FIXED; inline; |
This function finds the cosine of a value using a lookup table.
The input value must be a fixed point binary angle.
Example:
var
Angle: AL_FIXED;
Value: Real;
begin
Angle := al_itofix (32);
Value := al_fixtof (al_fixcos (Angle));
if not ((Value > 0.7) and (Value < 0.71)) then Halt (-1)
end.
Returns
The cosine of a fixed point binary format angle. See also
- al_fixsin
- This function finds the sine of a value using a lookup table.
- al_fixacos
- This function finds the inverse cosine of a value using a lookup table.
|
function al_fixsin (x: AL_FIXED): AL_FIXED; inline; |
This function finds the sine of a value using a lookup table.
The input value must be a fixed point binary angle.
Example:
var
Angle: AL_FIXED;
Value: Real;
begin
Angle := al_itofix (64);
Value := al_fixtof (al_fixsin (Angle));
if Value <> 1 then Halt (-1)
end.
Returns
The cosine of a fixed point binary format angle. See also
- al_fixcos
- This function finds the cosine of a value using a lookup table.
- al_fixasin
- This function finds the inverse sine of a value using a lookup table.
|
function al_fixtan (x: AL_FIXED): AL_FIXED; inline; |
This function finds the tangent of a value using a lookup table.
The input value must be a fixed point binary angle.
Example:
var
Angle: AL_FIXED, ResA, ResB;
Dif: Real;
begin
Angle := al_itofix (37);
ResA := al_fixdiv (al_fixsin (Angle), al_fixcos (Angle));
ResB := al_fixtan (Angle);
Dif := al_fixtof (al_fixsub (ResA, ResB));
WriteLn (Format ('Precision error: %f', [Dif]))
end.
Returns
The tangent of a fixed point binary format angle. See also
- al_fixatan
- This function finds the inverse tangent of a value using a lookup table.
- al_fixcos
- This function finds the cosine of a value using a lookup table.
- al_fixsin
- This function finds the sine of a value using a lookup table.
|
function al_fixacos (x: AL_FIXED): AL_FIXED; inline; |
This function finds the inverse cosine of a value using a lookup table.
The inverse cosine is defined only in the domain from -1 to 1. Outside of this input range, the function will set Allegro's errno to AL_EDOM and return zero.
Example:
var
Value: AL_FIXED;
begin
Value = al_fixacos (al_itofix (-1))
end.
Returns
The inverse cosine of a fixed point value, measured as fixed point binary format angle, or zero if the input was out of range. All return values of this function will be in the range 0 to 128. See also
- al_fixcos
- This function finds the cosine of a value using a lookup table.
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_fixasin (x: AL_FIXED): AL_FIXED; inline; |
This function finds the inverse sine of a value using a lookup table.
The inverse sine is defined only in the domain from -1 to 1. Outside of this input range, the function will set Allegro's errno to AL_EDOM and return zero.
Example:
var
Angle: Real;
Value: AL_FIXED;
begin
Value = al_fixasin (al_itofix (1))
Angle := al_fixtof (al_fixmul (al_fixasin (al_ftofix (0.238)), AL_FIXTORAD_R));
Value := al_fixasin (al_ftofix (-1.09));
if al_get_errno <> 0 then Halt (-1)
end.
Returns
The inverse sine of a fixed point value, measured as fixed point binary format angle, or zero if the input was out of range. All return values of this function will be in the range 0 to 128. See also
- al_fixsin
- This function finds the sine of a value using a lookup table.
- al_get_errno
- Some Allegro functions will set an error number as well as returning an error code.
|
function al_get_num_display_modes: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the number of available fullscreen display modes for the current set of display parameters. This will use the values set with al_set_new_display_refresh_rate, and al_set_new_display_flags to find the number of modes that match. Setting the new display parameters to zero will give a list of all modes for the default driver.
See also
- al_get_display_mode
- Retrieves a fullscreen mode.
|
function al_get_display_mode (index: AL_INT; out mode: ALLEGRO_DISPLAY_MODE): ALLEGRO_DISPLAY_MODEptr; CDECL; external ALLEGRO_LIB_NAME; |
Retrieves a fullscreen mode. Display parameters should not be changed between a call of al_get_num_display_modes and al_get_display_mode .
Parameters
- index
- Must be between 0 and the number returned from
al_get_num_display_modes - 1 .
- mode
- Must be an allocated
ALLEGRO_DISPLAY_MODE structure.
Returns
Nil on failure, or a pointer to the mode parameter that was passed in on success.
See also
- ALLEGRO_DISPLAY_MODE
- Used for fullscreen mode queries.
- al_get_num_display_modes
- Gets the number of available fullscreen display modes for the current set of display parameters.
|
function al_install_joystick: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Installs a joystick driver, returning True if successful. If a joystick driver was already installed, returns True immediately.
See also
- al_uninstall_joystick
- Uninstalls the active joystick driver.
|
procedure al_uninstall_joystick; CDECL; external ALLEGRO_LIB_NAME; |
Uninstalls the active joystick driver. All outstanding ALLEGRO_JOYSTICKptr pointers are invalidated. If no joystick driver was active, this function does nothing.
This function is automatically called when Allegro is shut down.
See also
- al_install_joystick
- Installs a joystick driver, returning
True if successful.
|
function al_is_joystick_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if al_install_joystick was called successfully.
|
function al_reconfigure_joysticks: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Allegro is able to cope with users connecting and disconnected joystick devices on-the-fly. On existing platforms, the joystick event source will generate an event of type ALLEGRO_EVENT_JOYSTICK_CONFIGURATION when a device is plugged in or unplugged. In response, you should call al_reconfigure_joysticks .
Afterwards, the number returned by al_get_num_joysticks may be different, and the handles returned by al_get_joystick may be different or be ordered differently.
All ALLEGRO_JOYSTICKptr handles remain valid, but handles for disconnected devices become inactive: their states will no longer update, and al_get_joystick will not return the handle. Handles for devices which remain connected will continue to represent the same devices. Previously inactive handles may become active again, being reused to represent newly connected devices.
It is possible that on some systems, Allegro won't be able to generate ALLEGRO_EVENT_JOYSTICK_CONFIGURATION events. If your game has an input configuration screen or similar, you may wish to call al_reconfigure_joysticks when entering that screen.
Returns
True if the joystick configuration changed, otherwise False .
See also
- al_get_joystick_event_source
- Retrieves the global joystick event source.
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
|
function al_get_num_joysticks: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of joysticks currently on the system (or potentially on the system). This number can change after al_reconfigure_joysticks is called, in order to support hotplugging.
Returns 0 if there is no joystick driver installed.
See also
- al_get_joystick
- Gets a handle for a joystick on the system.
- al_get_joystick_active
- Returns if the joystick handle is "active", i.e.
|
function al_get_joystick (joyn: AL_INT): ALLEGRO_JOYSTICKptr; CDECL; external ALLEGRO_LIB_NAME; |
Gets a handle for a joystick on the system. The number may be from 0 to al_get_num_joysticks - 1 . If successful a pointer to a joystick object is returned, which represents a physical device. Otherwise Nil is returned.
The handle and the index are only incidentally linked. After al_reconfigure_joysticks is called, al_get_joystick may return handles in a different order, and handles which represent disconnected devices will not be returned.
See also
- al_get_num_joysticks
- Returns the number of joysticks currently on the system (or potentially on the system).
- al_reconfigure_joysticks
- Allegro is able to cope with users connecting and disconnected joystick devices on-the-fly.
- al_get_joystick_active
- Returns if the joystick handle is "active", i.e.
|
procedure al_release_joystick (j: ALLEGRO_JOYSTICKptr); CDECL; external ALLEGRO_LIB_NAME; |
This procedure currently does nothing.
See also
- al_get_joystick
- Gets a handle for a joystick on the system.
|
function al_get_joystick_active (j: ALLEGRO_JOYSTICKptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns if the joystick handle is "active", i.e. in the current configuration, the handle represents some physical device plugged into the system. al_get_joystick returns active handles. After reconfiguration, active handles may become inactive, and vice versa.
See also
- al_reconfigure_joysticks
- Allegro is able to cope with users connecting and disconnected joystick devices on-the-fly.
|
function al_get_joystick_stick_flags (j: ALLEGRO_JOYSTICKptr; stick: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the flags of the given "stick". If the stick doesn't exist, Nil is returned. Indices begin from 0 .
See also
- ALLEGRO_JOYFLAGS
- This is a holdover from the old API and may be removed.
|
function al_get_joystick_num_axes (j: ALLEGRO_JOYSTICKptr; stick: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of axes on the given "stick". If the stick doesn't exist, 0 is returned.
See also
- al_get_joystick_num_sticks
- Returns the number of "sticks" on the given joystick.
|
function al_get_joystick_event_source: ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
Retrieves the global joystick event source. All joystick events are generated by this event source.
See also
- al_register_event_source
- Register the event source with the event queue specified.
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
|
function al_is_keyboard_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if al_install_keyboard was called successfully.
|
function al_install_keyboard: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Installs a keyboard driver.
Returns
True if successful. If a driver was already installed, nothing happens and True is returned.
See also
- al_uninstall_keyboard
- Uninstalls the active keyboard driver, if any.
- al_is_keyboard_installed
- Returns
True if al_install_keyboard was called successfully.
|
procedure al_uninstall_keyboard; CDECL; external ALLEGRO_LIB_NAME; |
Uninstalls the active keyboard driver, if any. This will automatically unregister the keyboard event source with any event queues.
This function is automatically called when Allegro is shut down.
See also
- al_install_keyboard
- Installs a keyboard driver.
|
function al_set_keyboard_leds (leds: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Overrides the state of the keyboard LED indicators. Set leds to a combination of the keyboard modifier flags to enable the corresponding LED indicators (ALLEGRO_KEYMOD_NUMLOCK , ALLEGRO_KEYMOD_CAPSLOCK and ALLEGRO_KEYMOD_SCROLLLOCK are supported) or to -1 to return to default behavior.
Returns
False if the current keyboard driver cannot set LED.
|
function al_keycode_to_name (keycode: AL_INT): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
Converts the given keycode to a description of the key.
|
procedure al_get_keyboard_state (out ret_state: ALLEGRO_KEYBOARD_STATE); CDECL; external ALLEGRO_LIB_NAME; |
Saves the state of the keyboard specified at the time the function is called into ret_state .
See also
- al_key_down
- Returns
True if the key specified was held down in the state specified.
- ALLEGRO_KEYBOARD_STATE
- This is a structure that is used to hold a "snapshot" of keyboard at a particular instant.
|
procedure al_clear_keyboard_state (display: ALLEGRO_DISPLAYptr); CDECL; external ALLEGRO_LIB_NAME; |
Clears the state of the keyboard, emitting ALLEGRO_EVENT_KEY_UP for each currently pressed key. The given display is regarded as the one which had the keyboard focus when the event occurred. In case display is Nil no event is emitted. For most keyboard drivers Allegro maintains its own state of the keyboard, which might get out of sync with the real one. This function is intended to remedy such situation by resetting Allegro's keyboard state to a known default (no key pressed). This is particularly useful in response to ALLEGRO_EVENT_DISPLAY_SWITCH_OUT events.
Unstable API: This is a new feature and the exact semantics are still being decided upon.
See also
- al_get_keyboard_state
- Saves the state of the keyboard specified at the time the function is called into
ret_state .
- ALLEGRO_KEYBOARD_STATE
- This is a structure that is used to hold a "snapshot" of keyboard at a particular instant.
|
function al_key_down (var state: ALLEGRO_KEYBOARD_STATE; keycode: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if the key specified was held down in the state specified.
See also
- ALLEGRO_KEYBOARD_STATE
- This is a structure that is used to hold a "snapshot" of keyboard at a particular instant.
|
function al_get_keyboard_event_source: ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
Retrieves the keyboard event source. All keyboard events are generated by this event source.
Returns
Nil if the keyboard subsystem was not installed.
See also
- al_register_event_source
- Register the event source with the event queue specified.
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
|
function al_is_mouse_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if al_install_mouse was called successfully.
|
function al_install_mouse: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Installs mouse driver.
Returns
True if successful. If a driver was already installed, nothing happens and True is returned.
See also
- al_uninstall_mouse
- Uninstalls the active mouse driver, if any.
- al_is_mouse_installed
- Returns
True if al_install_mouse was called successfully.
|
procedure al_uninstall_mouse; CDECL; external ALLEGRO_LIB_NAME; |
Uninstalls the active mouse driver, if any. This will automatically unregister the mouse event source with any event queues.
This function is automatically called when Allegro is shut down.
See also
- al_install_mouse
- Installs mouse driver.
|
function al_get_mouse_num_buttons: AL_UINT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of buttons on the mouse. The first button is 1.
See also
- al_get_mouse_num_axes
- Returns the number of axes on the mouse.
|
function al_get_mouse_num_axes: AL_UINT; CDECL; external ALLEGRO_LIB_NAME; |
Returns the number of axes on the mouse. The first axis is 0.
See also
- al_get_mouse_num_buttons
- Returns the number of buttons on the mouse.
|
function al_set_mouse_xy (display: ALLEGRO_DISPLAYptr; x, y: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Tryes to position the mouse at the given coordinates on the given display. The mouse movement resulting from a successful move will generate an ALLEGRO_EVENT_MOUSE_WARPED event.
Returns
True on success, False on failure.
See also
- al_set_mouse_z
- Sets the mouse wheel position to the given value.
- al_set_mouse_w
- Sets the second mouse wheel position to the given value.
|
function al_set_mouse_z (z: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets the mouse wheel position to the given value.
Returns
True on success, False on failure.
See also
- al_set_mouse_xy
- Tryes to position the mouse at the given coordinates on the given display.
- al_set_mouse_w
- Sets the second mouse wheel position to the given value.
|
function al_set_mouse_w (w: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets the second mouse wheel position to the given value.
Returns
True on success, False on failure.
See also
- al_set_mouse_xy
- Tryes to position the mouse at the given coordinates on the given display.
- al_set_mouse_z
- Sets the mouse wheel position to the given value.
|
function al_set_mouse_axis (axis, value: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets the given mouse axis to the given value.
The axis number must not be 0 or 1, which are the X and Y axes. Use al_set_mouse_xy for that.
Returns
True on success, False on failure.
See also
- al_set_mouse_xy
- Tryes to position the mouse at the given coordinates on the given display.
- al_set_mouse_z
- Sets the mouse wheel position to the given value.
- al_set_mouse_w
- Sets the second mouse wheel position to the given value.
|
procedure al_get_mouse_state (out ret_state: ALLEGRO_MOUSE_STATE); CDECL; external ALLEGRO_LIB_NAME; |
Saves the state of the mouse specified at the time the function is called into ret_state .
Example:
VAR
State: ALLEGRO_MOUSE_STATE;
BEGIN
al_get_mouse_state (State);
IF (State.buttons AND 1) <> 0 THEN
WriteLn (Format ('Mouse position: (%d, %d)', [State.x, State.y]));
IF (State.buttons AND 2) <> 0 THEN
;
IF (State.buttons AND 4) <> 0 THEN
;
END.
See also
- ALLEGRO_MOUSE_STATE
- Stores mouse state.
- al_get_mouse_state_axis
- Extracts the mouse axis value from the saved state.
- al_mouse_button_down
- Returns
True if the mouse button specified was held down in the state specified.
|
function al_mouse_button_down (var state: ALLEGRO_MOUSE_STATE; button: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if the mouse button specified was held down in the state specified. Unlike most things, the first mouse button is numbered 1.
See also
- ALLEGRO_MOUSE_STATE
- Stores mouse state.
- al_get_mouse_state
- Saves the state of the mouse specified at the time the function is called into
ret_state .
- al_get_mouse_state_axis
- Extracts the mouse axis value from the saved state.
|
function al_get_mouse_state_axis (var state: ALLEGRO_MOUSE_STATE; axis: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Extracts the mouse axis value from the saved state. The axes are numbered from 0, in this order: x-axis, y-axis, z-axis, w-axis.
See also
- ALLEGRO_MOUSE_STATE
- Stores mouse state.
- al_get_mouse_state
- Saves the state of the mouse specified at the time the function is called into
ret_state .
- al_mouse_button_down
- Returns
True if the mouse button specified was held down in the state specified.
|
function al_get_mouse_cursor_position (out ret_x, ret_y: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
On platforms where this information is available, this function returns the global location of the mouse cursor, relative to the desktop. You should not normally use this function, as the information is not useful except for special scenarios as moving a window.
Returns
True on success, False on failure.
|
function al_grab_mouse (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Confines the mouse cursor to the given display. The mouse cursor can only be confined to one display at a time.
Do not assume that the cursor will remain confined until you call al_ungrab_mouse. It may lose the confined status at any time for other reasons.
Note
not yet implemented on Mac OS X.
Returns
True if successful, otherwise returns False .
See also
- al_ungrab_mouse
- Stop confining the mouse cursor to any display belonging to the program.
|
function al_ungrab_mouse: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Stop confining the mouse cursor to any display belonging to the program.
Note
not yet implemented on Mac OS X.
See also
- al_grab_mouse
- Confines the mouse cursor to the given display.
|
procedure al_set_mouse_wheel_precision (precision: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets the precision of the mouse wheel (the z and w coordinates). This precision manifests itself as a multiplier on the dz and dw fields in mouse events. It also affects the z and w fields of events and ALLEGRO_MOUSE_STATE, but not in a simple way if you alter the precision often, so it is suggested to reset those axes to 0 when you change precision. Setting this to a high value allows you to detect small changes in those two axes for some high precision mice. A flexible way of using this precision is to set it to a high value (120 is likely sufficient for most, if not all, mice) and use a floating point dz and dw like so:
VAR
Event: ALLEGRO_EVENT;
dz := DOUBLE;
BEGIN
al_set_mouse_wheel_precision (120);
al_wait_for_event (EventQueue, Event);
IF Event.ftype = ALLEGRO_EVENT_MOUSE_AXES THEN
BEGIN
dz := Event.mouse.dz / al_get_mouse_wheel_precision ();
END;
END.
Precision is set to 1 by default. It is impossible to set it to a lower precision than that.
See also
- al_get_mouse_wheel_precision
- Gets the precision of the mouse wheel (the z and w coordinates).
|
function al_get_mouse_wheel_precision: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the precision of the mouse wheel (the z and w coordinates).
See also
- al_set_mouse_wheel_precision
- Sets the precision of the mouse wheel (the z and w coordinates).
|
function al_get_mouse_event_source: ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_LIB_NAME; |
Retrieve the mouse event source. All mouse events are generated by this event source.
Returns
Nil if the mouse subsystem was not installed.
See also
- al_register_event_source
- Register the event source with the event queue specified.
- ALLEGRO_EVENT_MOUSE_AXES
- One or more mouse axis values changed.
|
procedure al_free (p: AL_POINTER); inline; |
Like FreeMem , releases the memory occupied by pointer p . The implementation may be overriden.
Additionally, on Windows, a memory block allocated by one DLL must be freed from the same DLL. In the few places where an Allegro function returns a pointer that must be freed, you must use al_free for portability to Windows.
See also
- al_malloc
- Like
GetMem , reserves n bytes memory on heap and returns a pointer to this memory.
- al_free_with_context
- This releases the memory reserved by the Allegro library (this matters on Windows), unless overridden with al_set_memory_interface.
|
function al_realloc (p: AL_POINTER; const n: AL_SIZE_T): AL_POINTER; inline; |
Like ReAllocMem , resizes the memory pointed to by p so it has size n . The value of p may change during this operation. The contents of the memory pointed to by p (if any) will be copied to the new location, but may be truncated if the newly allocated memory block is smaller in size. If a larger block is allocated, only the used memory is initialized, extra memory will not be zeroed out. The implementation may be overriden.
See also
- al_malloc
- Like
GetMem , reserves n bytes memory on heap and returns a pointer to this memory.
- al_realloc_with_context
- This reserves memory for the Allegro library (this matters on Windows), unless overridden with al_set_memory_interface.
|
procedure al_free_with_context (ptr: AL_POINTER; line: AL_INT; const afile, func: AL_STR); CDECL; external ALLEGRO_LIB_NAME; |
This releases the memory reserved by the Allegro library (this matters on Windows), unless overridden with al_set_memory_interface.
Generally you should use the al_free function.
|
function al_get_num_video_adapters: AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
Gets the number of video "adapters" attached to the computer. Each video card attached to the computer counts as one or more adapters. An adapter is thus really a video port that can have a monitor connected to it.
On Windows, use al_set_new_display_flags to switch between Direct3D and OpenGL backends, which will often have different adapters available.
See also
- al_get_monitor_info
- Gets information about a monitor's position on the desktop.
|
function al_get_monitor_info (adapter: AL_INT; out info: ALLEGRO_MONITOR_INFO): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Gets information about a monitor's position on the desktop. adapter is a number from 0 to al_get_num_video_adapters - 1 .
On Windows, use al_set_new_display_flags to switch between Direct3D and OpenGL backends, which will often have different adapters available.
Returns
True on success, False on failure.
See also
- ALLEGRO_MONITOR_INFO
- Describes a monitor's size and position relative to other monitors.
- al_get_num_video_adapters
- Gets the number of video "adapters" attached to the computer.
|
function al_get_monitor_dpi (adapter: AL_INT): AL_INT; CDECL; external ALLEGRO_LIB_NAME; |
|
function al_create_mouse_cursor (sprite: ALLEGRO_BITMAPptr; xfocus, yfocus: AL_INT): ALLEGRO_MOUSE_CURSORptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a mouse cursor from the bitmap provided.
Parameters
- x_focus
- Describes the bit of the cursor that will represent the actual mouse position.
- y_focus
- Describes the bit of the cursor that will represent the actual mouse position.
Returns
A pointer to the cursor on success, or Nil on failure. See also
- al_set_mouse_cursor
- Sets the given mouse cursor to be the current mouse cursor for the given display.
- al_destroy_mouse_cursor
- Frees the memory used by the given cursor.
|
procedure al_destroy_mouse_cursor (cursor: ALLEGRO_MOUSE_CURSORptr); CDECL; external ALLEGRO_LIB_NAME; |
Frees the memory used by the given cursor.
It has no effect if cursor is Nil .
See also
- al_create_mouse_cursor
- Creates a mouse cursor from the bitmap provided.
|
function al_set_mouse_cursor (display: ALLEGRO_DISPLAYptr; cursor: ALLEGRO_MOUSE_CURSORptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets the given mouse cursor to be the current mouse cursor for the given display.
If the cursor is currently 'shown' (as opposed to 'hidden') the change is immediately visible.
Returns
True on success, False on failure.
See also
- al_set_system_mouse_cursor
- Sets the given system mouse cursor to be the current mouse cursor for the given
display .
- al_show_mouse_cursor
- Makes a mouse cursor visible in the given display.
- al_hide_mouse_cursor
- Hides the mouse cursor in the given display.
|
function al_set_system_mouse_cursor (display: ALLEGRO_DISPLAYptr; cursor_id: ALLEGRO_SYSTEM_MOUSE_CURSOR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets the given system mouse cursor to be the current mouse cursor for the given display . If the cursor is currently 'shown' (as opposed to 'hidden') the change is immediately visible.
If the cursor doesn't exist on the current platform another cursor will be silently be substituted.
Returns
True on success, False on failure.
See also
- ALLEGRO_SYSTEM_MOUSE_CURSOR
- Used to identify the mouse cursor.
- al_set_mouse_cursor
- Sets the given mouse cursor to be the current mouse cursor for the given display.
- al_show_mouse_cursor
- Makes a mouse cursor visible in the given display.
- al_hide_mouse_cursor
- Hides the mouse cursor in the given display.
|
function al_show_mouse_cursor (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Makes a mouse cursor visible in the given display.
Returns
True if a mouse cursor is shown as a result of the call (or one already was visible), False otherwise.
See also
- al_hide_mouse_cursor
- Hides the mouse cursor in the given display.
|
function al_hide_mouse_cursor (display: ALLEGRO_DISPLAYptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Hides the mouse cursor in the given display. This has no effect on what the current mouse cursor looks like; it just makes it disappear.
Returns
True on success (or if the cursor already was hidden), False otherwise.
See also
- al_show_mouse_cursor
- Makes a mouse cursor visible in the given display.
|
procedure al_set_render_state (state: ALLEGRO_RENDER_STATE; value: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Sets one of several render attributes.
This function does nothing if the target bitmap is a memory bitmap.
Parameters
- state
- Possible render states which can be one of ALLEGRO_RENDER_STATE.
- value
- Value to apply to the given
state .
|
procedure al_use_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation). Every drawing operation after this call will be transformed using this transformation. Call this function with an identity transformation to return to the default behaviour.
This function does nothing if there is no target bitmap.
The parameter is passed by reference as an optimization to avoid the overhead of stack copying. The reference will not be stored in the Allegro library so it is safe to pass references to local variables.
PROCEDURE SetupMyTransformation;
VAR
Transform: ALLEGRO_TRANSFORM;
BEGIN
al_translate_transform (Transform, 5, 10);
al_use_transform (Transform)
END;
Parameters
- trans
- Transformation to use.
See also
- al_get_current_transform
- Returns the transformation of the current target bitmap, as set by al_use_transform.
- al_transform_coordinates
- Transforms a pair of coordinates.
|
procedure al_use_projection_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation). Every drawing operation after this call will be transformed using this transformation. To return default behavior, call this function with an orthographic transform like so:
VAR
Trans: ALLEGRO_TRANSFORM;
BEGIN
al_identity_transform (Trans);
al_orthographic_transform (
Trans,
0, 0, -1.0,
al_get_bitmap_width (Bitmap), al_get_bitmap_height (Bitmap), 1.0
);
al_set_target_bitmap (Bitmap);
al_use_projection_transform (trans)
END;
The orthographic transformation above is the default projection transform.
This function does nothing if there is no target bitmap. This function also does nothing if the bitmap is a memory bitmap (i.e. memory bitmaps always use an orthographic transform like the snippet above). Note that the projection transform will be reset to default if a video bitmap is converted to a memory bitmap. Additionally, if the bitmap in question is the backbuffer, it's projection transformation will be reset to default if it is resized. Lastly, when you draw a memory bitmap to a video bitmap with a custom projection transform, this transformation will be ignored (i.e. it'll be as if the projection transform of the target bitmap was temporarily reset to default).
The parameter is passed by reference as an optimization to avoid the overhead of stack copying. The reference will not be stored in the Allegro library so it is safe to pass references to local variables.
See also
- al_get_current_projection_transform
- (void) Returns a pointer to the current projection transformation.
|
procedure al_copy_transform (out dest: ALLEGRO_TRANSFORM; var src: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Makes a copy of a transformation.
Parameters
- src
- Source transformation.
- dest
- Destination transformation.
|
procedure al_identity_transform (out trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Sets the transformation to be the identity transformation. This is the default transformation. Use al_use_transform on an identity transformation to return to the default.
VAR
T: ALLEGRO_TRANSFORM;
BEGIN
al_identity_transform (T);
al_use_transform (T)
END;
Parameters
- trans
- Transformation to alter.
See also
- al_translate_transform
- Applies a translation to a transformation.
- al_rotate_transform
- Applies a rotation to a transformation.
- al_scale_transform
- Applies a scale to a transformation.
- al_transpose_transform
- Transposes the matrix of the given transform.
|
procedure al_build_transform (out trans: ALLEGRO_TRANSFORM; x, y, sx, sy, theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Builds a transformation given some parameters. This call is equivalent to calling the transformations in this order: make identity, rotate, scale, translate. This method is faster, however, than actually calling those functions.
Note
this function was previously documented to be equivalent to a different (and more useful) order of operations: identity, scale, rotate, translate.
Parameters
- trans
- Transformation to alter.
- x
- Horizontal translation.
- y
- Vertical translation.
- sx
- Horizontal scale.
- sy
- Vertical scale.
- theta
- Rotation angle in radians:
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_translate_transform
- Applies a translation to a transformation.
- al_rotate_transform
- Applies a rotation to a transformation.
- al_scale_transform
- Applies a scale to a transformation.
- al_compose_transform
- Composes (combine) two transformations by a matrix multiplication.
|
procedure al_build_camera_transform (out trans: ALLEGRO_TRANSFORM; position_x, position_y, position_z, look_x, look_y, look_z, up_x, up_y, up_z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Builds a transformation which can be used to transform 3D coordinates in world space to camera space. This involves translation and a rotation. The function expects three coordinate triplets: The camera's position, the position the camera is looking at and an up vector. The up vector does not need to be of unit length and also does not need to be perpendicular to the view direction - it can usually just be the world up direction (most commonly 0/1/0).
For example:
al_build_camera_transform (
T,
1, 1, 1,
5, 5, 5,
0, 1, 0
);
This create a transformation for a camera standing at 1/1/1 and looking towards 5/5/5.
Note: If the position and look parameters are identical, or if the up direction is parallel to the view direction, an identity matrix is created.
Another example which will simply re-create the identity matrix:
al_build_camera_transform (
T,
0, 0, 0,
0, 0, -1,
0, 1, 0
);
An example where the up vector will cause the camera to lean (roll) by 45 degrees:
al_build_camera_transform (
T,
1, 1, 1,
5, 5, 5,
1, 1, 0
);
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_translate_transform_3d
- Combines the given transformation with a transformation which translates coordinates by the given vector.
- al_rotate_transform_3d
- Combines the given transformation with a transformation which rotates coordinates around the given vector by the given angle in radians.
- al_scale_transform_3d
- Combines the given transformation with a transformation which scales coordinates by the given vector.
- al_compose_transform
- Composes (combine) two transformations by a matrix multiplication.
- al_use_transform
- Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation).
|
procedure al_translate_transform (var trans: ALLEGRO_TRANSFORM; x, y: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Applies a translation to a transformation.
Parameters
- trans
- Transformation to alter.
- x
- Horizontal translation.
- y
- Vertical translation.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_rotate_transform
- Applies a rotation to a transformation.
- al_scale_transform
- Applies a scale to a transformation.
- al_build_transform
- Builds a transformation given some parameters.
|
procedure al_translate_transform_3d (var trans: ALLEGRO_TRANSFORM; x, y, z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Combines the given transformation with a transformation which translates coordinates by the given vector.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_use_projection_transform
- Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation).
|
procedure al_rotate_transform_3d (var trans: ALLEGRO_TRANSFORM; x, y, z, theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Combines the given transformation with a transformation which rotates coordinates around the given vector by the given angle in radians.
Note: The vector is assumed to be of unit length (otherwise it will also incur a scale).
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_rotate_transform
- Applies a rotation to a transformation.
|
procedure al_scale_transform_3D (var trans: ALLEGRO_TRANSFORM; sx, sy, sz: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Combines the given transformation with a transformation which scales coordinates by the given vector.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_use_projection_transform
- Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation).
|
procedure al_transform_coordinates (var trans: ALLEGRO_TRANSFORM; var x, y: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Transforms a pair of coordinates.
Parameters
- trans
- Transformation to use.
- x
- Horizontal coordinate.
- y
- Vertical coordinate.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_use_transform
- Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation).
- al_transform_coordinates_3d
- Transforms x, y, z coordinates.
|
procedure al_transform_coordinates_3d (var trans: ALLEGRO_TRANSFORM; var x, y, z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Transforms x, y, z coordinates.
Note: If you are using a projection transform you most likely will want to use al_transform_coordinates_3d_projective instead.
Parameters
- trans
- Transformation to use.
- x
- Horizontal coordinate.
- y
- Vertical coordinate.
- z
- Depth coordinate.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_use_transform
- Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation).
- al_transform_coordinates
- Transforms a pair of coordinates.
|
procedure al_transform_coordinates_4d (var trans: ALLEGRO_TRANSFORM; var x, y, z, w: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Transforms x, y, z, w coordinates.
Parameters
- trans
- Transformation to use.
- x
- Horizontal coordinate.
- y
- Vertical coordinate.
- z
- Depth coordinate.
- w
- W coordinate.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_use_transform
- Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation).
- al_transform_coordinates
- Transforms a pair of coordinates.
- al_transform_coordinates_3d
- Transforms x, y, z coordinates.
|
procedure al_transform_coordinates_3d_projective (var trans: ALLEGRO_TRANSFORM; var x, y, z: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Transforms x , y , z as homogeneous coordinates. This is the same as using al_transform_coordinates_4d with the w coordinate set to 1, then dividing x , y , z by the resulting w . This will provide the same coordinates Allegro will draw to when a projective transform is in effect as set with al_use_projection_transform.
Parameters
- trans
- Transformation to use.
- x
- Horizontal coordinate.
- y
- Vertical coordinate.
- z
- Depth coordinate.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_use_transform
- Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation).
- al_transform_coordinates
- Transforms a pair of coordinates.
- al_transform_coordinates_3d
- Transforms x, y, z coordinates.
- al_use_projection_transform
- Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation).
|
procedure al_compose_transform (var trans, other: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Composes (combine) two transformations by a matrix multiplication.
trans := trans other
Note that the order of matrix multiplications is important. The effect of applying the combined transform will be as if first applying trans and then applying other and not the other way around.
Parameters
- trans
- ransformation to alter.
- other
- ransformation used to transform trans.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_translate_transform
- Applies a translation to a transformation.
- al_rotate_transform
- Applies a rotation to a transformation.
- al_scale_transform
- Applies a scale to a transformation.
|
function al_get_current_transform: ALLEGRO_TRANSFORMptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns the transformation of the current target bitmap, as set by al_use_transform. If there is no target bitmap, this function returns Nil .
Returns
A pointer to the current transformation. See also
- al_get_current_projection_transform
- (void) Returns a pointer to the current projection transformation.
|
function al_get_current_inverse_transform: ALLEGRO_TRANSFORMptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns the inverse of the current transformation of the target bitmap. If there is no target bitmap, this function returns Nil .
This is similar to calling al_invert_transform (al_get_current_transformˆ) but the result of this function is cached.
Note
Allegro's transformation inversion functions work correctly only with 2D transformations.
|
function al_get_current_projection_transform: ALLEGRO_TRANSFORMptr; CDECL; external ALLEGRO_LIB_NAME; |
(void) Returns a pointer to the current projection transformation. If there is no target bitmap, this function returns Nil .
See also
- al_use_projection_transform
- Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation).
|
procedure al_invert_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Inverts the passed transformation. If the transformation is nearly singular (close to not having an inverse) then the returned transformation may be invalid. Use al_check_inverse to ascertain if the transformation has an inverse before inverting it if you are in doubt.
Note
Allegro's transformation inversion functions work correctly only with 2D transformations.
Parameters
- trans
- Transformation to invert.
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
- al_check_inverse
- Checks if the transformation has an inverse using the supplied tolerance.
- al_transpose_transform
- Transposes the matrix of the given transform.
|
procedure al_transpose_transform (var trans: ALLEGRO_TRANSFORM); CDECL; external ALLEGRO_LIB_NAME; |
Transposes the matrix of the given transform. This can be used for inversing a rotation transform. For example:
al_build_camera_transform (camera, 0, 0, 0, x, y, z, xu, yu, zu)
al_copy_transform (inverse, camera)
al_transpose_transform (camera)
See also
- al_identity_transform
- Sets the transformation to be the identity transformation.
|
function al_check_inverse (var trans: ALLEGRO_TRANSFORM; tol: AL_FLOAT): AL_BOOL; inline; |
Checks if the transformation has an inverse using the supplied tolerance. Tolerance should be a small value between 0 and 1, with 1e-7 being sufficient for most applications.
In this function tolerance specifies how close the determinant can be to 0 (if the determinant is 0, the transformation has no inverse). Thus the smaller the tolerance you specify, the "worse" transformations will pass this test. Using a tolerance of 1e-7 will catch errors greater than 1/1000's of a pixel, but let smaller errors pass. That means that if you transformed a point by a transformation and then transformed it again by the inverse transformation that passed this check, the resultant point should less than 1/1000's of a pixel away from the original point.
Note that this check is superfluous most of the time if you never touched the transformation matrix values yourself. The only thing that would cause the transformation to not have an inverse is if you applied a 0 (or very small) scale to the transformation or you have a really large translation. As long as the scale is comfortably above 0, the transformation will be invertible.
Note
Allegro's transformation inversion functions work correctly only with 2D transformations.
Parameters
- trans
- Transformation to check.
- tol
- Tolerance.
Returns
True if the transformation is invertible, False otherwise.
See also
- al_invert_transform
- Inverts the passed transformation.
|
procedure al_orthographic_transform (var trans: ALLEGRO_TRANSFORM; left, top, n, right, bottom, f: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Combines the given transformation with an orthographic transformation which maps the screen rectangle to the given left/top and right/bottom coordinates.
near/far is the z range, coordinates outside of that range will get clipped. Normally -1/1 is fine because all 2D graphics will have a z coordinate of 0. However if you for example do al_draw_rectangle (0, 0, 100, 100) and rotate around the x axis ("towards the screen") make sure your z range allows values from -100 to 100 or the rotated rectangle will get clipped.
Also, if you are using a depth buffer the z range decides the depth resolution. For example if you have a 16 bit depth buffer there are only 65536 discrete depth values. So if your near/far is set to -1000000/1000000 most of the z positions would not result in separate depth values which could lead to artifacts.
See also
- al_use_projection_transform
- Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation).
- al_perspective_transform
- Like al_orthographic_transform but honors perspective.
|
procedure al_perspective_transform (var trans: ALLEGRO_TRANSFORM; left, top, n, right, bottom, f: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Like al_orthographic_transform but honors perspective. If everything is at a z-position of -near it will look the same as with an orthographic transformation.
To use a specific horizontal field of view you can use the relation:
!
tan(hfov / 2) = (right - left) / 2 / near
!
See also
- al_use_projection_transform
- Sets the projection transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own projection transformation).
- al_orthographic_transform
- Combines the given transformation with an orthographic transformation which maps the screen rectangle to the given left/top and right/bottom coordinates.
|
procedure al_horizontal_shear_transform (var trans: ALLEGRO_TRANSFORM; theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
(ALLEGRO_TRANSFORM* trans, float theta) Applies a horizontal shear to the transform
Parameters
- trans
- Transformation to alter.
- theta
- Rotation angle in radians.
See also
- al_vertical_shear_transform
- Applies a vertical shear to the transform
|
procedure al_vertical_shear_transform (var trans: ALLEGRO_TRANSFORM; theta: AL_FLOAT); CDECL; external ALLEGRO_LIB_NAME; |
Applies a vertical shear to the transform
Parameters
- trans
- Transformation to alter.
- theta
- Rotation angle in radians.
See also
- al_horizontal_shear_transform
- (ALLEGRO_TRANSFORM* trans, float theta) Applies a horizontal shear to the transform
|
function al_create_shader (platform: ALLEGRO_SHADER_PLATFORM): ALLEGRO_SHADERptr; CDECL; external ALLEGRO_LIB_NAME; |
Creates a shader object.
The platform argument is one of the ALLEGRO_SHADER_PLATFORM values, and specifies the type of shader object to create, and which language is used to program the shader.
The shader platform must be compatible with the type of display that you will use the shader with. For example, you cannot create and use a HLSL shader on an OpenGL display, nor a GLSL shader on a Direct3D display.
The ALLEGRO_SHADER_AUTO value automatically chooses the appropriate platform for the display currently targeted by the calling thread; there must be such a display. It will create a GLSL shader for an OpenGL display, and a HLSL shader for a Direct3D display.
Returns
A pointer to the shader object on success. Otherwise, returns Nil . See also
- al_attach_shader_source
- Attaches the shader's source code to the shader object and compiles it.
- al_attach_shader_source_file
- Like al_attach_shader_source but reads the source code for the shader from the named file.
- al_build_shader
- This is required before the shader can be used with al_use_shader.
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
- al_destroy_shader
- Destroy a shader.
- al_get_shader_platform
- Returns the platform the shader was created with (either
ALLEGRO_SHADER_HLSL or ALLEGRO_SHADER_GLSL ).
|
function al_attach_shader_source (shader: ALLEGRO_SHADERptr; aType: ALLEGRO_SHADER_TYPE; const Source: AL_STR): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Attaches the shader's source code to the shader object and compiles it. Passing Nil deletes the underlying (OpenGL or DirectX) shader. See also al_attach_shader_source_file if you prefer to obtain your shader source from an external file.
If you do not use ALLEGRO_PROGRAMMABLE_PIPELINE Allegro's graphics functions will not use any shader specific functions themselves. In case of a system with no fixed function pipeline (like OpenGL ES 2 or OpenGL 3 or 4) this means Allegro's drawing functions cannot be used.
TODO: Is ALLEGRO_PROGRAMMABLE_PIPELINE set automatically in this case?
When ALLEGRO_PROGRAMMABLE_PIPELINE is used the following shader uniforms are provided by Allegro and can be accessed in your shaders:
- al_projview_matrix
matrix for Allegro's orthographic projection multiplied by the al_use_transform matrix. The type is mat4 in GLSL, and float4x4 in HLSL.
- al_use_tex
whether or not to use the bound texture. The type is bool in both GLSL and HLSL.
- al_tex
the texture if one is bound. The type is sampler2D in GLSL and texture in HLSL.
- al_use_tex_matrix
whether or not to use a texture matrix (used by the primitives addon). The type is bool in both GLSL and HLSL.
- al_tex_matrix
the texture matrix (used by the primitives addon). Your shader should multiply the texture coordinates by this matrix. The type is mat4 in GLSL, and float4x4 in HLSL.
For GLSL shaders the vertex attributes are passed using the following variables:
- al_pos
vertex position attribute. Type is vec4 .
- al_texcoord
vertex texture coordinate attribute. Type is vec2 .
- al_color
vertex color attribute. Type is vec4 .
For HLSL shaders the vertex attributes are passed using the following semantics:
- POSITION0
vertex position attribute. Type is float4 .
- TEXCOORD0
vertex texture coordinate attribute. Type is float2 .
- TEXCOORD1
vertex color attribute. Type is float4 .
Also, each shader variable has a corresponding macro name that can be used when defining the shaders using string literals. Don't use these macros with the other shader functions as that will lead to undefined behavior.
ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX for "al_projview_matrix"
ALLEGRO_SHADER_VAR_POS for "al_pos"
ALLEGRO_SHADER_VAR_COLOR for "al_color"
ALLEGRO_SHADER_VAR_TEXCOORD for "al_texcoord"
ALLEGRO_SHADER_VAR_USE_TEX for "al_use_tex"
ALLEGRO_SHADER_VAR_TEX for "al_tex"
ALLEGRO_SHADER_VAR_USE_TEX_MATRIX for "al_use_tex_matrix"
ALLEGRO_SHADER_VAR_TEX_MATRIX for "al_tex_matrix"
Examine the output of al_get_default_shader_source for an example of how to use the above uniforms and attributes.
Returns
True on success and False on error, in which case the error log is updated. The error log can be retrieved with al_get_shader_log.
See also
- al_attach_shader_source_file
- Like al_attach_shader_source but reads the source code for the shader from the named file.
- al_build_shader
- This is required before the shader can be used with al_use_shader.
- al_get_default_shader_source
- Returns a string containing the source code to Allegro's default vertex or pixel shader appropriate for the passed platform.
- al_get_shader_log
- Returns a read-only string containing the information log for a shader program.
|
function al_build_shader (shader: ALLEGRO_SHADERptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
This is required before the shader can be used with al_use_shader. It should be called after successfully attaching the pixel and/or vertex shaders with al_attach_shader_source or al_attach_shader_source_file.
Note
If you are using the ALLEGRO_PROGRAMMABLE_PIPELINE flag, then you must specify both a pixel and a vertex shader sources for anything to be rendered.
Returns
True on success and False on error, in which case the error log is updated. The error log can be retrieved with al_get_shader_log.
See also
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
- al_get_shader_log
- Returns a read-only string containing the information log for a shader program.
|
procedure al_destroy_shader (shader: ALLEGRO_SHADERptr); CDECL; external ALLEGRO_LIB_NAME; |
Destroy a shader. Any bitmaps which currently use the shader will implicitly stop using the shader. In multi-threaded programs, be careful that no such bitmaps are being accessed by other threads at the time.
As a convenience, if the target bitmap of the calling thread is using the shader then the shader is implicitly unused before being destroyed.
This function does nothing if the shader argument is Nil .
See also
- al_create_shader
- Creates a shader object.
|
function al_set_shader_sampler (const name: AL_STR; bitmap: ALLEGRO_BITMAPptr; aUnit: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets a texture sampler uniform and texture unit of the current target bitmap's shader. The given bitmap must be a video bitmap.
Different samplers should use different units. The bitmap passed to Allegro's drawing functions uses the 0th unit, so if you're planning on using the al_tex variable in your pixel shader as well as another sampler, set the other sampler to use a unit different from 0. With the primitives addon, it is possible to free up the 0th unit by passing Nil as the texture argument to the relevant drawing functions. In this case, you may set a sampler to use the 0th unit and thus not use al_tex (the al_use_tex variable will be set to false ).
Returns
True on success. Otherwise returns False , e.g. if the uniform by that name does not exist in the shader.
See also
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
|
function al_set_shader_matrix (const name: AL_STR; var matrix: ALLEGRO_TRANSFORM): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets a matrix uniform of the current target bitmap's shader.
Returns
True on success. Otherwise returns False , e.g. if the uniform by that name does not exist in the shader.
See also
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
|
function al_set_shader_int (const name: AL_STR; i: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets an integer uniform of the current target bitmap's shader.
Returns
True on success. Otherwise returns False , e.g. if the uniform by that name does not exist in the shader.
See also
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
|
function al_set_shader_float (const name: AL_STR; f: AL_FLOAT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets a float uniform of the current target bitmap's shader.
Returns
True on success. Otherwise returns False , e.g. if the uniform by that name does not exist in the shader.
See also
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
|
function al_set_shader_int_vector (const name: AL_STR; num_components: AL_INT; i: AL_INTptr; num_elems: AL_INT): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets an integer vector array uniform of the current target bitmap's shader. The num_components parameter can take one of the values 1, 2, 3 or 4. If it is 1 then an array of num_elems integer elements is added. Otherwise each added array element is assumed to be a vector with 2, 3 or 4 components in it.
For example, if you have a GLSL uniform declared as uniform ivec3 flowers[4] or an HLSL uniform declared as uniform int3 flowers[4] , then you'd use this function from your code like so:
VAR
Flowers: ARRAY [0..3] OF ARRAY [0..2] OF AL_INT =
(
(1, 2, 3),
(4, 5, 6),
(7, 8, 9),
(2, 5, 7)
);
BEGIN
...
al_set_shader_int_vector ('flowers', 3, @(Flowers[0][0]), 4);
...
END;
Returns
True on success. Otherwise returns False , e.g. if the uniform by that name does not exist in the shader.
See also
- al_set_shader_float_vector
- Same as al_set_shader_int_vector except all values are float instead of integer.
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
|
function al_set_shader_bool (const name: AL_STR; b: AL_BOOL): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Sets a boolean uniform of the current target bitmap's shader.
Returns
True on success. Otherwise returns False , e.g. if the uniform by that name does not exist in the shader.
See also
- al_use_shader
- Uses the shader for subsequent drawing operations on the current target bitmap.
|
function al_get_default_shader_source (platform: ALLEGRO_SHADER_PLATFORM; aType: ALLEGRO_SHADER_TYPE): AL_STRptr; CDECL; external ALLEGRO_LIB_NAME; |
Returns a string containing the source code to Allegro's default vertex or pixel shader appropriate for the passed platform. The ALLEGRO_SHADER_AUTO value means GLSL is used if OpenGL is being used otherwise HLSL. ALLEGRO_SHADER_AUTO requires that there is a current display set on the calling thread. This function can return Nil if Allegro was built without support for shaders of the selected platform.
See also
- al_attach_shader_source
- Attaches the shader's source code to the shader object and compiles it.
|
function al_init: AL_BOOL; inline; |
Like al_install_system, but automatically passes in the version and Nil as atexit_ptr :
Note
It is typically wrong to call al_init anywhere except the final game binary. In particular, do not call it inside a shared library unless you know what you're doing. In those cases, it is better to call al_install_system either with a Nil atexit_ptr , or with a pointer to atexit provided by the user of this shared library.
See also
- al_uninstall_system
- Closes down the Allegro system.
- al_get_system_id
- Returns the platform that Allegro is running on.
|
function al_install_system (version: AL_INT; atexit_ptr: AL_POINTER): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Initializes the Allegro system. No other Allegro functions can be called before this (with one or two exceptions).
Parameters
- version
- Should always be set to ALLEGRO_VERSION_INT.
- atexit_ptr
- If non-
Nil , and if hasn't been done already, al_uninstall_system will be registered as an atexit function. atexit is a function provided by standard C runtime library. It allows similar functionality than FINALIZATION section in Pascal.
Returns
True if Allegro was successfully initialized by this function call (or already was initialized previously), False if Allegro cannot be used.
See also
- al_init
- Like al_install_system, but automatically passes in the version and
Nil as atexit_ptr :
Note
It is typically wrong to call al_init anywhere except the final game binary.
- al_uninstall_system
- Closes down the Allegro system.
- al_get_system_id
- Returns the platform that Allegro is running on.
|
procedure al_uninstall_system; CDECL; external ALLEGRO_LIB_NAME; |
Closes down the Allegro system.
In most cases you don't need to call this, because it's called by allegro5.pas FINALIZATION section.
See also
- al_init
- Like al_install_system, but automatically passes in the version and
Nil as atexit_ptr :
Note
It is typically wrong to call al_init anywhere except the final game binary.
- al_install_system
- Initializes the Allegro system.
|
function al_is_system_installed: AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if Allegro is initialized, otherwise returns False .
|
function al_get_system_config: ALLEGRO_CONFIGptr; CDECL; external ALLEGRO_LIB_NAME; |
(void) Returns the system configuration structure. The returned configuration should not be destroyed with al_destroy_config. This is mainly used for configuring Allegro and its addons. You may populate this configuration before Allegro is installed to control things like the logging levels and other features.
Allegro will try to populate this configuration by loading a configuration file from a few different locations, in this order:
Unix only: /etc/allegro5rc
Unix only: $HOME/allegro5rc
Unix only: $HOME/.allegro5rc
allegro5.cfg next to the executable
If multiple copies are found, then they are merged using al_merge_config_into.
The contents of this file are documented inside a prototypical allegro5.cfg that you can find in the resources directory of the distributions of Allegro.pas.
Note that Allegro will not look into that file unless you make a copy of it and place it next to your executable!
|
function al_get_system_id: ALLEGRO_SYSTEM_ID; CDECL; external ALLEGRO_LIB_NAME; |
Returns the platform that Allegro is running on.
See also
- ALLEGRO_SYSTEM_ID
- The system Allegro is running on.
|
function al_inhibit_screensaver (inhibit: AL_BOOL): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
This function allows the user to stop the system screensaver from starting up if True is passed, or resets the system back to the default state (the state at program start) if False is passed.
Returns
True if the state was set successfully, otherwise False .
|
function ALLEGRO_USECS_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
Converts microseconds to seconds.
|
function ALLEGRO_MSECS_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
Converts milliseconds to seconds.
|
function ALLEGRO_BPS_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
Converts beats per second to seconds.
|
function ALLEGRO_BPM_TO_SECS (x: AL_INT): AL_DOUBLE; inline; |
Converts beats per minute to seconds.
|
function al_create_timer (speed_secs: AL_DOUBLE): ALLEGRO_TIMERptr; CDECL; external ALLEGRO_LIB_NAME; |
Allocates and initializes a timer. The new timer is initially stopped.
Usage note: typical granularity is on the order of microseconds, but with some drivers might only be milliseconds.
Parameters
- speed_secs
- Seconds per "tick". Must be positive.
Returns
If successful, a pointer to a new timer object, otherwise Nil . See also
- al_start_timer
- Starts the timer specified.
- al_destroy_timer
- Uninstalls the timer specified.
|
procedure al_destroy_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
Uninstalls the timer specified. If the timer is started, it will automatically be stopped before uninstallation. It will also automatically unregister the timer with any event queues.
Does nothing if passed the Nil pointer.
See also
- al_create_timer
- Allocates and initializes a timer.
|
procedure al_start_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
Starts the timer specified. From then, the timer's counter will increment at a constant rate, and it will begin generating events. Starting a timer that is already started does nothing. Starting a timer that was stopped will reset the timer's counter, effectively restarting the timer from the beginning.
See also
- al_stop_timer
- Stops the timer specified.
- al_get_timer_started
- Returns
True if the timer specified is currently started.
- al_resume_timer
- Resumes the timer specified.
|
procedure al_stop_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
Stops the timer specified. The timer's counter will stop incrementing and it will stop generating events. Stopping a timer that is already stopped does nothing.
See also
- al_start_timer
- Starts the timer specified.
- al_get_timer_started
- Returns
True if the timer specified is currently started.
- al_resume_timer
- Resumes the timer specified.
|
procedure al_resume_timer (timer: ALLEGRO_TIMERptr); CDECL; external ALLEGRO_LIB_NAME; |
Resumes the timer specified. From then, the timer's counter will increment at a constant rate, and it will begin generating events. Resuming a timer that is already started does nothing. Resuming a stopped timer will not reset the timer's counter (unlike al_start_timer).
See also
- al_start_timer
- Starts the timer specified.
- al_stop_timer
- Stops the timer specified.
- al_get_timer_started
- Returns
True if the timer specified is currently started.
|
function al_get_timer_started (const timer: ALLEGRO_TIMERptr): AL_BOOL; CDECL; external ALLEGRO_LIB_NAME; |
Returns True if the timer specified is currently started.
|
procedure al_set_timer_speed (timer: ALLEGRO_TIMERptr; speed_secs: AL_DOUBLE); CDECL; external ALLEGRO_LIB_NAME; |
Sets the timer's speed, i.e. the rate at which its counter will be incremented when it is started. This can be done when the timer is started or stopped. If the timer is currently running, it is made to look as though the speed change occurred precisely at the last tick.
Parameters
- speed_secs
- Exactly the same meaning as with al_create_timer.
See also
- al_get_timer_speed
- Returns the timer's speed, in seconds.
|
function al_get_timer_count (const timer: ALLEGRO_TIMERptr): AL_INT64; CDECL; external ALLEGRO_LIB_NAME; |
Returns the timer's counter value. The timer can be started or stopped.
See also
- al_set_timer_count
- Sets the timer's counter value.
|
procedure al_set_timer_count (timer: ALLEGRO_TIMERptr; count: AL_INT64); CDECL; external ALLEGRO_LIB_NAME; |
Sets the timer's counter value. The timer can be started or stopped. The count value may be positive or negative, but will always be incremented by +1 at each tick.
See also
- al_get_timer_count
- Returns the timer's counter value.
- al_add_timer_count
- Add
diff to the timer's counter value.
|
procedure al_add_timer_count (timer: ALLEGRO_TIMERptr; diff: AL_INT64); CDECL; external ALLEGRO_LIB_NAME; |
Add diff to the timer's counter value. This is similar to writing:
al_set_timer_count (Timer, al_get_timer_count (Timer) + diff);
except that the addition is performed atomically, so no ticks will be lost.
See also
- al_set_timer_count
- Sets the timer's counter value.
|
procedure al_store_state (out state: ALLEGRO_STATE; flags: AL_INT); CDECL; external ALLEGRO_LIB_NAME; |
Stores part of the state of the current thread in the given ALLEGRO_STATE object. The flags parameter can take any bit-combination of these flags:
ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS - new_display_format, new_display_refresh_rate, new_display_flags
ALLEGRO_STATE_NEW_BITMAP_PARAMETERS - new_bitmap_format, new_bitmap_flags
ALLEGRO_STATE_DISPLAY - current_display
ALLEGRO_STATE_TARGET_BITMAP - target_bitmap
ALLEGRO_STATE_BLENDER - blender
ALLEGRO_STATE_TRANSFORM - current_transformation
ALLEGRO_STATE_PROJECTION_TRANSFORM - current_projection_transformation
ALLEGRO_STATE_NEW_FILE_INTERFACE - new_file_interface
ALLEGRO_STATE_BITMAP - same as ALLEGRO_STATE_NEW_BITMAP_PARAMETERS and ALLEGRO_STATE_TARGET_BITMAP
ALLEGRO_STATE_ALL - all of the above
See also
- al_restore_state
- Restores part of the state of the current thread from the given ALLEGRO_STATE object.
|
procedure al_restore_state (var state: ALLEGRO_STATE); CDECL; external ALLEGRO_LIB_NAME; |
Restores part of the state of the current thread from the given ALLEGRO_STATE object.
See also
- al_store_state
- Stores part of the state of the current thread in the given ALLEGRO_STATE object.
|
procedure _al_set_memory_interface_ (iface: AL_POINTER); CDECL; external ALLEGRO_LIB_NAME name 'al_set_memory_interface'; |
|
procedure _al_join_thread (outer: ALLEGRO_THREADptr; ret_value: AL_POINTER); CDECL; external ALLEGRO_LIB_NAME name 'al_join_thread'; |
|
Types
ALLEGRO_PIXEL_FORMAT = (...); |
Pixel formats. Each pixel format specifies the exact size and bit layout of a pixel in memory. Components are specified from high bits to low bits, so for example a fully opaque red pixel in ARGB_8888 format is $FFFF0000 .
Note
The pixel format is independent of endianness. That is, in the above example you can always get the red component with (pixel AND $00ff0000) SHR 16 . But you can not rely on this code: (pixel + 2)ˆ it will return the red component on little endian systems, but the green component on big endian systems.
Also note that Allegro's naming is different from OpenGL naming here, where a format of GL_RGBA8 merely defines the component order and the exact layout including endianness treatment is specified separately. Usually GL_RGBA8 will correspond to ALLEGRO_PIXEL_ABGR_8888 though on little endian systems, so care must be taken (note the reversal of RGBA <-> ABGR).
The only exception to this ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE which will always have the components as 4 bytes corresponding to red, green, blue and alpha, in this order, independent of the endianness.
Some of the pixel formats represent compressed bitmap formats. Compressed bitmaps take up less space in the GPU memory than bitmaps with regular (uncompressed) pixel formats. This smaller footprint means that you can load more resources into GPU memory, and they will be drawn somewhat faster. The compression is lossy, however, so it is not appropriate for all graphical styles: it tends to work best for images with smooth color gradations. It is possible to compress bitmaps at runtime by passing the appropriate bitmap format in al_set_new_bitmap_format and then creating, loading, cloning or converting a non-compressed bitmap. This, however, is not recommended as the compression quality differs between different GPU drivers. It is recommended to compress these bitmaps ahead of time using external tools and then load them compressed.
Unlike regular pixel formats, compressed pixel formats are not laid out in memory one pixel row at a time. Instead, the bitmap is subdivided into rectangular blocks of pixels that are then laid out in block rows. This means that regular locking functions cannot use compressed pixel formats as the destination format. Instead, you can use the blocked versions of the bitmap locking functions which do support these formats.
It is not recommended to use compressed bitmaps as target bitmaps, as that operation cannot be hardware accelerated. Due to proprietary algorithms used, it is typically impossible to create compressed memory bitmaps.
See also
- al_set_new_bitmap_format
- Sets the pixel format for newly created bitmaps.
- al_get_bitmap_format
- Returns the pixel format of a bitmap.
Values
-
ALLEGRO_PIXEL_FORMAT_ANY = 0: Let the driver choose a format. This is the default format at program start.
-
ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA = 1: Let the driver choose a format without alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA = 2: Let the driver choose a format with alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA = 3: Let the driver choose a 15 bit format without alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA = 4: Let the driver choose a 16 bit format without alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA = 5: Let the driver choose a 16 bit format with alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA = 6: Let the driver choose a 24 bit format without alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA = 7: Let the driver choose a 32 bit format without alpha.
-
ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA = 8: Let the driver choose a 32 bit format with alpha.
-
ALLEGRO_PIXEL_FORMAT_ARGB_8888 = 9: 32 bit
-
ALLEGRO_PIXEL_FORMAT_RGBA_8888 = 10: 32 bit
-
ALLEGRO_PIXEL_FORMAT_ARGB_4444 = 11: 24 bit
-
ALLEGRO_PIXEL_FORMAT_RGB_888 = 12: 24 bit
-
ALLEGRO_PIXEL_FORMAT_RGB_565 = 13: 16 bit
-
ALLEGRO_PIXEL_FORMAT_RGB_555 = 14: 15 bit
-
ALLEGRO_PIXEL_FORMAT_RGBA_5551 = 15: 16 bit
-
ALLEGRO_PIXEL_FORMAT_ARGB_1555 = 16: 16 bit
-
ALLEGRO_PIXEL_FORMAT_ABGR_8888 = 17: 32 bit
-
ALLEGRO_PIXEL_FORMAT_XBGR_8888 = 18: 32 bit
-
ALLEGRO_PIXEL_FORMAT_BGR_888 = 19: 24 bit
-
ALLEGRO_PIXEL_FORMAT_BGR_565 = 20: 16 bit
-
ALLEGRO_PIXEL_FORMAT_BGR_555 = 21: 15 bit
-
ALLEGRO_PIXEL_FORMAT_RGBX_8888 = 22: 32 bit
-
ALLEGRO_PIXEL_FORMAT_XRGB_8888 = 23: 32 bit
-
ALLEGRO_PIXEL_FORMAT_ABGR_F32 = 24: 128 bit
-
ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE = 25: Like the version without _LE, but the component order is guaranteed to be red, green, blue, alpha. This only makes a difference on big endian systems, on little endian it is just an alias.
-
ALLEGRO_PIXEL_FORMAT_RGBA_4444 = 26: 16bit
-
ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 = 27: A single 8-bit channel. A pixel value maps onto the red channel when displayed, but it is undefined how it maps onto green, blue and alpha channels. When drawing to bitmaps of this format, only the red channel is taken into account. Allegro may have to use fallback methods to render to bitmaps of this format. This pixel format is mainly intended for storing the color indices of an indexed (paletted) image, usually in conjunction with a pixel shader that maps indices to RGBA values.
-
ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 = 28: Compressed using the DXT1 compression algorithm. Each 4x4 pixel block is encoded in 64 bytes, resulting in 6-8x compression ratio. Only a single bit of alpha per pixel is supported.
-
ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 = 29: Compressed using the DXT3 compression algorithm. Each 4x4 pixel block is encoded in 128 bytes, resulting in 4x compression ratio. This format supports sharp alpha transitions.
-
ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 = 30: Compressed using the DXT5 compression algorithm. Each 4x4 pixel block is encoded in 128 bytes, resulting in 4x compression ratio. This format supports smooth alpha transitions.
-
ALLEGRO_NUM_PIXEL_FORMATS
|
ALLEGRO_BITMAPptr = type AL_POINTER; |
Abstract type representing a bitmap (2D image).
|
ALLEGRO_FILEptr = type AL_POINTER; |
An opaque object representing an open file. This could be a real file on disk or a virtual file.
|
ALLEGRO_LOCK = (...); |
Locking flags.
Values
-
ALLEGRO_LOCK_READWRITE = 0
-
ALLEGRO_LOCK_READONLY = 1
-
ALLEGRO_LOCK_WRITEONLY = 2
|
ALLEGRO_EVENT_TYPE = AL_UINT; |
An integer used to distinguish between different types of events.
See also
- ALLEGRO_EVENT
- An
ALLEGRO_EVENT is an union of all builtin event structures, i.e.
- ALLEGRO_GET_EVENT_TYPE
- Makes an event type identifier, which is a 32-bit integer.
- ALLEGRO_EVENT_TYPE_IS_USER
- Returns
True if the event type is not a builtin event type, i.e.
|
ALLEGRO_DISPLAYptr = type AL_POINTER; |
Pointer to a display.
An opaque type representing an open display or window.
|
ALLEGRO_JOYSTICKptr = type AL_POINTER; |
A pointer to an abstract data representing a physical joystick.
See also
- al_get_joystick
- Gets a handle for a joystick on the system.
|
ALLEGRO_KEYBOARDptr = type AL_POINTER; |
Pointer to keyboard.
|
ALLEGRO_MOUSEptr = type AL_POINTER; |
Pointer to mouse.
|
ALLEGRO_TIMERptr = type AL_POINTER; |
Pointer to timer. This is an abstract data type representing a timer object.
See also
- al_create_timer
- Allocates and initializes a timer.
|
ALLEGRO_USER_EVENT_DESCRIPTORptr = type AL_POINTER; |
Pointer to the user event descriptor.
See also
- ALLEGRO_USER_EVENT
- An event structure that can be emitted by user event sources.
|
ALLEGRO_EVENT_QUEUEptr = type AL_POINTER; |
An event queue holds events that have been generated by event sources that are registered with the queue. Events are stored in the order they are generated. Access is in a strictly FIFO (first-in-first-out) order.
See also
- al_create_event_queue
- Creates a new, empty event queue.
- al_destroy_event_queue
- Destroys the event queue specified.
|
ALLEGRO_CONFIGptr = type AL_POINTER; |
An abstract configuration structure.
See also
- al_create_config
- Creates an empty configuration structure.
|
AL_FIXED = type AL_INT32; |
A fixed point number.
Allegro provides some routines for working with fixed point numbers, and defines the type AL_FIXED to be a signed 32-bit integer. The high word is used for the integer part and the low word for the fraction, giving a range of -32768 to 32767 and an accuracy of about four or five decimal places. Fixed point numbers can be assigned, compared, added, subtracted, negated and shifted (for multiplying or dividing by powers of two) using the normal integer operators, but you should take care to use the appropriate conversion routines when mixing fixed point with integer or floating point values. Writing fixed_point_1 + fixed_point_2 is OK, but fixed_point + integer is not.
The only advantage of fixed point math routines is that you don't require a floating point coprocessor to use them. This was great in the time period of i386 and i486 machines, but stopped being so useful with the coming of the Pentium class of processors. From Pentium onwards, CPUs have increased their strength in floating point operations, equaling or even surpassing integer math performance.
Depending on the type of operations your program may need, using floating point types may be faster than fixed types if you are targeting a specific machine class. Many embedded processors have no FPUs so fixed point maths can be useful there.
See also
- al_itofix
- Converts an integer to fixed point.
- al_fixtoi
- Converts fixed point to integer, rounding as required to the nearest integer.
- al_fixtrunc
- Returns the integer part of x, which is alwais smaller than (or equal to) X in absolute value.
- al_ftofix
- Converts a floating point value to fixed point.
- al_fixtof
- Converts fixed point to floating point.
- al_fixadd
- Safe function to add fixed point numbers clamping overflow.
- al_fixsub
- Safe function to subtract fixed point numbers clamping underflow.
- al_fixmul
- A fixed point value can be multiplied or divided by an integer with the normal * and / operators.
- al_fixdiv
- A fixed point value can be divided by an integer with the normal / operator.
- al_fixsqrt
- This finds out the non negative square root of `x'.
- al_fixcos
- This function finds the cosine of a value using a lookup table.
- al_fixsin
- This function finds the sine of a value using a lookup table.
- al_fixtan
- This function finds the tangent of a value using a lookup table.
|
ALLEGRO_JOYFLAGS = (...); |
Warning: this symbol is deprecated.
This is a holdover from the old API and may be removed.
See also
- al_get_joystick_stick_flags
- Returns the flags of the given "stick".
Values
-
ALLEGRO_JOYFLAG_DIGITAL = $01: The stick provides digital input.
-
ALLEGRO_JOYFLAG_ANALOGUE = $02: The stick provides analogue input.
|
ALLEGRO_MOUSE_CURSORptr = type AL_POINTER; |
Pointer to a custom mouse cursor
|
ALLEGRO_SYSTEM_MOUSE_CURSOR = (...); |
Used to identify the mouse cursor.
See also
- al_set_system_mouse_cursor
- Sets the given system mouse cursor to be the current mouse cursor for the given
display .
Values
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_CUSTOM = -1
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_NONE = 0
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT = 1
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW = 2
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY = 3
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION = 4
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT = 5
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE = 6
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N = 7
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W = 8
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S = 9
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E = 10
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW = 11
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW = 12
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE = 13
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE = 14
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS = 15
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION = 16
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK = 17
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT = 18
-
ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE = 19
-
ALLEGRO_NUM_SYSTEM_MOUSE_CURSORS
|
ALLEGRO_RENDER_STATE = (...); |
Possible render states which can be set with al_set_render_state.
Values
-
ALLEGRO_ALPHA_TEST = $0010: If this is set to 1, the values of
ALLEGRO_ALPHA_FUNCTION and ALLEGRO_ALPHA_TEST_VALUE define a comparison function which is performed for each pixel. Only if it evaluates to true the pixel is written. Otherwise no subsequent processing (like depth test or blending) is performed.
-
ALLEGRO_WRITE_MASK: This determines how the framebuffer and depthbuffer are updated whenever a pixel is written (in case alpha and/or depth testing is enabled: after all such enabled tests succeed). Depth values are only written if
ALLEGRO_DEPTH_TEST is 1, in addition to the write mask flag being set.
-
ALLEGRO_DEPTH_TEST: If this is set to 1, compare the depth value of any newly written pixels with the depth value already in the buffer, according to
ALLEGRO_DEPTH_FUNCTION . Allegro primitives with no explicit z coordinate will write a value of 0 into the depth buffer.
-
ALLEGRO_DEPTH_FUNCTION: One of the next values:
ALLEGRO_RENDER_NEVER ALLEGRO_RENDER_ALWAYS ALLEGRO_RENDER_LESS ALLEGRO_RENDER_EQUAL ALLEGRO_RENDER_LESS_EQUAL ALLEGRO_RENDER_GREATER ALLEGRO_RENDER_NOT_EQUAL ALLEGRO_RENDER_GREATER_EQUAL , only used when ALLEGRO_DEPTH_TEST is 1.
-
ALLEGRO_ALPHA_FUNCTION: One of the next values:
ALLEGRO_RENDER_NEVER ALLEGRO_RENDER_ALWAYS ALLEGRO_RENDER_LESS ALLEGRO_RENDER_EQUAL ALLEGRO_RENDER_LESS_EQUAL ALLEGRO_RENDER_GREATER ALLEGRO_RENDER_NOT_EQUAL ALLEGRO_RENDER_GREATER_EQUAL , only used when ALLEGRO_ALPHA_TEST is 1.
-
ALLEGRO_ALPHA_TEST_VALUE: Only used when
ALLEGRO_ALPHA_TEST is 1.
|
ALLEGRO_SHADERptr = type AL_POINTER; |
Pointer to an ALLEGRO_SHADER .
An ALLEGRO_SHADER is a program that runs on the GPU. It combines both a vertex and a pixel shader. (In OpenGL terms, an ALLEGRO_SHADER is actually a program which has one or more shaders attached. This can be confusing.)
The source code for the underlying vertex or pixel shader can be provided either as GLSL or HLSL, depending on the value of ALLEGRO_SHADER_PLATFORM used when creating it.
See also
- al_create_shader
- Creates a shader object.
|
ALLEGRO_SHADER_TYPE = (...); |
Used with al_attach_shader_source and al_attach_shader_source_file to specify how to interpret the attached source.
Values
-
ALLEGRO_VERTEX_SHADER = 1: A vertex shader is executed for each vertex it is used with. The program will output exactly one vertex at a time.
When Allegro's graphics are being used then in addition to all vertices of primitives from the primitives addon, each drawn bitmap also consists of four vertices.
-
ALLEGRO_PIXEL_SHADER = 2: A pixel shader is executed for each pixel it is used with. The program will output exactly one pixel at a time - either in the backbuffer or in the current target bitmap.
With Allegro's builtin graphics this means the shader is for example called for each destination pixel of the output of an al_draw_bitmap call.
A more accurate term for pixel shader would be fragment shader since one final pixel in the target bitmap is not necessarily composed of only a single output but of multiple fragments (for example when multi-sampling is being used).
|
ALLEGRO_SHADER_PLATFORM = (...); |
The underlying platform which the ALLEGRO_SHADERptr is built on top of, which dictates the language used to program the shader.
Values
-
ALLEGRO_SHADER_AUTO = 0
-
ALLEGRO_SHADER_GLSL = 1: OpenGL Shading Language.
-
ALLEGRO_SHADER_HLSL = 2: High Level Shader Language (for Direct3D).
-
ALLEGRO_SHADER_AUTO_MINIMAL = 3: Like
ALLEGRO_SHADER_AUTO , but pick a more minimalimplementation that supports only basic alpha blending..
-
ALLEGRO_SHADER_GLSL_MINIMAL = 4: Minimal GLSL shader.
-
ALLEGRO_SHADER_HLSL_MINIMAL = 5: Minimal HLSL shader.
-
ALLEGRO_SHADER_HLSL_SM_3_0 = 6: HLSL shader using shader model 3.0.
|
ALLEGRO_SYSTEM_ID = (...); |
The system Allegro is running on.
- ALLEGRO_SYSTEM_ID_UNKNOWN
Unknown system.
- ALLEGRO_SYSTEM_ID_XGLX
Xglx
- ALLEGRO_SYSTEM_ID_WINDOWS
Windows
- ALLEGRO_SYSTEM_ID_MACOSX
macOS
- ALLEGRO_SYSTEM_ID_ANDROID
Android
- ALLEGRO_SYSTEM_ID_IPHONE
iOS
- ALLEGRO_SYSTEM_ID_GP2XWIZ
GP2XWIZ
- ALLEGRO_SYSTEM_ID_RASPBERRYPI
Raspberry Pi
- ALLEGRO_SYSTEM_ID_SDL
SDL
See also
- al_get_system_id
- Returns the platform that Allegro is running on.
Values
-
ALLEGRO_SYSTEM_ID_UNKNOWN = 0
-
ALLEGRO_SYSTEM_ID_ANDROID = $414E4452
-
ALLEGRO_SYSTEM_ID_IPHONE = $4950484F
-
ALLEGRO_SYSTEM_ID_MACOSX = $4F535820
-
ALLEGRO_SYSTEM_ID_RASPERRYPI = $52415350
-
ALLEGRO_SYSTEM_ID_SDL = $53444C32
-
ALLEGRO_SYSTEM_ID_WINDOWS = $57494E44
-
ALLEGRO_SYSTEM_ID_GP32XWIZ = $57495A20
-
ALLEGRO_SYSTEM_ID_XGLX = $58474C58
|
Constants
ALLEGRO_RELEASE_NUMBER = 1; |
|
ALLEGRO_PAS_VERSION_STR = '5.2.0'; |
Allegro.pas version string. Note this is not the Allegro's version.
See also
- al_get_allegro_version
- Returns the compiled version of the Allegro library (i.e.
- ALLEGRO_VERSION_INT
- Packs Allegro's version number in a simple AL_INT number.
|
ALLEGRO_PI = 3.14159265358979323846; |
Just to be sure that PI number is available.
|
ALLEGRO_TAU = ALLEGRO_PI * 2; |
The tau number.
This is the full circle, which is more convenient in most cases. For more information read The Tau manifesto.
|
AL_EOF = -1; |
End of file. Returned by some file functions.
|
ALLEGRO_SEEK_SET = 0; |
Seek relative to beginning of file.
|
ALLEGRO_SEEK_CUR = 1; |
Seek relative to current file position.
|
ALLEGRO_SEEK_END = 2; |
Seek relative to end of file.
|
ALLEGRO_EVENT_JOYSTICK_AXIS = 1; |
A joystick axis value changed.
joystick.id Pointer to the joystick which generated the event. This is not the same as the event source joystick.source .
joystick.stick The stick number, counting from zero. Axes on a joystick are grouped into "sticks".
joystick.axis The axis number on the stick, counting from zero.
joystick.pos The axis position, from -1.0 to +1.0.
|
ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN = 2; |
A joystick button was pressed.
joystick.id Pointer to the joystick which generated the event. This is not the same as the event source joystick.source .
joystick.button The button which was pressed, counting from zero.
|
ALLEGRO_EVENT_JOYSTICK_BUTTON_UP = 3; |
A joystick button was released.
joystick.id Pointer to the joystick which generated the event. This is not the same as the event source joystick.source .
joystick.button The button which was released, counting from zero.
|
ALLEGRO_EVENT_JOYSTICK_CONFIGURATION = 4; |
A joystick was plugged in or unplugged. See al_reconfigure_joysticks for details.
|
ALLEGRO_EVENT_KEY_DOWN = 10; |
A keyboard key was pressed.
keyboard.keycode The code corresponding to the physical key which was pressed. See the Key codes section for the list of ALLEGRO_KEY_* constants.
keyboard.display The display which had keyboard focus when the event occurred.
Note
this event is about the physical keys being pressed on the keyboard. Look for ALLEGRO_EVENT_KEY_CHAR events for character input.
|
ALLEGRO_EVENT_KEY_CHAR = 11; |
A character was typed on the keyboard, or a character was auto-repeated.
keyboard.keycode The code corresponding to the physical key which was last pressed. See the Key codes section for the list of ALLEGRO_KEY_* constants.
keyboard.unichar A Unicode code point (character). This may be zero or negative if the event was generated for a non-visible "character", such as an arrow or Function key. In that case you can act upon the keycode field.
Some special keys will set the unichar field to their standard ASCII values: Tab=9, Return=13, Escape=27. In addition if you press the Control key together with A to Z the unichar field will have the values 1 to 26. For example Ctrl-A will set unichar to 1 and Ctrl-H will set it to 8.
As of Allegro 5.0.2 there are some inconsistencies in the treatment of Backspace (8 or 127) and Delete (127 or 0) keys on different platforms. These can be worked around by checking the keycode field.
keyboard.modifiers This is a bitfield of the modifier keys which were pressed when the event occurred. See "Keyboard modifier flags" for the constants.
keyboard.frepeat Indicates if this is a repeated character.
keyboard.display The display which had keyboard focus when the event occurred.
Note
in many input methods, characters are not entered one-for-one with physical key presses. Multiple key presses can combine to generate a single character, e.g. apostrophe + e may produce 'é'. Fewer key presses can also generate more characters, e.g. macro sequences expanding to common phrases.
|
ALLEGRO_EVENT_KEY_UP = 12; |
A keyboard key was released.
keyboard.keycode The code corresponding to the physical key which was released. See the Key codes section for the list of ALLEGRO_KEY_* constants.
keyboard.display The display which had keyboard focus when the event occurred.
Seealso: Key codes
|
ALLEGRO_EVENT_MOUSE_AXES = 20; |
One or more mouse axis values changed.
mouse.x x-coordinate.
mouse.y y-coordinate.
mouse.z z-coordinate. This usually means the vertical axis of a mouse wheel, where up is positive and down is negative.
mouse.w w-coordinate. This usually means the horizontal axis of a mouse wheel.
mouse.dx Change in the x-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.
mouse.dy Change in the y-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.
mouse.dz Change in the z-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.
mouse.dw Change in the w-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.
mouse.pressure Pressure, ranging from 0.0 to 1.0.
mouse.display The display which had mouse focus.
Note
Calling al_set_mouse_xy also will result in a change of axis values, but such a change is reported with ALLEGRO_EVENT_MOUSE_WARPED events instead which are identical except for their type.
Note
currently mouse.display may be Nil if an event is generated in response to al_set_mouse_axis.
|
ALLEGRO_EVENT_MOUSE_BUTTON_DOWN = 21; |
A mouse button was pressed.
mouse.x x-coordinate.
mouse.y y-coordinate.
mouse.z z-coordinate.
mouse.w w-coordinate.
mouse.button The mouse button which was pressed, numbering from 1.
mouse.pressure Pressure, ranging from 0.0 to 1.0.
mouse.display The display which had mouse focus.
|
ALLEGRO_EVENT_MOUSE_BUTTON_UP = 22; |
A mouse button was released.
mouse.x x-coordinate.
mouse.y y-coordinate.
mouse.z z-coordinate.
mouse.w w-coordinate.
mouse.button The mouse button which was released, numbering from 1.
mouse.pressure Pressure, ranging from 0.0 to 1.0.
mouse.display The display which had mouse focus.
|
ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY = 23; |
The mouse cursor entered a window opened by the program.
|
ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY = 24; |
The mouse cursor left the boundaries of a window opened by the program.
|
ALLEGRO_EVENT_TIMER = 30; |
A timer counter incremented.
|
ALLEGRO_EVENT_DISPLAY_EXPOSE = 40; |
The display (or a portion thereof) has become visible.
display.source The display which was exposed.
display.x , display.y The top-left corner of the rectangle which was exposed.
display.width , display.height The width and height of the rectangle which was exposed.
Note
The display needs to be created with ALLEGRO_GENERATE_EXPOSE_EVENTS flag for these events to be generated.
|
ALLEGRO_EVENT_DISPLAY_RESIZE = 41; |
The window has been resized.
display.source The display which was resized.
display.x , display.y The position of the top-level corner of the display.
display.width The new width of the display.
display.height The new height of the display.
You should normally respond to these events by calling al_acknowledge_resize. Note that further resize events may be generated by the time you process the event, so these fields may hold outdated information.
|
ALLEGRO_EVENT_DISPLAY_CLOSE = 42; |
The close button of the window has been pressed.
|
ALLEGRO_EVENT_DISPLAY_LOST = 43; |
When using Direct3D, displays can enter a "lost" state. In that state, drawing calls are ignored, and upon entering the state, bitmap's pixel data can become undefined. Allegro does its best to preserve the correct contents of bitmaps (see the ALLEGRO_NO_PRESERVE_TEXTURE flag at al_set_new_bitmap_flags) and restore them when the device is "found" (see ALLEGRO_EVENT_DISPLAY_FOUND). However, this is not 100% fool proof (see discussion in al_create_bitmap's documentation).
Note
This event merely means that the display was lost, that is, DirectX suddenly lost the contents of all video bitmaps. In particular, you can keep calling drawing functions – they just most likely won't do anything. If Allegro's restoration of the bitmaps works well for you then no further action is required when you receive this event.
display.source
The display which was lost.
|
ALLEGRO_EVENT_DISPLAY_FOUND = 44; |
Generated when a lost device is restored to operating state.
See also
- ALLEGRO_EVENT_DISPLAY_LOST
- When using Direct3D, displays can enter a "lost" state.
|
ALLEGRO_EVENT_DISPLAY_SWITCH_IN = 45; |
The window is the active one again.
|
ALLEGRO_EVENT_DISPLAY_SWITCH_OUT = 46; |
The window is no longer active, that is the user might have clicked into another window or "tabbed" away. In response to this event you might want to call al_clear_keyboard_state (possibly passing display.source as its argument) in order to prevent Allegro's keyboard state from getting out of sync.
|
ALLEGRO_EVENT_DISPLAY_ORIENTATION = 47; |
Generated when the rotation or orientation of a display changes.
|
ALLEGRO_EVENT_DISPLAY_HALT_DRAWING = 48; |
When a display receives this event it should stop doing any drawing and then call al_acknowledge_drawing_halt immediately.
This is currently only relevant for Android and iOS. It will be sent when the application is switched to background mode, in addition to ALLEGRO_EVENT_DISPLAY_SWITCH_OUT. The latter may also be sent in situations where the application is not active but still should continue drawing, for example when a popup is displayed in front of it.
Note
This event means that the next time you call a drawing function, your program will crash. So you must stop drawing and you must immediately reply with al_acknowledge_drawing_halt . Allegro sends this event because it cannot handle this automatically. Your program might be doing the drawing in a different thread from the event handling, in which case the drawing thread needs to be signaled to stop drawing before acknowledging this event.
Note
Mobile devices usually never quit an application, so to prevent the battery from draining while your application is halted it can be a good idea to call al_stop_timer on all your timers, otherwise they will keep generating events. If you are using audio, you can also stop all audio voices (or pass Nil to al_set_default_voice if you use the default mixer), otherwise Allegro will keep streaming silence to the voice even if the stream or mixer are stopped or detached.
See also
- ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING
- When a display receives this event, it may resume drawing again, and it must call al_acknowledge_drawing_resume immediately.
|
ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING = 49; |
When a display receives this event, it may resume drawing again, and it must call al_acknowledge_drawing_resume immediately.
This is currently only relevant for Android and iOS. The event will be sent when an application returns from background mode and is allowed to draw to the display again, in addition to ALLEGRO_EVENT_DISPLAY_SWITCH_IN. The latter event may also be sent in a situation where the application is already active, for example when a popup in front of it closes.
Note
Unlike ALLEGRO_EVENT_DISPLAY_FOUND it is not necessary to reload any bitmaps when you receive this event.
See also
- ALLEGRO_EVENT_DISPLAY_HALT_DRAWING
- When a display receives this event it should stop doing any drawing and then call al_acknowledge_drawing_halt immediately.
|
ALLEGRO_EVENT_TOUCH_BEGIN = 50; |
The touch input device registered a new touch.
touch.display The display which was touched.
touch.id An identifier for this touch. If supported by the device it will stay the same for events from the same finger until the touch ends.
touch.x The x coordinate of the touch in pixels.
touch.y The y coordinate of the touch in pixels.
touch.dx Movement speed in pixels in x direction.
touch.dy Movement speed in pixels in y direction.
touch.primary Whether this is the only/first touch or an additional touch.
|
ALLEGRO_EVENT_TOUCH_CANCEL = 53; |
A touch was cancelled. This is device specific but could for example mean that a finger moved off the border of the device or moved so fast that it could not be tracked any longer.
Has the same fields as ALLEGRO_EVENT_TOUCH_BEGIN.
|
ALLEGRO_EVENT_DISPLAY_CONNECTED = 60; |
This event is sent when a physical display is connected to the device Allegro runs on. Currently, on most platforms, Allegro supports only a single physical display. However, on iOS, a secondary physical display is supported.
|
ALLEGRO_EVENT_DISPLAY_DISCONNECTED = 61; |
This event is sent when a physical display is disconnected from the device Allegro runs on. Currently, on most platforms, Allegro supports only a single physical display. However, on iOS, a secondary physical display is supported.
|
ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE = 255; |
Max size of window titles.
See also
- al_set_new_window_title
- Sets the title that will be used when a new display is created.
- al_set_window_title
- Sets the title on a display.
|
AL_FIXTORAD_R: AL_FIXED = 1608; |
This constant gives a ratio which can be used to convert a fixed point number in binary angle format to a fixed point number in radians.
Example:
var
RadAngle, BinaryAngle: AL_FIXED;
begin
...
BinaryAngle := 64;
RadAngle = al_fixmul (BinaryAngle, AL_FIXTORAD_R);
...
end.
See also
- AL_FIXED
- A fixed point number.
- al_fixmul
- A fixed point value can be multiplied or divided by an integer with the normal * and / operators.
- AL_RADTOFIX_R
- This constant gives a ratio which can be used to convert a fixed point number in radians to a fixed point number in binary angle format.
|
AL_RADTOFIX_R: AL_FIXED = 2670177; |
This constant gives a ratio which can be used to convert a fixed point number in radians to a fixed point number in binary angle format.
Example:
var
RadAngle, BinaryAngle: AL_FIXED;
begin
BinaryAngle := al_fixmul (RadAngle, AL_RADTOFIX_R)
end.
See also
- AL_FIXED
- A fixed point number.
- al_fixmul
- A fixed point value can be multiplied or divided by an integer with the normal * and / operators.
- AL_FIXTORAD_R
- This constant gives a ratio which can be used to convert a fixed point number in binary angle format to a fixed point number in radians.
|
Generated by PasDoc 0.15.0. Generated on 2024-11-10 15:15:06.
|