package allegro5

  1. Overview
  2. Docs

Types and constants

Abstract types

type bitmap
type color
type event_queue
type event_source
type display
type font
type joystick
type shader
type timeout
type timer
type transform

Audio

type audio_stream
type mixer
type sample
type sample_id

Aggregation types

type pos = float * float
module DisplayMode : sig ... end
module JoystickState : sig ... end
module KeyboardState : sig ... end
module MouseState : sig ... end
module TouchState : sig ... end

Enumerations and flags

module Display : sig ... end
module Bitmap : sig ... end
module Key : sig ... end
module Keymod : sig ... end
module MouseButton : sig ... end
module DisplayOrientation : sig ... end
module Flip : sig ... end
module ShaderType : sig ... end
module ShaderPlatform : sig ... end
module StandardPath : sig ... end
module LineJoin : sig ... end
module LineCap : sig ... end
module Text : sig ... end
module Ttf : sig ... end
module Playmode : sig ... end

Events

module Event : sig ... end

Displays

Display creation

val create_display : int -> int -> display
val destroy_display : display -> unit
val get_new_display_flags : unit -> int
val set_new_display_flags : int -> unit

Display operations

val get_display_event_source : display -> event_source
val flip_display : unit -> unit
val get_backbuffer : display -> bitmap

Display size and position

val get_display_width : display -> int
val get_display_height : display -> int
val resize_display : display -> int -> int -> bool
val acknowledge_resize : display -> unit
val get_window_position : display -> int * int
val set_window_position : display -> int -> int -> unit
val get_window_constraints : display -> int * int * int * int
val set_window_constraints : display -> int -> int -> int -> int -> unit
val apply_window_constraints : display -> bool -> unit
val get_display_adapter : display -> int

Display settings

val set_window_title : display -> string -> unit
val set_new_window_title : string -> unit
val get_new_window_title : unit -> string
val set_display_icon : display -> bitmap -> unit
val set_display_icons : display -> bitmap array -> unit

Fullscreen modes

val get_display_mode : int -> DisplayMode.t
val get_num_display_modes : unit -> int

Events

val create_event_queue : unit -> event_queue
val destroy_event_queue : event_queue -> unit
val register_event_source : event_queue -> event_source -> unit
val unregister_event_source : event_queue -> event_source -> unit
val is_event_source_registered : event_queue -> event_source -> bool

Event queue contents

val pause_event_queue : event_queue -> bool -> unit
val is_event_queue_paused : event_queue -> bool
val is_event_queue_empty : event_queue -> bool
val get_next_event : event_queue -> Event.t option
val peek_next_event : event_queue -> Event.t option
val drop_next_event : event_queue -> bool
val flush_event_queue : event_queue -> unit
val wait_for_event : event_queue -> Event.t
val wait_for_event_timed : event_queue -> bool -> float -> Event.t option
val wait_for_event_until : event_queue -> bool -> timeout -> Event.t option

Graphics routines

Colors

val map_rgb : int -> int -> int -> color
val map_rgba : int -> int -> int -> int -> color
val premul_rgba : int -> int -> int -> int -> color
val map_rgb_f : float -> float -> float -> color
val map_rgba_f : float -> float -> float -> float -> color
val premul_rgba_f : float -> float -> float -> float -> color
val unmap_rgb : color -> int * int * int
val unmap_rgba : color -> int * int * int * int
val unmap_rgb_f : color -> float * float * float
val unmap_rgba_f : color -> float * float * float * float

Bitmap creation

val create_bitmap : int -> int -> bitmap
val create_sub_bitmap : bitmap -> int -> int -> int -> int -> bitmap
val clone_bitmap : bitmap -> bitmap
val convert_bitmap : bitmap -> unit
val convert_memory_bitmaps : unit -> unit
val destroy_bitmap : bitmap -> unit

Bitmap properties

val get_bitmap_width : bitmap -> int
val get_bitmap_height : bitmap -> int
val get_pixel : bitmap -> int -> int -> color
val is_compatible_bitmap : bitmap -> bool
val is_sub_bitmap : bitmap -> bool
val get_parent_bitmap : bitmap -> bitmap
val get_bitmap_x : bitmap -> int
val get_bitmap_y : bitmap -> int
val reparent_bitmap : bitmap -> bitmap -> int -> int -> int -> int

Drawing operations

val clear_to_color : color -> unit
val draw_bitmap : bitmap -> ?tint:color -> pos -> int -> unit
val draw_bitmap_region : bitmap -> ?tint:color -> pos -> pos -> pos -> int -> unit
val draw_rotated_bitmap : bitmap -> ?tint:color -> pos -> pos -> float -> int -> unit
val draw_scaled_bitmap : bitmap -> ?tint:color -> pos -> pos -> pos -> pos -> int -> unit
val draw_scaled_rotated_bitmap : bitmap -> ?tint:color -> pos -> pos -> pos -> float -> int -> unit
val draw_scaled_rotated_bitmap_region : bitmap -> pos -> pos -> ?tint:color -> pos -> pos -> pos -> float -> int -> unit
val put_pixel : int -> int -> color -> unit
val put_blended_pixel : int -> int -> color -> unit
val convert_mask_to_alpha : bitmap -> color -> unit

Target bitmap

val get_target_bitmap : unit -> bitmap
val set_target_bitmap : bitmap -> unit
val set_target_backbuffer : display -> unit
val get_current_display : unit -> display

Deferred drawing

val hold_bitmap_drawing : bool -> unit
val is_bitmap_drawing_held : unit -> bool

Image I/O

val register_bitmap_loader : string -> (string -> int -> bitmap option) option -> unit
val register_bitmap_saver : string -> (string -> bitmap -> bool) option -> unit
val load_bitmap : string -> bitmap
val load_bitmap_flags : string -> int -> bitmap
val save_bitmap : string -> bitmap -> unit
val identify_bitmap : string -> string

Joystick routines

val install_joystick : unit -> unit
val is_joystick_installed : unit -> bool
val uninstall_joystick : unit -> unit
val get_joystick_event_source : unit -> event_source
val reconfigure_joysticks : unit -> bool

Joystick information

val get_num_joysticks : unit -> int
val get_joystick : int -> joystick
val release_joystick : joystick -> unit
val get_joystick_active : joystick -> bool
val get_joystick_name : joystick -> string
val get_joystick_stick_name : joystick -> int -> string option
val get_joystick_axis_name : joystick -> int -> int -> string option
val get_joystick_button_name : joystick -> int -> string option
val is_joystick_stick_analogue : joystick -> int -> bool
val get_joystick_num_sticks : joystick -> int
val get_joystick_num_axes : joystick -> int -> int
val get_joystick_num_buttons : joystick -> int
val get_joystick_state : joystick -> JoystickState.t
val get_joystick_state_axis : JoystickState.t -> int -> int -> float
val get_joystick_state_button : JoystickState.t -> int -> int

Keyboard routines

val install_keyboard : unit -> unit
val is_keyboard_installed : unit -> bool
val uninstall_keyboard : unit -> unit
val get_keyboard_event_source : unit -> event_source

Keyboard information

val get_keyboard_state : unit -> KeyboardState.t
val key_down : KeyboardState.t -> Key.t -> bool
val keycode_to_name : Key.t -> string
val can_set_keyboard_leds : unit -> bool
val set_keyboard_leds : int -> unit

Mouse routines

val install_mouse : unit -> unit
val is_mouse_installed : unit -> bool
val uninstall_mouse : unit -> unit
val get_mouse_event_source : unit -> event_source

Mouse information

val get_mouse_num_axis : unit -> int
val get_mouse_num_buttons : unit -> int
val get_mouse_state : unit -> MouseState.t
val get_mouse_state_axis : MouseState.t -> int -> int
val mouse_button_down : MouseState.t -> int -> bool
val set_mouse_xy : display -> int -> int -> bool
val set_mouse_z : int -> bool
val set_mouse_w : int -> bool
val set_mouse_axis : int -> int -> bool
val set_mouse_wheel_precision : int -> unit
val get_mouse_wheel_precision : unit -> int

Shader routines

val create_shader : ShaderPlatform.t -> shader
val attach_shader_source : shader -> ShaderType.t -> string -> unit
val attach_shader_source_file : shader -> ShaderType.t -> string -> unit
val build_shader : shader -> unit
val get_shader_log : shader -> string
val get_shader_platform : shader -> ShaderPlatform.t
val use_shader : shader option -> unit
val get_current_shader : unit -> shader
val destroy_shader : shader -> unit
val get_default_shader_source : ShaderPlatform.t -> ShaderType.t -> string

Uniforms

val set_shader_sampler : string -> bitmap -> int -> unit
val set_shader_matrix : string -> transform -> unit
val set_shader_int : string -> int -> unit
val set_shader_float : string -> float -> unit
val set_shader_bool : string -> bool -> unit
val set_shader_int_vector : string -> int array array -> unit
val set_shader_float_vector : string -> float array array -> unit

System routines

val init : unit -> unit
val uninstall_system : unit -> unit
val is_system_installed : unit -> bool
val get_allegro_version : unit -> int
val get_standard_path : StandardPath.t -> string
val set_exe_name : string -> unit
val set_app_name : string -> unit
val set_org_name : string -> unit
val get_app_name : unit -> string
val get_org_name : unit -> string
val get_cpu_count : unit -> int
val get_ram_size : unit -> int

Time

val get_time : unit -> float
val init_timeout : float -> timeout
val rest : float -> unit

Timer

val create_timer : float -> timer
val start_timer : timer -> unit
val resume_timer : timer -> unit
val stop_timer : timer -> unit
val get_timer_started : timer -> bool
val destroy_timer : timer -> unit
val get_timer_count : timer -> int64
val set_timer_count : timer -> int64 -> unit
val add_timer_count : timer -> int64 -> unit
val get_timer_speed : timer -> float
val set_timer_speed : timer -> float -> unit
val get_timer_event_source : timer -> event_source

Touch input

val install_touch_input : unit -> unit
val is_touch_input_installed : unit -> bool
val uninstall_touch_input : unit -> unit
val get_touch_input_event_source : unit -> event_source
val get_touch_input_state : unit -> TouchState.t array

Audio addons

val install_audio : unit -> unit
val is_audio_installed : unit -> bool
val uninstall_audio : unit -> unit
val get_allegro_audio_version : unit -> int

Samples

val load_sample : string -> sample
val save_sample : string -> sample -> bool
val destroy_sample : sample -> unit
val reserve_samples : int -> unit
val play_sample : sample -> float -> float -> float -> Playmode.t -> sample_id option
val stop_sample : sample -> unit
val stop_samples : unit -> unit

Audio streams

val load_audio_stream : string -> int -> int -> audio_stream
val destroy_audio_stream : audio_stream -> unit
val get_audio_stream_event_source : audio_stream -> event_source
val rewind_audio_stream : audio_stream -> bool
val detach_audio_stream : audio_stream -> bool
val get_audio_stream_playing : audio_stream -> bool
val set_audio_stream_playing : audio_stream -> bool -> bool
val get_audio_stream_playmode : audio_stream -> Playmode.t
val set_audio_stream_playmode : audio_stream -> Playmode.t -> bool

Mixers

val get_default_mixer : unit -> mixer
val attach_audio_stream_to_mixer : audio_stream -> mixer -> bool

Audio codecs

val init_acodec_addon : unit -> unit
val is_acodec_addon_initialized : unit -> bool
val get_allegro_acodec_version : unit -> int

Image I/O addon

val init_image_addon : unit -> unit
val is_image_addon_initialized : unit -> bool
val shutdown_image_addon : unit -> unit
val get_allegro_image_version : unit -> int

Font addons

val init_font_addon : unit -> unit
val is_font_addon_initialized : unit -> bool
val shutdown_font_addon : unit -> unit
val get_allegro_font_version : unit -> int

General font routines

val destroy_font : font -> unit
val get_font_line_height : font -> int
val get_font_ascent : font -> int
val get_font_descent : font -> int
val get_text_width : font -> string -> int
val draw_text : font -> color -> pos -> int -> string -> unit
val draw_justified_text : font -> color -> pos -> float -> float -> int -> string -> unit
val get_text_dimensions : font -> string -> int * int * int * int
val get_font_ranges : font -> (int * int) array
val set_fallback_font : font -> font option -> unit
val get_fallback_font : font -> font

Bitmap fonts

val grab_font_from_bitmap : bitmap -> (int * int) array -> font
val load_bitmap_font : string -> font
val load_bitmap_font_flags : string -> int -> font
val create_builtin_font : unit -> font

TTF fonts

val init_ttf_addon : unit -> unit
val is_ttf_addon_initialized : unit -> bool
val shutdown_ttf_addon : unit -> unit
val get_allegro_ttf_version : unit -> int
val load_ttf_font : string -> int -> int -> font
val load_ttf_font_stretch : string -> int -> int -> int -> font

Primitives addon

val init_primitives_addon : unit -> unit
val is_primitives_addon_initialized : unit -> bool
val shutdown_primitives_addon : unit -> unit
val get_allegro_primitives_version : unit -> int

High level drawing routines

val draw_line : pos -> pos -> color -> float -> unit
val draw_triangle : pos -> pos -> pos -> color -> float -> unit
val draw_filled_triangle : pos -> pos -> pos -> color -> unit
val draw_rectangle : pos -> pos -> color -> float -> unit
val draw_filled_rectangle : pos -> pos -> color -> unit
val draw_rounded_rectangle : pos -> pos -> pos -> color -> float -> unit
val draw_filled_rounded_rectangle : pos -> pos -> pos -> color -> unit
val draw_pieslice : pos -> float -> float -> float -> color -> float -> unit
val draw_filled_pieslice : pos -> float -> float -> float -> color -> unit
val draw_ellipse : pos -> pos -> color -> float -> unit
val draw_filled_ellipse : pos -> pos -> color -> unit
val draw_circle : pos -> float -> color -> float -> unit
val draw_filled_circle : pos -> float -> color -> unit
val draw_arc : pos -> float -> float -> float -> color -> float -> unit
val draw_elliptical_arc : pos -> pos -> float -> float -> color -> float -> unit
val draw_spline : pos array -> color -> float -> unit
val draw_ribbon : pos array -> color -> float -> unit

Polygon routines

val draw_polyline : pos array -> LineJoin.t -> LineCap.t -> color -> float -> unit
val draw_polygon : pos array -> LineJoin.t -> color -> float -> unit
val draw_filled_polygon : pos array -> color -> unit
val draw_filled_polygon_with_holes : pos array -> pos array list -> color -> unit
OCaml

Innovation. Community. Security.