Rayex.Core (Rayex v0.0.2) View Source

Main functions

Link to this section Summary

Functions

Setup canvas (framebuffer) to start drawing

Begin 2D mode with custom camera (2D)

Begin 3D mode with custom camera (3D)

Set background color (framebuffer clear color)

Clear window configuration state flags

Close window and unload OpenGL context

End canvas drawing and swap buffers (double buffering)

Ends 2D mode with custom camera

Ends 3D mode and returns to default 2D orthographic mode

Get current FPS

Get time in seconds for last frame drawn (delta time)

Get mouse position XY

Get a ray trace from mouse position

Get elapsed time in seconds since init_window/0

Initialize window and OpenGL context

Check if a mouse button is being pressed

Check if a mouse button has been pressed once

Check if a mouse button has been released once

Check if a mouse button is NOT being pressed

Set camera alt key to combine with mouse movement (free camera)

Set camera mode (multiple camera modes available)

Set camera move controls (1st person and 3rd person cameras)

Set camera pan key to combine with mouse movement (free camera)

Set camera smooth zoom key to combine with mouse (free camera)

Set target FPS (maximum)

Set window configuration state using flags

Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)

Update camera position for selected mode

Check if window is currently focused (only PLATFORM_DESKTOP)

Check if window is currently fullscreen

Check if window is currently hidden (only PLATFORM_DESKTOP)

Check if window is currently maximized (only PLATFORM_DESKTOP)

Check if window is currently minimized (only PLATFORM_DESKTOP)

Check if window has been initialized successfully

Check if window has been resized last frame

Check if KEY_ESCAPE pressed or Close icon pressed

Check if one specific window flag is enabled

Link to this section Functions

Specs

begin_drawing() :: :ok

Setup canvas (framebuffer) to start drawing

Link to this function

begin_mode_2d(camera_2d)

View Source

Specs

begin_mode_2d(Rayex.Structs.Camera2D.t()) :: :ok

Begin 2D mode with custom camera (2D)

Link to this function

begin_mode_3d(camera_3d)

View Source

Specs

begin_mode_3d(Rayex.Structs.Camera3D.t()) :: :ok

Begin 3D mode with custom camera (3D)

Specs

clear_background(Rayex.Structs.Color.t()) :: :ok

Set background color (framebuffer clear color)

Link to this function

clear_window_state(flag)

View Source

Specs

clear_window_state(non_neg_integer()) :: :ok

Clear window configuration state flags

Specs

close_window() :: :ok

Close window and unload OpenGL context

Specs

end_drawing() :: :ok

End canvas drawing and swap buffers (double buffering)

Specs

end_mode_2d() :: :ok

Ends 2D mode with custom camera

Specs

end_mode_3d() :: :ok

Ends 3D mode and returns to default 2D orthographic mode

Specs

get_fps() :: non_neg_integer()

Get current FPS

Specs

get_frame_time() :: float()

Get time in seconds for last frame drawn (delta time)

Specs

get_mouse_position() :: Rayex.Structs.Vector2.t()

Get mouse position XY

Link to this function

get_mouse_ray(mouse_position, camera)

View Source

Specs

Get a ray trace from mouse position

Specs

get_time() :: float()

Get elapsed time in seconds since init_window/0

Link to this function

init_window(width, height, title)

View Source

Specs

init_window(integer(), integer(), String.t()) :: :ok

Initialize window and OpenGL context

Link to this function

mouse_button_down?(button)

View Source

Specs

mouse_button_down?(integer()) :: boolean()

Check if a mouse button is being pressed

Link to this function

mouse_button_pressed?(button)

View Source

Specs

mouse_button_pressed?(integer()) :: boolean()

Check if a mouse button has been pressed once

Link to this function

mouse_button_released?(button)

View Source

Specs

mouse_button_released?(integer()) :: boolean()

Check if a mouse button has been released once

Link to this function

mouse_button_up?(button)

View Source

Specs

mouse_button_up?(integer()) :: boolean()

Check if a mouse button is NOT being pressed

Link to this function

set_camera_alt_control(key_alt)

View Source

Specs

set_camera_alt_control(integer()) :: :ok

Set camera alt key to combine with mouse movement (free camera)

Link to this function

set_camera_mode(camera_3d, mode)

View Source

Specs

set_camera_mode(Rayex.Structs.Camera3D.t(), integer()) :: integer()

Set camera mode (multiple camera modes available)

Link to this function

set_camera_move_controls(key_front, key_back, key_right, key_left, key_up, key_down)

View Source

Specs

set_camera_move_controls(
  integer(),
  integer(),
  integer(),
  integer(),
  integer(),
  integer()
) :: :ok

Set camera move controls (1st person and 3rd person cameras)

Link to this function

set_camera_pan_control(key_pan)

View Source

Specs

set_camera_pan_control(integer()) :: :ok

Set camera pan key to combine with mouse movement (free camera)

Link to this function

set_camera_smooth_zoom_control(key_smooth_zoom)

View Source

Specs

set_camera_smooth_zoom_control(integer()) :: :ok

Set camera smooth zoom key to combine with mouse (free camera)

Specs

set_target_fps(non_neg_integer()) :: :ok

Set target FPS (maximum)

Specs

set_window_state(non_neg_integer()) :: :ok

Set window configuration state using flags

Specs

toggle_fullscreen() :: :ok

Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)

Link to this function

update_camera(camera_3d)

View Source

Specs

Update camera position for selected mode

Specs

window_focused?() :: boolean()

Check if window is currently focused (only PLATFORM_DESKTOP)

Specs

window_fullscreen?() :: boolean()

Check if window is currently fullscreen

Specs

window_hidden?() :: boolean()

Check if window is currently hidden (only PLATFORM_DESKTOP)

Specs

window_maximized?() :: boolean()

Check if window is currently maximized (only PLATFORM_DESKTOP)

Specs

window_minimized?() :: boolean()

Check if window is currently minimized (only PLATFORM_DESKTOP)

Specs

window_ready?() :: boolean()

Check if window has been initialized successfully

Specs

window_resized?() :: boolean()

Check if window has been resized last frame

Specs

window_should_close() :: boolean()

Check if KEY_ESCAPE pressed or Close icon pressed

Specs

window_state?(non_neg_integer()) :: boolean()

Check if one specific window flag is enabled