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 timeout
type timer

Aggregation types

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

Enumerations

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 LineJoin : sig ... end
module LineCap : sig ... end
module Text : sig ... end
module Ttf : 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

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

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

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

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

Image I/O

val load_bitmap : string -> bitmap

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

System routines

val init : unit -> unit
val uninstall_system : unit -> unit
val is_system_installed : unit -> bool
val get_allegro_version : unit -> int
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

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 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

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.