Raylib
Basic types and utility functions shared by the following modules
val to_ctyp : 'a Ctypes.structure -> 'a ctyp
val ptr_of_int : int -> int ptr
val ptr_of_uint : Unsigned.uint -> Unsigned.uint ptr
val void_ptr_of_int : int -> unit ptr
module ConfigFlags : sig ... end
module TraceLogLevel : sig ... end
module Key : sig ... end
module MouseButton : sig ... end
module MouseCursor : sig ... end
module GamepadButton : sig ... end
module GamepadAxis : sig ... end
module MaterialMapIndex : sig ... end
module ShaderLocationIndex : sig ... end
module ShaderUniformDataType : sig ... end
module ShaderAttributeDataType : sig ... end
module PixelFormat : sig ... end
module TextureFilter : sig ... end
module TextureWrap : sig ... end
module CubemapLayout : sig ... end
module FontType : sig ... end
module BlendMode : sig ... end
module Gesture : sig ... end
module CameraMode : sig ... end
module CameraProjection : sig ... end
module NPatchLayout : sig ... end
module Vector2 : sig ... end
module Vector3 : sig ... end
module Vector4 : sig ... end
module Matrix : sig ... end
module Color : sig ... end
module Rectangle : sig ... end
module Image : sig ... end
module Texture : sig ... end
module Texture2D = Texture
module RenderTexture : sig ... end
module NPatchInfo : sig ... end
module GlyphInfo : sig ... end
module Font : sig ... end
module Camera3D : sig ... end
module Camera = Camera3D
module Camera2D : sig ... end
module Mesh : sig ... end
module ShaderLoc : sig ... end
module Shader : sig ... end
module MaterialMap : sig ... end
module Material : sig ... end
module Transform : sig ... end
module BoneInfo : sig ... end
module Model : sig ... end
module ModelAnimation : sig ... end
module Ray : sig ... end
module RayCollision : sig ... end
module BoundingBox : sig ... end
module Wave : sig ... end
module AudioStream : sig ... end
module Sound : sig ... end
module Music : sig ... end
module VrDeviceInfo : sig ... end
module VrStereoConfig : sig ... end
module FilePathList : sig ... end
init_window width height title
Initialize window and OpenGL context
window_should_close ()
Check if KEY_ESCAPE pressed or Close icon pressed
is_window_ready ()
Check if window has been initialized successfully
is_window_fullscreen ()
Check if window is currently fullscreen
is_window_hidden ()
Check if window is currently hidden (only PLATFORM_DESKTOP)
is_window_minimized ()
Check if window is currently minimized (only PLATFORM_DESKTOP)
is_window_maximized ()
Check if window is currently maximized (only PLATFORM_DESKTOP)
is_window_focused ()
Check if window is currently focused (only PLATFORM_DESKTOP)
is_window_resized ()
Check if window has been resized last frame
val is_window_state : ConfigFlags.t -> bool
is_window_state flag
Check if one specific window flag is enabled
val set_window_state : ConfigFlags.t list -> unit
set_window_state flags
Set window configuration state using flags
val clear_window_state : ConfigFlags.t list -> unit
clear_window_state flags
Clear window configuration state flags
toggle_fullscreen ()
Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
maximize_window ()
Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
minimize_window ()
Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
restore_window ()
Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
val set_window_icon : Image.t -> unit
set_window_icon image
Set icon for window (only PLATFORM_DESKTOP)
set_window_title title
Set title for window (only PLATFORM_DESKTOP)
set_window_position x y
Set window position on screen (only PLATFORM_DESKTOP)
set_window_monitor monitor
Set monitor for the current window (fullscreen mode)
set_window_min_size width height
Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
val get_window_handle : unit -> unit ptr option
get_window_handle ()
Get native window handle
get_render_height ()
Get current render height (it considers HiDPI)
val get_monitor_position : int -> Vector2.t
get_monitor_position monitor
Get specified monitor position
get_monitor_width monitor
Get specified monitor width (max available by monitor)
get_monitor_height monitor
Get specified monitor height (max available by monitor)
get_monitor_physical_width monitor
Get specified monitor physical width in millimetres
get_monitor_physical_height monitor
Get specified monitor physical height in millimetres
get_monitor_refresh_rate monitor
Get specified monitor refresh rate
val get_window_position : unit -> Vector2.t
get_window_position ()
Get window position XY on monitor
val get_window_scale_dpi : unit -> Vector2.t
get_window_scale_dpi ()
Get window scale DPI factor
get_monitor_name monitor
Get the human-readable, UTF-8 encoded name of the primary monitor
enable_event_waiting ()
Enable waiting for events on EndDrawing(), no automatic event polling
disable_event_waiting ()
Disable waiting for events on EndDrawing(), automatic events polling
swap_screen_buffer ()
Swap back buffer with front buffer (screen drawing)
is_cursor_hidden ()
Check if cursor is not visible
is_cursor_on_screen ()
Check if cursor is on the current screen.
val clear_background : Color.t -> unit
clear_background color
Set background color (framebuffer clear color)
val begin_mode_2d : Camera2D.t -> unit
begin_mode_2d camera
Initialize 2D mode with custom camera (2D)
val begin_mode_3d : Camera3D.t -> unit
begin_mode_3d camera
Initializes 3D mode with custom camera (3D)
end_mode_3d ()
Ends 3D mode and returns to default 2D orthographic mode
val begin_texture_mode : RenderTexture.t -> unit
begin_texture_mode target
Begin drawing to render texture
val begin_shader_mode : Shader.t -> unit
begin_shader_mode shader
Begin custom shader drawing
val begin_blend_mode : BlendMode.t -> unit
begin_blend_mode mode
Begin blending mode (alpha, additive, multiplied)
end_blend_mode ()
End blending mode (reset to default: alpha blending)
begin_scissor_mode x y width height
Begin scissor mode (define screen area for following drawing)
val begin_vr_stereo_mode : VrStereoConfig.t -> unit
begin_vr_stereo_mode config
Begin stereo rendering (requires VR simulator)
end_vr_stereo_mode ()
End stereo rendering (requires VR simulator)
val load_vr_stereo_config : VrDeviceInfo.t -> VrStereoConfig.t
load_vr_stereo_config device
Load VR stereo config for VR simulator device parameters
val unload_vr_stereo_config : VrStereoConfig.t -> unit
unload_vr_stereo_config config
Unload VR stereo config
val load_shader : string -> string -> Shader.t
load_shader vs_file_name fs_file_name
Load shader from files and bind default locations
val load_shader_from_memory : string -> string -> Shader.t
load_shader_from_memory vs_code fs_code
Load shader from code strings and bind default locations
val get_shader_location : Shader.t -> string -> ShaderLoc.t
get_shader_location shader uniform_name
Get shader uniform location
val get_shader_location_attrib : Shader.t -> string -> ShaderLoc.t
get_shader_location_attrib shader attrib_name
Get shader attribute location
val set_shader_value :
Shader.t ->
ShaderLoc.t ->
unit ptr ->
ShaderUniformDataType.t ->
unit
set_shader_value shader loc_index value uniform_type
Set shader uniform value
val set_shader_value_v :
Shader.t ->
ShaderLoc.t ->
unit ptr ->
ShaderUniformDataType.t ->
int ->
unit
set_shader_value_v shader loc_index value uniform_type count
Set shader uniform value vector
val set_shader_value_matrix : Shader.t -> ShaderLoc.t -> Matrix.t -> unit
set_shader_value_matrix shader loc_index mat
Set shader uniform value (matrix 4x4)
val set_shader_value_texture : Shader.t -> ShaderLoc.t -> Texture.t -> unit
set_shader_value_texture shader loc_index texture
Set shader uniform value for texture (sampler2d)
val unload_shader : Shader.t -> unit
unload_shader shader
Unload shader from GPU memory (VRAM)
val get_mouse_ray : Vector2.t -> Camera3D.t -> Ray.t
get_mouse_ray mouse_position camera
Get a ray trace from mouse position
val get_camera_matrix : Camera3D.t -> Matrix.t
get_camera_matrix camera
Get camera transform matrix (view matrix)
val get_camera_matrix_2d : Camera2D.t -> Matrix.t
get_camera_matrix_2d camera
Returns camera 2d transform matrix
val get_world_to_screen : Vector3.t -> Camera3D.t -> Vector2.t
get_world_to_screen position camera
Get the screen space position for a 3d world space position
val get_world_to_screen_ex : Vector3.t -> Camera3D.t -> int -> int -> Vector2.t
get_world_to_screen_ex position camera width height
Get size position for a 3d world space position
val get_screen_to_world_2d : Vector2.t -> Camera2D.t -> Vector2.t
get_screen_to_world_2d position camera
Returns the world space position for a 2d camera screen space position
val get_world_to_screen_2d : Vector2.t -> Camera2D.t -> Vector2.t
get_world_to_screen_2d position camera
Returns the screen space position for a 2d camera world space position
get_frame_time ()
Get time in seconds for last frame drawn (delta time)
get_random_value min max
Get a random value between min and max (both included)
set_random_seed seed
Set the seed for the random number generator
take_screenshot file_name
Takes a screenshot of current screen (filename extension defines format)
val set_config_flags : ConfigFlags.t list -> unit
set_config_flags flags
Setup init configuration flags (view FLAGS)
trace_log log_level text
Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
val set_trace_log_level : TraceLogLevel.t -> unit
set_trace_log_level log_level
Set the current threshold (minimum) log level
val mem_alloc : int -> unit ptr
mem_alloc size
Internal memory allocator
val mem_free : unit ptr -> unit
mem_free ptr
Internal memory free
load_file_data file_name bytes_read
Load file data as byte array (read)
unload_file_data data
Unload file data allocated by LoadFileData()
save_file_data file_name data bytes_to_write
Save data to file from byte array (write), returns true on success
export_data_as_code data filename
Export data to code (.h), returns true on success
load_file_text file_name
Load text data from file (read), returns a ' 0' terminated string
unload_file_text text
Unload file text data allocated by LoadFileText()
save_file_text file_name text
Save text data to file (write), string must be ' 0' terminated, returns true on success
is_file_extension file_name ext
Check file extension (including point: .png, .wav)
get_file_length filename
Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
get_file_extension file_name
Get pointer to extension for a filename string (includes dot: '.png')
get_file_name file_path
Get pointer to filename for a path string
get_file_name_without_ext file_path
Get filename string without extension (uses static string)
get_directory_path file_path
Get full path for a given fileName with path (uses static string)
get_prev_directory_path dir_path
Get previous directory path for a given path (uses static string)
get_working_directory ()
Get current working directory (uses static string)
get_application_directory ()
Get the directory if the running application (uses static string)
change_directory dir
Change working directory, return true on success
val load_directory_files : string -> FilePathList.t
load_directory_files dirpath
Load directory filepaths
val load_directory_files_ex : string -> string -> bool -> FilePathList.t
load_directory_files_ex basepath filter scansubdirs
Load directory filepaths with extension filtering and recursive directory scan
val unload_directory_files : FilePathList.t -> unit
unload_directory_files files
Unload filepaths
val load_dropped_files : unit -> FilePathList.t
load_dropped_files count
Load dropped filepaths
val unload_dropped_files : FilePathList.t -> unit
unload_dropped_files files
Unload dropped filepaths
get_file_mod_time file_name
Get file modification time (last write time)
compress_data data data_length comp_data_length
Compress data (DEFLATE algorithm)
decompress_data comp_data comp_data_length data_length
Decompress data (DEFLATE algorithm)
val is_key_pressed : Key.t -> bool
is_key_pressed key
Detect if a key has been pressed once
val is_key_down : Key.t -> bool
is_key_down key
Detect if a key is being pressed
val is_key_released : Key.t -> bool
is_key_released key
Detect if a key has been released once
val is_key_up : Key.t -> bool
is_key_up key
Detect if a key is NOT being pressed
val set_exit_key : Key.t -> unit
set_exit_key key
Set a custom key to exit program (default is ESC)
val get_key_pressed : unit -> Key.t
get_key_pressed ()
Get key pressed (keycode), call it multiple times for keys queued
get_char_pressed ()
Get char pressed (unicode), call it multiple times for chars queued
val is_gamepad_button_pressed : int -> GamepadButton.t -> bool
is_gamepad_button_pressed gamepad button
Detect if a gamepad button has been pressed once
val is_gamepad_button_down : int -> GamepadButton.t -> bool
is_gamepad_button_down gamepad button
Detect if a gamepad button is being pressed
val is_gamepad_button_released : int -> GamepadButton.t -> bool
is_gamepad_button_released gamepad button
Detect if a gamepad button has been released once
val is_gamepad_button_up : int -> GamepadButton.t -> bool
is_gamepad_button_up gamepad button
Detect if a gamepad button is NOT being pressed
val get_gamepad_button_pressed : unit -> GamepadButton.t
get_gamepad_button_pressed ()
Get the last gamepad button pressed
get_gamepad_axis_count gamepad
Get gamepad axis count for a gamepad
val get_gamepad_axis_movement : int -> GamepadAxis.t -> float
get_gamepad_axis_movement gamepad axis
Get axis movement value for a gamepad axis
set_gamepad_mappings mappings
Set internal gamepad mappings (SDL_GameControllerDB)
val is_mouse_button_pressed : MouseButton.t -> bool
is_mouse_button_pressed button
Check if a mouse button has been pressed once
val is_mouse_button_down : MouseButton.t -> bool
is_mouse_button_down button
Check if a mouse button is being pressed
val is_mouse_button_released : MouseButton.t -> bool
is_mouse_button_released button
Check if a mouse button has been released once
val is_mouse_button_up : MouseButton.t -> bool
is_mouse_button_up button
Check if a mouse button is NOT being pressed
val get_mouse_position : unit -> Vector2.t
get_mouse_position ()
Get mouse position XY
val get_mouse_delta : unit -> Vector2.t
get_mouse_delta ()
Get mouse delta between frames
get_mouse_wheel_move ()
Get mouse wheel movement for X or Y, whichever is larger
val get_mouse_wheel_move_v : unit -> Vector2.t
get_mouse_wheel_move_v ()
Get mouse wheel movement for both X and Y
val set_mouse_cursor : MouseCursor.t -> unit
set_mouse_cursor cursor
Set mouse cursor
get_touch_x ()
Get touch position X for touch point 0 (relative to screen size)
get_touch_y ()
Get touch position Y for touch point 0 (relative to screen size)
val get_touch_position : int -> Vector2.t
get_touch_position index
Get touch position XY for a touch point index (relative to screen size)
get_touch_point_id index
Get touch point identifier for given index
val set_gestures_enabled : Gesture.t list -> unit
set_gestures_enabled flags
Enable a set of gestures using flags
val is_gesture_detected : Gesture.t -> bool
is_gesture_detected gesture
Check if a gesture have been detected
val get_gesture_detected : unit -> Gesture.t
get_gesture_detected ()
Get latest detected gesture
get_gesture_hold_duration ()
Get gesture hold time in milliseconds
val get_gesture_drag_vector : unit -> Vector2.t
get_gesture_drag_vector ()
Get gesture drag vector
val get_gesture_pinch_vector : unit -> Vector2.t
get_gesture_pinch_vector ()
Get gesture pinch delta
val set_camera_mode : Camera3D.t -> CameraMode.t -> unit
set_camera_mode camera mode
Set camera mode (multiple camera modes available)
val update_camera : Camera3D.t ptr -> unit
update_camera camera
Update camera position for selected mode
val set_camera_pan_control : Key.t -> unit
set_camera_pan_control key_pan
Set camera pan key to combine with mouse movement (free camera)
val set_camera_alt_control : Key.t -> unit
set_camera_alt_control key_alt
Set camera alt key to combine with mouse movement (free camera)
val set_camera_smooth_zoom_control : Key.t -> unit
set_camera_smooth_zoom_control key_smooth_zoom
Set camera smooth zoom key to combine with mouse (free camera)
set_camera_move_controls key_front key_back key_right key_left key_up key_down
Set camera move controls (1st person and 3rd person cameras)
val set_shapes_texture : Texture.t -> Rectangle.t -> unit
set_shapes_texture texture source
Set texture and rectangle to be used on shapes drawing
val draw_pixel : int -> int -> Color.t -> unit
draw_pixel pos_x pos_y color
Draw a pixel
draw_pixel_v position color
Draw a pixel (Vector version)
val draw_line : int -> int -> int -> int -> Color.t -> unit
draw_line start_pos_x start_pos_y end_pos_x end_pos_y color
Draw a line
draw_line_v start_pos end_pos color
Draw a line (Vector version)
draw_line_ex start_pos end_pos thick color
Draw a line defining thickness
draw_line_bezier start_pos end_pos thick color
Draw a line using cubic-bezier curves in-out
draw_line_bezier_quad start_pos end_pos control_pos thick color
Draw line using quadratic bezier curves with a control point
val draw_line_bezier_cubic :
Vector2.t ->
Vector2.t ->
Vector2.t ->
Vector2.t ->
float ->
Color.t ->
unit
draw_line_bezier_cubic start_pos end_pos start_control_pos end_control_pos thick color
Draw line using cubic bezier curves with 2 control points
draw_line_strip points point_count color
Draw lines sequence
val draw_circle : int -> int -> float -> Color.t -> unit
draw_circle center_x center_y radius color
Draw a color-filled circle
draw_circle_sector center radius start_angle end_angle segments color
Draw a piece of a circle
draw_circle_sector_lines center radius start_angle end_angle segments color
Draw circle sector outline
draw_circle_gradient center_x center_y radius color1 color2
Draw a gradient-filled circle
draw_circle_v center radius color
Draw a color-filled circle (Vector version)
val draw_circle_lines : int -> int -> float -> Color.t -> unit
draw_circle_lines center_x center_y radius color
Draw circle outline
val draw_ellipse : int -> int -> float -> float -> Color.t -> unit
draw_ellipse center_x center_y radius_h radius_v color
Draw ellipse
val draw_ellipse_lines : int -> int -> float -> float -> Color.t -> unit
draw_ellipse_lines center_x center_y radius_h radius_v color
Draw ellipse outline
draw_ring center inner_radius outer_radius start_angle end_angle segments color
Draw ring
draw_ring_lines center inner_radius outer_radius start_angle end_angle segments color
Draw ring outline
val draw_rectangle : int -> int -> int -> int -> Color.t -> unit
draw_rectangle pos_x pos_y width height color
Draw a color-filled rectangle
draw_rectangle_v position size color
Draw a color-filled rectangle (Vector version)
val draw_rectangle_rec : Rectangle.t -> Color.t -> unit
draw_rectangle_rec rec color
Draw a color-filled rectangle
val draw_rectangle_pro : Rectangle.t -> Vector2.t -> float -> Color.t -> unit
draw_rectangle_pro rec origin rotation color
Draw a color-filled rectangle with pro parameters
draw_rectangle_gradient_v pos_x pos_y width height color1 color2
Draw a vertical-gradient-filled rectangle
draw_rectangle_gradient_h pos_x pos_y width height color1 color2
Draw a horizontal-gradient-filled rectangle
val draw_rectangle_gradient_ex :
Rectangle.t ->
Color.t ->
Color.t ->
Color.t ->
Color.t ->
unit
draw_rectangle_gradient_ex rec col1 col2 col3 col4
Draw a gradient-filled rectangle with custom vertex colors
val draw_rectangle_lines : int -> int -> int -> int -> Color.t -> unit
draw_rectangle_lines pos_x pos_y width height color
Draw rectangle outline
val draw_rectangle_lines_ex : Rectangle.t -> float -> Color.t -> unit
draw_rectangle_lines_ex rec line_thick color
Draw rectangle outline with extended parameters
val draw_rectangle_rounded : Rectangle.t -> float -> int -> Color.t -> unit
draw_rectangle_rounded rec roundness segments color
Draw rectangle with rounded edges
val draw_rectangle_rounded_lines :
Rectangle.t ->
float ->
int ->
float ->
Color.t ->
unit
draw_rectangle_rounded_lines rec roundness segments line_thick color
Draw rectangle with rounded edges outline
draw_triangle v1 v2 v3 color
Draw a color-filled triangle (vertex in counter-clockwise order!)
draw_triangle_lines v1 v2 v3 color
Draw triangle outline (vertex in counter-clockwise order!)
draw_triangle_fan points point_count color
Draw a triangle fan defined by points (first vertex is the center)
draw_triangle_strip points point_count color
Draw a triangle strip defined by points
draw_poly center sides radius rotation color
Draw a regular polygon (Vector version)
draw_poly_lines center sides radius rotation color
Draw a polygon outline of n sides
draw_poly_lines_ex center sides radius rotation line_thick color
Draw a polygon outline of n sides with extended parameters
val check_collision_recs : Rectangle.t -> Rectangle.t -> bool
check_collision_recs rec1 rec2
Check collision between two rectangles
check_collision_circles center1 radius1 center2 radius2
Check collision between two circles
val check_collision_circle_rec : Vector2.t -> float -> Rectangle.t -> bool
check_collision_circle_rec center radius rec
Check collision between circle and rectangle
val check_collision_point_rec : Vector2.t -> Rectangle.t -> bool
check_collision_point_rec point rec
Check if point is inside rectangle
check_collision_point_circle point center radius
Check if point is inside circle
check_collision_point_triangle point p1 p2 p3
Check if point is inside a triangle
val check_collision_lines :
Vector2.t ->
Vector2.t ->
Vector2.t ->
Vector2.t ->
Vector2.t ptr ->
bool
check_collision_lines start_pos1 end_pos1 start_pos2 end_pos2 collision_point
Check the collision between two lines defined by two points each, returns collision point by reference
check_collision_point_line point p1 p2 threshold
Check if point belongs to line created between two points p1
and p2
with defined margin in pixels threshold
val get_collision_rec : Rectangle.t -> Rectangle.t -> Rectangle.t
get_collision_rec rec1 rec2
Get collision rectangle for two rectangles collision
val load_image : string -> Image.t
load_image file_name
Load image from file into CPU memory (RAM)
val load_image_raw : string -> int -> int -> PixelFormat.t -> int -> Image.t
load_image_raw file_name width height format header_size
Load image from RAW file data
load_image_anim file_name frames
Load image sequence from file (frames appended to image.data)
val load_image_from_memory : string -> string -> int -> Image.t
load_image_from_memory file_type file_data data_size
Load image from memory buffer, fileType refers to extension: i.e. '.png'
load_image_from_texture texture
Load image from GPU texture data
val load_image_from_screen : unit -> Image.t
load_image_from_screen ()
Load image from screen buffer and (screenshot)
val unload_image : Image.t -> unit
unload_image image
Unload image from CPU memory (RAM)
val export_image : Image.t -> string -> bool
export_image image file_name
Export image data to file, returns true on success
val export_image_as_code : Image.t -> string -> bool
export_image_as_code image file_name
Export image as code file defining an array of bytes, returns true on success
gen_image_color width height color
Generate image: plain color
gen_image_gradient_v width height top bottom
Generate image: vertical gradient
gen_image_gradient_h width height left right
Generate image: horizontal gradient
gen_image_gradient_radial width height density inner outer
Generate image: radial gradient
gen_image_checked width height checks_x checks_y col1 col2
Generate image: checked
val gen_image_white_noise : int -> int -> float -> Image.t
gen_image_white_noise width height factor
Generate image: white noise
val gen_image_cellular : int -> int -> int -> Image.t
gen_image_cellular width height tile_size
Generate image: cellular algorithm, bigger tileSize means bigger cells
image_copy image
Create an image duplicate (useful for transformations)
val image_from_image : Image.t -> Rectangle.t -> Image.t
image_from_image image rec
Create an image from another image piece
image_text text font_size color
Create an image from text (default font)
image_text_ex font text font_size spacing tint
Create an image from text (custom sprite font)
image_format image new_format
Convert image data to desired format
image_to_pot image fill
Convert image to POT (power-of-two)
val image_crop : Image.t ptr -> Rectangle.t -> unit
image_crop image crop
Crop an image to a defined rectangle
image_alpha_crop image threshold
Crop image depending on alpha value
image_alpha_clear image color threshold
Clear alpha channel to desired color
image_alpha_mask image alpha_mask
Apply alpha mask to image
image_alpha_premultiply image
Premultiply alpha channel
image_resize image new_width new_height
Resize image (Bicubic scaling algorithm)
image_resize_nn image new_width new_height
Resize image (Nearest-Neighbor scaling algorithm)
image_resize_canvas image new_width new_height offset_x offset_y fill
Resize canvas and fill with color
image_mipmaps image
Compute all mipmap levels for a provided image
image_dither image r_bpp g_bpp b_bpp a_bpp
Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
image_rotate_ccw image
Rotate image counter-clockwise 90deg
image_color_tint image color
Modify image color: tint
image_color_grayscale image
Modify image color: grayscale
image_color_contrast image contrast
Modify image color: contrast (-100 to 100)
image_color_brightness image brightness
Modify image color: brightness (-255 to 255)
image_color_replace image color replace
Modify image color: replace color
load_image_colors image
Load color data from image as a Color array (RGBA - 32bit)
load_image_palette image max_palette_size color_count
Load colors palette from image as a Color array (RGBA - 32bit)
unload_image_colors colors
Unload color data loaded with LoadImageColors()
unload_image_palette colors
Unload colors palette loaded with LoadImagePalette()
val get_image_alpha_border : Image.t -> float -> Rectangle.t
get_image_alpha_border image threshold
Get image alpha border rectangle
get_image_color image x y
Get image pixel color at (x, y) position
image_clear_background dst color
Clear image background with given color
image_draw_pixel dst pos_x pos_y color
Draw pixel within an image
image_draw_pixel_v dst position color
Draw pixel within an image (Vector version)
image_draw_line dst start_pos_x start_pos_y end_pos_x end_pos_y color
Draw line within an image
image_draw_line_v dst start end color
Draw line within an image (Vector version)
image_draw_circle dst center_x center_y radius color
Draw circle within an image
image_draw_circle_v dst center radius color
Draw circle within an image (Vector version)
image_draw_rectangle dst pos_x pos_y width height color
Draw rectangle within an image
image_draw_rectangle_v dst position size color
Draw rectangle within an image (Vector version)
val image_draw_rectangle_rec : Image.t ptr -> Rectangle.t -> Color.t -> unit
image_draw_rectangle_rec dst rec color
Draw rectangle within an image
val image_draw_rectangle_lines :
Image.t ptr ->
Rectangle.t ->
int ->
Color.t ->
unit
image_draw_rectangle_lines dst rec thick color
Draw rectangle lines within an image
val image_draw :
Image.t ptr ->
Image.t ->
Rectangle.t ->
Rectangle.t ->
Color.t ->
unit
image_draw dst src src_rec dst_rec tint
Draw a source image within a destination image (tint applied to source)
image_draw_text dst text pos_x pos_y font_size color
Draw text (using default font) within an image (destination)
val image_draw_text_ex :
Image.t ptr ->
Font.t ->
string ->
Vector2.t ->
float ->
float ->
Color.t ->
unit
image_draw_text_ex dst font text position font_size spacing tint
Draw text (custom sprite font) within an image (destination)
val load_texture : string -> Texture.t
load_texture file_name
Load texture from file into GPU memory (VRAM)
load_texture_from_image image
Load texture from image data
load_texture_cubemap image layout
Load cubemap from image, multiple image cubemap layouts supported
val load_render_texture : int -> int -> RenderTexture.t
load_render_texture width height
Load texture for rendering (framebuffer)
val unload_texture : Texture.t -> unit
unload_texture texture
Unload texture from GPU memory (VRAM)
val unload_render_texture : RenderTexture.t -> unit
unload_render_texture target
Unload render texture from GPU memory (VRAM)
update_texture texture pixels
Update GPU texture with new data
val update_texture_rec : Texture.t -> Rectangle.t -> unit ptr -> unit
update_texture_rec texture rec pixels
Update GPU texture rectangle with new data
gen_texture_mipmaps texture
Generate GPU mipmaps for a texture
val set_texture_filter : Texture.t -> TextureFilter.t -> unit
set_texture_filter texture filter
Set texture scaling filter mode
val set_texture_wrap : Texture.t -> TextureWrap.t -> unit
set_texture_wrap texture wrap
Set texture wrapping mode
draw_texture texture pos_x pos_y tint
Draw a Texture2D
draw_texture_v texture position tint
Draw a Texture2D with position defined as Vector2
draw_texture_ex texture position rotation scale tint
Draw a Texture2D with extended parameters
val draw_texture_rec : Texture.t -> Rectangle.t -> Vector2.t -> Color.t -> unit
draw_texture_rec texture source position tint
Draw a part of a texture defined by a rectangle
val draw_texture_quad :
Texture.t ->
Vector2.t ->
Vector2.t ->
Rectangle.t ->
Color.t ->
unit
draw_texture_quad texture tiling offset quad tint
Draw texture quad with tiling and offset parameters
val draw_texture_tiled :
Texture.t ->
Rectangle.t ->
Rectangle.t ->
Vector2.t ->
float ->
float ->
Color.t ->
unit
draw_texture_tiled texture source dest origin rotation scale tint
Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
val draw_texture_pro :
Texture.t ->
Rectangle.t ->
Rectangle.t ->
Vector2.t ->
float ->
Color.t ->
unit
draw_texture_pro texture source dest origin rotation tint
Draw a part of a texture defined by a rectangle with 'pro' parameters
val draw_texture_npatch :
Texture.t ->
NPatchInfo.t ->
Rectangle.t ->
Vector2.t ->
float ->
Color.t ->
unit
draw_texture_npatch texture n_patch_info dest origin rotation tint
Draws a texture (or part of it) that stretches or shrinks nicely
val draw_texture_poly :
Texture.t ->
Vector2.t ->
Vector2.t ptr ->
Vector2.t ptr ->
int ->
Color.t ->
unit
draw_texture_poly texture center points texcoords point_count tint
Draw a textured polygon
fade color alpha
Get color with alpha applied, alpha goes from 0.0f to 1.0f
val color_to_int : Color.t -> int
color_to_int color
Get hexadecimal value for a Color
color_from_normalized normalized
Get Color from normalized values 0..1
color_to_hsv color
Get HSV values for a Color, hue 0..360
, saturation/value 0..1
val color_from_hsv : float -> float -> float -> Color.t
color_from_hsv hue saturation value
Get a Color from HSV values, hue 0..360
, saturation/value 0..1
color_alpha color alpha
Get color with alpha applied, alpha goes from 0.0f to 1.0f
color_alpha_blend dst src tint
Get src alpha-blended into dst color with tint
val get_color : int -> Color.t
get_color hex_value
Get Color structure from hexadecimal value
val get_pixel_color : unit ptr -> PixelFormat.t -> Color.t
get_pixel_color src_ptr format
Get Color from a source pixel pointer of certain format
val set_pixel_color : unit ptr -> Color.t -> PixelFormat.t -> unit
set_pixel_color dst_ptr color format
Set color formatted into destination pixel pointer
val get_pixel_data_size : int -> int -> PixelFormat.t -> int
get_pixel_data_size width height format
Get pixel data size in bytes for certain format
val get_font_default : unit -> Font.t
get_font_default ()
Get the default Font
val load_font : string -> Font.t
load_font file_name
Load font from file into GPU memory (VRAM)
val load_font_ex : string -> int -> int CArray.t option -> Font.t
load_font_ex file_name font_size font_chars glyph_count
Load font from file with extended parameters
load_font_from_image image key first_char
Load font from Image (XNA style)
load_font_from_memory file_type file_data data_size font_size font_chars chars_count
Load font from memory buffer, fileType refers to extension: i.e. ".ttf"
val load_font_data :
string ->
int ->
int ->
int ptr ->
int ->
int ->
GlyphInfo.t ptr
load_font_data file_data data_size font_size font_chars chars_count type
Load font data for further use
val gen_image_font_atlas :
GlyphInfo.t ptr ->
Rectangle.t ptr ptr ->
int ->
int ->
int ->
int ->
Image.t
gen_image_font_atlas chars recs chars_count font_size padding pack_method
Generate image font atlas using chars info
val unload_font_data : GlyphInfo.t ptr -> int -> unit
unload_font_data chars glyph_count
Unload font chars info data (RAM)
val unload_font : Font.t -> unit
unload_font font
Unload Font from GPU memory (VRAM)
val export_font_as_code : Font.t -> string -> bool
export_font_as_code font filename
Export font as code file, returns true on success
val draw_text : string -> int -> int -> int -> Color.t -> unit
draw_text text pos_x pos_y font_size color
Draw text (using default font)
draw_text_ex font text position font_size spacing tint
Draw text using font and additional parameters
val draw_text_pro :
Font.t ->
string ->
Vector2.t ->
Vector2.t ->
float ->
float ->
float ->
Color.t ->
unit
draw_text_pro font text position origin rotation font_size spacing tint
Draw text using Font and pro parameters (rotation)
draw_text_codepoint font codepoint position font_size tint
Draw one character (codepoint)
draw_text_codepoints font codepoints position fontsize spacing tint
Draw multiple character (codepoint)
measure_text text font_size
Measure string width for default font
measure_text_ex font text font_size spacing
Measure string size for Font
val get_glyph_index : Font.t -> int -> int
get_glyph_index font codepoint
Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
val get_glyph_info : Font.t -> int -> GlyphInfo.t
get_glyph_info font codepoint
Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
val get_glyph_atlas_rec : Font.t -> int -> Rectangle.t
get_glyph_atlas_rec font codepoint
Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
load_codepoints text count
Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
val unload_codepoints : int ptr -> unit
unload_codepoints codepoints
Unload codepoints data from memory
get_codepoint_count text
Get total number of codepoints in a UTF-8 encoded string
val get_codepoint : string -> int ptr -> int
get_codepoint text bytes_processed
Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
val codepoint_to_utf8 : int -> int ptr -> string
codepoint_to_utf8 codepoint byte_size
Encode one codepoint into UTF-8 byte array (array length returned as parameter)
val text_codepoints_to_utf8 : int ptr -> int -> string
text_codepoints_to_utf8 codepoints length
Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!)
text_copy dst src
Copy one string to another, returns bytes copied
text_is_equal text1 text2
Check if two text string are equal
text_subtext text position length
Get a piece of a text string
text_replace text replace by
Replace text string (WARNING: memory must be freed!)
text_insert text insert position
Insert text in a position (WARNING: memory must be freed!)
val text_append : string -> string -> int ptr -> unit
text_append text append position
Append text at specific position and move cursor!
text_find_index text find
Find first text occurrence within a string
text_to_pascal text
Get Pascal case notation version of provided string
text_to_integer text
Get integer value from text (negative values not supported)
draw_line_3d start_pos end_pos color
Draw a line in 3D world space
draw_point_3d position color
Draw a point in 3D space, actually a small line
draw_circle_3d center radius rotation_axis rotation_angle color
Draw a circle in 3D world space
draw_triangle_3d v1 v2 v3 color
Draw a color-filled triangle (vertex in counter-clockwise order!)
draw_triangle_strip_3d points point_count color
Draw a triangle strip defined by points
draw_cube position width height length color
Draw cube
draw_cube_v position size color
Draw cube (Vector version)
draw_cube_wires position width height length color
Draw cube wires
draw_cube_wires_v position size color
Draw cube wires (Vector version)
draw_cube_texture texture position width height length color
Draw cube textured
val draw_cube_texture_rec :
Texture.t ->
Rectangle.t ->
Vector3.t ->
float ->
float ->
float ->
Color.t ->
unit
draw_cube_texture_rec texture source position width height length color
Draw cube with a region of a texture
draw_sphere center_pos radius color
Draw sphere
draw_sphere_ex center_pos radius rings slices color
Draw sphere with extended parameters
draw_sphere_wires center_pos radius rings slices color
Draw sphere wires
draw_cylinder position radius_top radius_bottom height slices color
Draw a cylinder/cone
draw_cylinder_ex start_pos end_pos start_radius end_radius sides color
Draw a cylinder with base at startPos and top at endPos
draw_cylinder_wires position radius_top radius_bottom height slices color
Draw a cylinder/cone wires
draw_cylinder_wires_ex start_pos end_pos start_radius end_radius sides color
Draw a cylinder wires with base at startPos and top at endPos
draw_plane center_pos size color
Draw a plane XZ
val load_model : string -> Model.t
load_model file_name
Load model from files (meshes and materials)
load_model_from_mesh mesh
Load model from generated mesh (default material)
val unload_model : Model.t -> unit
unload_model model
Unload model (including meshes) from memory (RAM and/or VRAM)
val unload_model_keep_meshes : Model.t -> unit
unload_model_keep_meshes model
Unload model (but not meshes) from memory (RAM and/or VRAM)
val get_model_bounding_box : Model.t -> BoundingBox.t
get_model_bounding_box model
Compute model bounding box limits (considers all meshes)
draw_model model position scale tint
Draw a model (with texture if set)
draw_model_ex model position rotation_axis rotation_angle scale tint
Draw a model with extended parameters
draw_model_wires model position scale tint
Draw a model wires (with texture if set)
val draw_model_wires_ex :
Model.t ->
Vector3.t ->
Vector3.t ->
float ->
Vector3.t ->
Color.t ->
unit
draw_model_wires_ex model position rotation_axis rotation_angle scale tint
Draw a model wires (with texture if set) with extended parameters
val draw_bounding_box : BoundingBox.t -> Color.t -> unit
draw_bounding_box box color
Draw bounding box (wires)
val draw_billboard :
Camera3D.t ->
Texture.t ->
Vector3.t ->
float ->
Color.t ->
unit
draw_billboard camera texture position size tint
Draw a billboard texture
val draw_billboard_rec :
Camera3D.t ->
Texture.t ->
Rectangle.t ->
Vector3.t ->
Vector2.t ->
Color.t ->
unit
draw_billboard_rec camera texture source position size tint
Draw a billboard texture defined by source
val draw_billboard_pro :
Camera3D.t ->
Texture.t ->
Rectangle.t ->
Vector3.t ->
Vector3.t ->
Vector2.t ->
Vector2.t ->
float ->
Color.t ->
unit
draw_billboard_pro camera texture source position up size origin rotation tint
Draw a billboard texture defined by source and rotation
upload_mesh mesh dynamic
Upload mesh vertex data in GPU and provide VAO/VBO ids
update_mesh_buffer mesh index data data_size offset
Update mesh vertex data in GPU for a specific buffer index
val unload_mesh : Mesh.t -> unit
unload_mesh mesh
Unload mesh data from CPU and GPU
val draw_mesh : Mesh.t -> Material.t -> Matrix.t -> unit
draw_mesh mesh material transform
Draw a 3d mesh with material and transform
val draw_mesh_instanced : Mesh.t -> Material.t -> Matrix.t ptr -> int -> unit
draw_mesh_instanced mesh material transforms instances
Draw multiple mesh instances with material and different transforms
val export_mesh : Mesh.t -> string -> bool
export_mesh mesh file_name
Export mesh data to file, returns true on success
val get_mesh_bounding_box : Mesh.t -> BoundingBox.t
get_mesh_bounding_box mesh
Compute mesh bounding box limits
val gen_mesh_poly : int -> float -> Mesh.t
gen_mesh_poly sides radius
Generate polygonal mesh
val gen_mesh_plane : float -> float -> int -> int -> Mesh.t
gen_mesh_plane width length res_x res_z
Generate plane mesh (with subdivisions)
val gen_mesh_cube : float -> float -> float -> Mesh.t
gen_mesh_cube width height length
Generate cuboid mesh
val gen_mesh_sphere : float -> int -> int -> Mesh.t
gen_mesh_sphere radius rings slices
Generate sphere mesh (standard sphere)
val gen_mesh_hemi_sphere : float -> int -> int -> Mesh.t
gen_mesh_hemi_sphere radius rings slices
Generate half-sphere mesh (no bottom cap)
val gen_mesh_cylinder : float -> float -> int -> Mesh.t
gen_mesh_cylinder radius height slices
Generate cylinder mesh
val gen_mesh_cone : float -> float -> int -> Mesh.t
gen_mesh_cone radius height slices
Generate cone/pyramid mesh
val gen_mesh_torus : float -> float -> int -> int -> Mesh.t
gen_mesh_torus radius size rad_seg sides
Generate torus mesh
val gen_mesh_knot : float -> float -> int -> int -> Mesh.t
gen_mesh_knot radius size rad_seg sides
Generate trefoil knot mesh
gen_mesh_heightmap heightmap size
Generate heightmap mesh from image data
gen_mesh_cubicmap cubicmap cube_size
Generate cubes-based map mesh from image data
val load_materials : string -> int ptr -> Material.t ptr
load_materials file_name material_count
Load materials from model file
val load_material_default : unit -> Material.t
load_material_default ()
Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
val unload_material : Material.t -> unit
unload_material material
Unload material from GPU memory (VRAM)
val set_material_texture :
Material.t ptr ->
MaterialMapIndex.t ->
Texture.t ->
unit
set_material_texture material map_type texture
Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
set_model_mesh_material model mesh_id material_id
Set material for a mesh
val load_model_animations : string -> ModelAnimation.t CArray.t
load_model_animations file_name anim_count
Load model animations from file
val update_model_animation : Model.t -> ModelAnimation.t -> int -> unit
update_model_animation model anim frame
Update model animation pose
val unload_model_animation : ModelAnimation.t -> unit
unload_model_animation anim
Unload animation data
val unload_model_animations : ModelAnimation.t CArray.t -> unit
unload_model_animations animations count
Unload animation array data
val is_model_animation_valid : Model.t -> ModelAnimation.t -> bool
is_model_animation_valid model anim
Check model animation skeleton match
check_collision_spheres center1 radius1 center2 radius2
Check collision between two spheres
val check_collision_boxes : BoundingBox.t -> BoundingBox.t -> bool
check_collision_boxes box1 box2
Check collision between two bounding boxes
val check_collision_box_sphere : BoundingBox.t -> Vector3.t -> float -> bool
check_collision_box_sphere box center radius
Check collision between box and sphere
val get_ray_collision_sphere : Ray.t -> Vector3.t -> float -> RayCollision.t
get_ray_collision_sphere ray center radius
Get collision info between ray and sphere
val get_ray_collision_box : Ray.t -> BoundingBox.t -> RayCollision.t
get_ray_collision_box ray box
Get collision info between ray and box
val get_ray_collision_mesh : Ray.t -> Mesh.t -> Matrix.t -> RayCollision.t
get_ray_collision_mesh ray mesh transform
Get collision info between ray and mesh
val get_ray_collision_triangle :
Ray.t ->
Vector3.t ->
Vector3.t ->
Vector3.t ->
RayCollision.t
get_ray_collision_triangle ray p1 p2 p3
Get collision info between ray and triangle
val get_ray_collision_quad :
Ray.t ->
Vector3.t ->
Vector3.t ->
Vector3.t ->
Vector3.t ->
RayCollision.t
get_ray_collision_quad ray p1 p2 p3 p4
Get collision info between ray and quad
Audio device management functions
init_audio_device ()
Initialize audio device and context
is_audio_device_ready ()
Check if audio device has been initialized successfully
val load_wave : string -> Wave.t
load_wave file_name
Load wave data from file
val load_wave_from_memory : string -> string -> int -> Wave.t
load_wave_from_memory file_type file_data data_size
Load wave from memory buffer, fileType refers to extension: i.e. ".wav"
val load_sound : string -> Sound.t
load_sound file_name
Load sound from file
update_sound sound data sample_count
Update sound buffer with new data
val unload_wave : Wave.t -> unit
unload_wave wave
Unload wave data
val unload_sound : Sound.t -> unit
unload_sound sound
Unload sound
val export_wave : Wave.t -> string -> bool
export_wave wave file_name
Export wave data to file, returns true on success
val export_wave_as_code : Wave.t -> string -> bool
export_wave_as_code wave file_name
Export wave sample data to code (.h), returns true on success
val play_sound : Sound.t -> unit
play_sound sound
Play a sound
val stop_sound : Sound.t -> unit
stop_sound sound
Stop playing a sound
val pause_sound : Sound.t -> unit
pause_sound sound
Pause a sound
val resume_sound : Sound.t -> unit
resume_sound sound
Resume a paused sound
val play_sound_multi : Sound.t -> unit
play_sound_multi sound
Play a sound (using multichannel buffer pool)
stop_sound_multi ()
Stop any sound playing (using multichannel buffer pool)
get_sounds_playing ()
Get number of sounds playing in the multichannel
val is_sound_playing : Sound.t -> bool
is_sound_playing sound
Check if a sound is currently playing
val set_sound_volume : Sound.t -> float -> unit
set_sound_volume sound volume
Set volume for a sound (1.0 is max level)
val set_sound_pitch : Sound.t -> float -> unit
set_sound_pitch sound pitch
Set pitch for a sound (1.0 is base level)
val set_sound_pan : Sound.t -> float -> unit
set_sound_pan sound pan
Set pan for a sound (0.5 is center)
wave_crop wave init_sample final_sample
Crop a wave to defined samples range
wave_format wave sample_rate sample_size channels
Convert wave data to desired format
load_wave_samples wave
Load samples data from wave as a floats array
val unload_wave_samples : float ptr -> unit
unload_wave_samples samples
Unload samples data loaded with LoadWaveSamples()
val load_music_stream : string -> Music.t
load_music_stream file_name
Load music stream from file
val load_music_stream_from_memory : string -> string -> int -> Music.t
load_music_stream_from_memory file_type data data_size
Load music stream from data
val unload_music_stream : Music.t -> unit
unload_music_stream music
Unload music stream
val play_music_stream : Music.t -> unit
play_music_stream music
Start music playing
val is_music_stream_playing : Music.t -> bool
is_music_stream_playing music
Check if music is playing
val update_music_stream : Music.t -> unit
update_music_stream music
Updates buffers for music streaming
val stop_music_stream : Music.t -> unit
stop_music_stream music
Stop music playing
val pause_music_stream : Music.t -> unit
pause_music_stream music
Pause music playing
val resume_music_stream : Music.t -> unit
resume_music_stream music
Resume playing paused music
val seek_music_stream : Music.t -> float -> unit
seek_music_stream music position
Seek music to a position (in seconds)
val set_music_volume : Music.t -> float -> unit
set_music_volume music volume
Set volume for music (1.0 is max level)
val set_music_pitch : Music.t -> float -> unit
set_music_pitch music pitch
Set pitch for a music (1.0 is base level)
val set_music_pan : Music.t -> float -> unit
set_music_pan music pan
Set pan for a music (0.5 is center)
val get_music_time_length : Music.t -> float
get_music_time_length music
Get music time length (in seconds)
val get_music_time_played : Music.t -> float
get_music_time_played music
Get current music time played (in seconds)
val load_audio_stream : int -> int -> int -> AudioStream.t
load_audio_stream sample_rate sample_size channels
Load audio stream (to stream raw audio pcm data)
val unload_audio_stream : AudioStream.t -> unit
unload_audio_stream stream
Unload audio stream and free memory
val update_audio_stream : AudioStream.t -> unit ptr -> int -> unit
update_audio_stream stream data frame_count
Update audio stream buffers with data
val is_audio_stream_processed : AudioStream.t -> bool
is_audio_stream_processed stream
Check if any audio stream buffers requires refill
val play_audio_stream : AudioStream.t -> unit
play_audio_stream stream
Play audio stream
val pause_audio_stream : AudioStream.t -> unit
pause_audio_stream stream
Pause audio stream
val resume_audio_stream : AudioStream.t -> unit
resume_audio_stream stream
Resume audio stream
val is_audio_stream_playing : AudioStream.t -> bool
is_audio_stream_playing stream
Check if audio stream is playing
val stop_audio_stream : AudioStream.t -> unit
stop_audio_stream stream
Stop audio stream
val set_audio_stream_volume : AudioStream.t -> float -> unit
set_audio_stream_volume stream volume
Set volume for audio stream (1.0 is max level)
val set_audio_stream_pitch : AudioStream.t -> float -> unit
set_audio_stream_pitch stream pitch
Set pitch for audio stream (1.0 is base level)
val set_audio_stream_pan : AudioStream.t -> float -> unit
set_audio_stream_pan steam pan
Set pan for audio stream (0.5 is centered)
set_audio_stream_buffer_size_default size
Default size for new audio streams
module Rlgl : sig ... end