pub struct RaylibDrawHandle<'a>(/* private fields */);Methods from Deref<Target = RaylibHandle>§
pub fn load_automation_event_list( &self, file_name: Option<PathBuf>, ) -> AutomationEventList
pub fn set_automation_event_list(&self, l: &mut AutomationEventList)
pub fn set_automation_event_base_frame(&self, b: i32)
pub fn start_automation_event_recording(&self)
pub fn stop_automation_event_recording(&self)
Sourcepub fn set_trace_log_callback(
&mut self,
cb: fn(TraceLogLevel, &str),
) -> Result<(), SetLogError<'_>>
👎Deprecated: Decoupled from RaylibHandle. Use set_trace_log_callback instead.
pub fn set_trace_log_callback( &mut self, cb: fn(TraceLogLevel, &str), ) -> Result<(), SetLogError<'_>>
Set custom trace log
Sourcepub fn set_save_file_data_callback(
&mut self,
cb: fn(&str, &[u8]) -> bool,
) -> Result<(), SetLogError<'_>>
👎Deprecated: Decoupled from RaylibHandle. Use set_save_file_data_callback instead.
pub fn set_save_file_data_callback( &mut self, cb: fn(&str, &[u8]) -> bool, ) -> Result<(), SetLogError<'_>>
Set custom file binary data saver
Sourcepub fn set_load_file_data_callback<'b>(
&mut self,
cb: fn(&str) -> Vec<u8>,
) -> Result<(), SetLogError<'_>>
👎Deprecated: Decoupled from RaylibHandle. Use set_load_file_data_callback instead.
pub fn set_load_file_data_callback<'b>( &mut self, cb: fn(&str) -> Vec<u8>, ) -> Result<(), SetLogError<'_>>
Set custom file binary data loader
Whatever you return from your callback will be intentionally leaked as Raylib is relied on to free it.
Sourcepub fn set_save_file_text_callback(
&mut self,
cb: fn(&str, &str) -> bool,
) -> Result<(), SetLogError<'_>>
👎Deprecated: Decoupled from RaylibHandle. Use set_save_file_text_callback instead.
pub fn set_save_file_text_callback( &mut self, cb: fn(&str, &str) -> bool, ) -> Result<(), SetLogError<'_>>
Set custom file text data saver
Sourcepub fn set_load_file_text_callback(
&mut self,
cb: fn(&str) -> String,
) -> Result<(), SetLogError<'_>>
👎Deprecated: Decoupled from RaylibHandle. Use set_load_file_text_callback instead.
pub fn set_load_file_text_callback( &mut self, cb: fn(&str) -> String, ) -> Result<(), SetLogError<'_>>
Set custom file text data loader
Whatever you return from your callback will be intentionally leaked as Raylib is relied on to free it.
Sourcepub fn set_audio_stream_callback(
&mut self,
stream: AudioStream<'_>,
cb: fn(&[u8]),
) -> Result<(), SetLogError<'_>>
👎Deprecated: Decoupled from RaylibHandle. Use set_audio_stream_callback instead.
pub fn set_audio_stream_callback( &mut self, stream: AudioStream<'_>, cb: fn(&[u8]), ) -> Result<(), SetLogError<'_>>
Audio thread callback to request new data
Sourcepub fn update_camera(&self, camera: &mut Camera3D, mode: CameraMode)
pub fn update_camera(&self, camera: &mut Camera3D, mode: CameraMode)
Updates camera position for selected mode.
pub fn update_camera_pro( &self, camera: &mut Camera3D, movement: Vector3, rotation: Vector3, zoom: f32, )
Sourcepub fn begin_drawing(&mut self, _: &RaylibThread) -> RaylibDrawHandle<'_>
pub fn begin_drawing(&mut self, _: &RaylibThread) -> RaylibDrawHandle<'_>
Setup canvas (framebuffer) to start drawing. Prefer using the closure version, RaylibHandle::draw. This version returns a handle that calls raylib_sys::EndDrawing at the end of the scope and is provided as a fallback incase you run into issues with closures(such as lifetime or performance reasons)
pub fn draw(&mut self, _: &RaylibThread, func: impl FnMut(RaylibDrawHandle<'_>))
Sourcepub fn is_file_dropped(&self) -> bool
pub fn is_file_dropped(&self) -> bool
Checks if a file has been dropped into the window.
Sourcepub fn is_file_extension<A>(&self, file_name: A, file_ext: A) -> bool
pub fn is_file_extension<A>(&self, file_name: A, file_ext: A) -> bool
Checks a file’s extension.
Sourcepub fn application_directory(&self) -> String
pub fn application_directory(&self) -> String
Get the directory of the running application.
Sourcepub fn get_file_length<A>(&self, filename: A) -> i32
pub fn get_file_length<A>(&self, filename: A) -> i32
Get file length in bytes.
§Errors
This function will return an error if the supplied bytes contain an internal 0 byte. The NulError returned will contain the bytes as well as the position of the nul byte.
Sourcepub fn is_path_file<A>(&self, filename: A) -> bool
pub fn is_path_file<A>(&self, filename: A) -> bool
Check if a given path is a file or a directory
§Errors
This function will return an error if the supplied bytes contain an internal 0 byte. The NulError returned will contain the bytes as well as the position of the nul byte.
Sourcepub fn load_directory_files<A>(&self, dir_path: A) -> FilePathList
pub fn load_directory_files<A>(&self, dir_path: A) -> FilePathList
Load directory filepaths
Sourcepub fn load_directory_files_ex<A>(
&self,
dir_path: A,
filter: String,
scan_sub_dirs: bool,
) -> FilePathList
pub fn load_directory_files_ex<A>( &self, dir_path: A, filter: String, scan_sub_dirs: bool, ) -> FilePathList
Load directory filepaths with extension filtering and recursive directory scan
Sourcepub fn load_dropped_files(&self) -> DroppedFilePathList
pub fn load_dropped_files(&self) -> DroppedFilePathList
Check if a file has been dropped into window
Sourcepub fn is_key_pressed(&self, key: KeyboardKey) -> bool
pub fn is_key_pressed(&self, key: KeyboardKey) -> bool
Detect if a key has been pressed once.
Sourcepub fn is_key_pressed_repeat(&self, key: KeyboardKey) -> bool
pub fn is_key_pressed_repeat(&self, key: KeyboardKey) -> bool
Check if a key has been pressed again
Sourcepub fn is_key_down(&self, key: KeyboardKey) -> bool
pub fn is_key_down(&self, key: KeyboardKey) -> bool
Detect if a key is being pressed.
Sourcepub fn is_key_released(&self, key: KeyboardKey) -> bool
pub fn is_key_released(&self, key: KeyboardKey) -> bool
Detect if a key has been released once.
Sourcepub fn is_key_up(&self, key: KeyboardKey) -> bool
pub fn is_key_up(&self, key: KeyboardKey) -> bool
Detect if a key is NOT being pressed.
Sourcepub fn get_key_pressed(&mut self) -> Option<KeyboardKey>
pub fn get_key_pressed(&mut self) -> Option<KeyboardKey>
Gets latest key pressed.
Sourcepub fn get_key_pressed_number(&mut self) -> Option<u32>
pub fn get_key_pressed_number(&mut self) -> Option<u32>
Gets latest key pressed.
Sourcepub fn get_char_pressed(&mut self) -> Option<char>
pub fn get_char_pressed(&mut self) -> Option<char>
Gets latest char (unicode) pressed
Sourcepub fn set_exit_key(&mut self, key: Option<KeyboardKey>)
pub fn set_exit_key(&mut self, key: Option<KeyboardKey>)
Sets a custom key to exit program (default is ESC).
Sourcepub fn is_gamepad_available(&self, gamepad: i32) -> bool
pub fn is_gamepad_available(&self, gamepad: i32) -> bool
Detect if a gamepad is available.
Sourcepub fn get_gamepad_name(&self, gamepad: i32) -> Option<String>
pub fn get_gamepad_name(&self, gamepad: i32) -> Option<String>
Returns gamepad internal name id.
Detect if a gamepad button has been pressed once.
Detect if a gamepad button is being pressed.
Detect if a gamepad button has been released once.
Detect if a gamepad button is NOT being pressed.
Gets the last gamepad button pressed.
Sourcepub fn get_gamepad_axis_count(&self, gamepad: i32) -> i32
pub fn get_gamepad_axis_count(&self, gamepad: i32) -> i32
Returns gamepad axis count for a gamepad.
Sourcepub fn get_gamepad_axis_movement(&self, gamepad: i32, axis: GamepadAxis) -> f32
pub fn get_gamepad_axis_movement(&self, gamepad: i32, axis: GamepadAxis) -> f32
Returns axis movement value for a gamepad axis.
Detect if a mouse button has been pressed once.
Detect if a mouse button is being pressed.
Detect if a mouse button has been released once.
Detect if a mouse button is NOT being pressed.
Sourcepub fn get_mouse_x(&self) -> i32
pub fn get_mouse_x(&self) -> i32
Returns mouse position X.
Sourcepub fn get_mouse_y(&self) -> i32
pub fn get_mouse_y(&self) -> i32
Returns mouse position Y.
Sourcepub fn get_mouse_position(&self) -> Vector2
pub fn get_mouse_position(&self) -> Vector2
Returns mouse position.
Sourcepub fn get_mouse_delta(&self) -> Vector2
pub fn get_mouse_delta(&self) -> Vector2
Returns mouse delta between frames.
Sourcepub fn set_mouse_position(&mut self, position: impl Into<Vector2>)
pub fn set_mouse_position(&mut self, position: impl Into<Vector2>)
Sets mouse position.
Sourcepub fn set_mouse_offset(&mut self, offset: impl Into<Vector2>)
pub fn set_mouse_offset(&mut self, offset: impl Into<Vector2>)
Sets mouse offset.
Sourcepub fn set_mouse_scale(&mut self, scale_x: f32, scale_y: f32)
pub fn set_mouse_scale(&mut self, scale_x: f32, scale_y: f32)
Sets mouse scaling.
Sourcepub fn get_mouse_wheel_move(&self) -> f32
pub fn get_mouse_wheel_move(&self) -> f32
Get mouse wheel movement for X or Y, whichever is larger
Sourcepub fn get_mouse_wheel_move_v(&self) -> Vector2
pub fn get_mouse_wheel_move_v(&self) -> Vector2
Get mouse wheel movement for both X and Y
Sourcepub fn get_touch_x(&self) -> i32
pub fn get_touch_x(&self) -> i32
Returns touch position X for touch point 0 (relative to screen size).
Sourcepub fn get_touch_y(&self) -> i32
pub fn get_touch_y(&self) -> i32
Returns touch position Y for touch point 0 (relative to screen size).
Sourcepub fn get_touch_position(&self, index: u32) -> Vector2
pub fn get_touch_position(&self, index: u32) -> Vector2
Returns touch position XY for a touch point index (relative to screen size).
Sourcepub fn set_gestures_enabled(&self, gesture_flags: u32)
pub fn set_gestures_enabled(&self, gesture_flags: u32)
Enables a set of gestures using flags.
Sourcepub fn set_gamepad_mappings(&self, bind: &[c_char]) -> i32
pub fn set_gamepad_mappings(&self, bind: &[c_char]) -> i32
Set internal gamepad mappings (SDL_GameControllerDB)
Sourcepub fn set_gamepad_vibration(
&mut self,
gamepad: i32,
left_motor: f32,
right_motor: f32,
duration: f32,
)
pub fn set_gamepad_vibration( &mut self, gamepad: i32, left_motor: f32, right_motor: f32, duration: f32, )
Set gamepad vibration for both motors
Sourcepub fn is_gesture_detected(&self, gesture: Gesture) -> bool
pub fn is_gesture_detected(&self, gesture: Gesture) -> bool
Checks if a gesture have been detected.
Sourcepub fn get_gesture_detected(&self) -> Gesture
pub fn get_gesture_detected(&self) -> Gesture
Gets latest detected gesture.
Sourcepub fn get_touch_point_id(&self, index: u32) -> i32
pub fn get_touch_point_id(&self, index: u32) -> i32
Get touch point identifier for given index
Sourcepub fn get_touch_point_count(&self) -> u32
pub fn get_touch_point_count(&self) -> u32
Gets touch points count.
Sourcepub fn get_gesture_hold_duration(&self) -> f32
pub fn get_gesture_hold_duration(&self) -> f32
Gets gesture hold time in milliseconds.
Sourcepub fn get_gesture_drag_vector(&self) -> Vector2
pub fn get_gesture_drag_vector(&self) -> Vector2
Gets gesture drag vector.
Sourcepub fn get_gesture_drag_angle(&self) -> f32
pub fn get_gesture_drag_angle(&self) -> f32
Gets gesture drag angle.
Sourcepub fn get_gesture_pinch_vector(&self) -> Vector2
pub fn get_gesture_pinch_vector(&self) -> Vector2
Gets gesture pinch delta.
Sourcepub fn get_gesture_pinch_angle(&self) -> f32
pub fn get_gesture_pinch_angle(&self) -> f32
Gets gesture pinch angle.
Sourcepub fn set_trace_log(&self, types: TraceLogLevel)
pub fn set_trace_log(&self, types: TraceLogLevel)
Set the current threshold (minimum) log level
Sourcepub fn trace_log(&self, msg_type: TraceLogLevel, text: &str)
pub fn trace_log(&self, msg_type: TraceLogLevel, text: &str)
Writes a trace log message (Log::INFO, Log::WARNING, Log::ERROR, Log::DEBUG).
Sourcepub fn load_random_sequence<'a>(
&self,
num: Range<i32>,
count: u32,
) -> RandomSequence<'a>
pub fn load_random_sequence<'a>( &self, num: Range<i32>, count: u32, ) -> RandomSequence<'a>
Load random values sequence, no values repeated
Sourcepub fn load_image_from_screen(&self, _: &RaylibThread) -> Image
pub fn load_image_from_screen(&self, _: &RaylibThread) -> Image
Load pixels from the screen into a CPU image
Sourcepub fn take_screenshot(&mut self, _: &RaylibThread, filename: &str)
pub fn take_screenshot(&mut self, _: &RaylibThread, filename: &str)
Takes a screenshot of current screen (saved a .png)
Sourcepub fn get_random_value<T: From<i32>>(&self, num: Range<i32>) -> T
pub fn get_random_value<T: From<i32>>(&self, num: Range<i32>) -> T
Returns a random value between min and max (both included)
use raylib::*;
fn main() {
let (mut rl, thread) = ...;
let r = rl.get_random_value(0, 10);
println!("random value: {}", r);
}Sourcepub fn set_random_seed(&mut self, seed: u32)
pub fn set_random_seed(&mut self, seed: u32)
Set the seed for random number generation
Sourcepub fn load_model(
&mut self,
_: &RaylibThread,
filename: &str,
) -> Result<Model, Error>
pub fn load_model( &mut self, _: &RaylibThread, filename: &str, ) -> Result<Model, Error>
Loads model from files (mesh and material).
pub fn load_model_from_mesh( &mut self, _: &RaylibThread, mesh: WeakMesh, ) -> Result<Model, Error>
pub fn load_model_animations( &mut self, _: &RaylibThread, filename: &str, ) -> Result<Vec<ModelAnimation>, Error>
pub fn update_model_animation( &mut self, _: &RaylibThread, model: impl AsMut<Model>, anim: impl AsRef<ModelAnimation>, frame: i32, )
pub fn update_model_animation_bones( &mut self, _: &RaylibThread, model: impl AsMut<Model>, anim: impl AsRef<ModelAnimation>, frame: i32, )
pub fn load_material_default(&self, _: &RaylibThread) -> WeakMaterial
Sourcepub unsafe fn unload_material(
&mut self,
_: &RaylibThread,
material: WeakMaterial,
)
pub unsafe fn unload_material( &mut self, _: &RaylibThread, material: WeakMaterial, )
Weak materials will leak memeory if they are not unlaoded Unload material from GPU memory (VRAM)
Sourcepub unsafe fn unload_model(&mut self, _: &RaylibThread, model: WeakModel)
pub unsafe fn unload_model(&mut self, _: &RaylibThread, model: WeakModel)
Weak models will leak memeory if they are not unlaoded Unload model from GPU memory (VRAM)
Sourcepub unsafe fn unload_model_animation(
&mut self,
_: &RaylibThread,
model_animation: WeakModelAnimation,
)
pub unsafe fn unload_model_animation( &mut self, _: &RaylibThread, model_animation: WeakModelAnimation, )
Weak model_animations will leak memeory if they are not unlaoded Unload model_animation from GPU memory (VRAM)
Sourcepub unsafe fn unload_mesh(&mut self, _: &RaylibThread, mesh: WeakMesh)
pub unsafe fn unload_mesh(&mut self, _: &RaylibThread, mesh: WeakMesh)
Weak meshs will leak memeory if they are not unlaoded Unload mesh from GPU memory (VRAM)
Sourcepub fn load_shader(
&mut self,
_: &RaylibThread,
vs_filename: Option<&str>,
fs_filename: Option<&str>,
) -> Shader
pub fn load_shader( &mut self, _: &RaylibThread, vs_filename: Option<&str>, fs_filename: Option<&str>, ) -> Shader
Loads a custom shader and binds default locations.
Sourcepub fn load_shader_from_memory(
&mut self,
_: &RaylibThread,
vs_code: Option<&str>,
fs_code: Option<&str>,
) -> Shader
pub fn load_shader_from_memory( &mut self, _: &RaylibThread, vs_code: Option<&str>, fs_code: Option<&str>, ) -> Shader
Loads shader from code strings and binds default locations.
pub fn unload_font(&mut self, font: WeakFont)
Sourcepub fn load_font(
&mut self,
_: &RaylibThread,
filename: &str,
) -> Result<Font, Error>
pub fn load_font( &mut self, _: &RaylibThread, filename: &str, ) -> Result<Font, Error>
Loads font from file into GPU memory (VRAM).
Sourcepub fn load_font_ex(
&mut self,
_: &RaylibThread,
filename: &str,
font_size: i32,
chars: Option<&str>,
) -> Result<Font, Error>
pub fn load_font_ex( &mut self, _: &RaylibThread, filename: &str, font_size: i32, chars: Option<&str>, ) -> Result<Font, Error>
Loads font from file with extended parameters. Supplying None for chars loads the entire character set.
Sourcepub fn load_font_from_image(
&mut self,
_: &RaylibThread,
image: &Image,
key: impl Into<Color>,
first_char: i32,
) -> Result<Font, Error>
pub fn load_font_from_image( &mut self, _: &RaylibThread, image: &Image, key: impl Into<Color>, first_char: i32, ) -> Result<Font, Error>
Load font from Image (XNA style)
Sourcepub fn load_font_from_memory(
&mut self,
_: &RaylibThread,
file_type: &str,
file_data: &[u8],
font_size: i32,
chars: Option<&str>,
) -> Result<Font, Error>
pub fn load_font_from_memory( &mut self, _: &RaylibThread, file_type: &str, file_data: &[u8], font_size: i32, chars: Option<&str>, ) -> Result<Font, Error>
Load font data from a given memory buffer.
file_type refers to the extension, e.g. “.ttf”.
You can pass Some(…) to chars to get the desired charaters, or None to get the whole set.
Sourcepub fn load_font_data(
&mut self,
data: &[u8],
font_size: i32,
chars: Option<&str>,
sdf: i32,
) -> Option<RSliceGlyphInfo>
pub fn load_font_data( &mut self, data: &[u8], font_size: i32, chars: Option<&str>, sdf: i32, ) -> Option<RSliceGlyphInfo>
Loads font data for further use (see also Font::from_data).
Now supports .tiff
Sourcepub fn get_font_default(&self) -> WeakFont
pub fn get_font_default(&self) -> WeakFont
Gets the default font.
Sourcepub fn measure_text(&self, text: &str, font_size: i32) -> i32
pub fn measure_text(&self, text: &str, font_size: i32) -> i32
Measures string width in pixels for default font.
pub fn set_text_line_spacing(&self, spacing: i32)
Sourcepub fn load_texture(
&mut self,
_: &RaylibThread,
filename: &str,
) -> Result<Texture2D, Error>
pub fn load_texture( &mut self, _: &RaylibThread, filename: &str, ) -> Result<Texture2D, Error>
Loads texture from file into GPU memory (VRAM).
Sourcepub fn load_texture_cubemap(
&mut self,
_: &RaylibThread,
image: &Image,
layout: CubemapLayout,
) -> Result<Texture2D, Error>
pub fn load_texture_cubemap( &mut self, _: &RaylibThread, image: &Image, layout: CubemapLayout, ) -> Result<Texture2D, Error>
Load cubemap from image, multiple image cubemap layouts supported
Sourcepub fn load_texture_from_image(
&mut self,
_: &RaylibThread,
image: &Image,
) -> Result<Texture2D, Error>
pub fn load_texture_from_image( &mut self, _: &RaylibThread, image: &Image, ) -> Result<Texture2D, Error>
Loads texture from image data.
Sourcepub fn load_render_texture(
&mut self,
_: &RaylibThread,
width: u32,
height: u32,
) -> Result<RenderTexture2D, Error>
pub fn load_render_texture( &mut self, _: &RaylibThread, width: u32, height: u32, ) -> Result<RenderTexture2D, Error>
Loads texture for rendering (framebuffer).
Sourcepub unsafe fn unload_texture(
&mut self,
_: &RaylibThread,
texture: WeakTexture2D,
)
pub unsafe fn unload_texture( &mut self, _: &RaylibThread, texture: WeakTexture2D, )
Weak Textures will leak memeory if they are not unlaoded Unload textures from GPU memory (VRAM)
Sourcepub unsafe fn unload_render_texture(
&mut self,
_: &RaylibThread,
texture: WeakRenderTexture2D,
)
pub unsafe fn unload_render_texture( &mut self, _: &RaylibThread, texture: WeakRenderTexture2D, )
Weak RenderTextures will leak memeory if they are not unlaoded Unload RenderTextures from GPU memory (VRAM)
pub fn load_vr_stereo_config( &mut self, _: &RaylibThread, device: impl Into<VrDeviceInfo>, ) -> VrStereoConfig
Sourcepub fn get_clipboard_text(&self) -> Result<String, Utf8Error>
pub fn get_clipboard_text(&self) -> Result<String, Utf8Error>
Get clipboard text content
Sourcepub fn set_clipboard_text(&mut self, text: &str) -> Result<(), NulError>
pub fn set_clipboard_text(&mut self, text: &str) -> Result<(), NulError>
Set clipboard text content
Sourcepub fn get_screen_to_world_ray(
&self,
mouse_position: impl Into<Vector2>,
camera: impl Into<Camera>,
) -> Ray
pub fn get_screen_to_world_ray( &self, mouse_position: impl Into<Vector2>, camera: impl Into<Camera>, ) -> Ray
Get a ray trace from screen position (i.e mouse)
Sourcepub fn get_screen_to_world_ray_ex(
&self,
mouse_position: impl Into<Vector2>,
camera: impl Into<Camera>,
width: i32,
height: i32,
) -> Ray
pub fn get_screen_to_world_ray_ex( &self, mouse_position: impl Into<Vector2>, camera: impl Into<Camera>, width: i32, height: i32, ) -> Ray
Get a ray trace from screen position (i.e mouse) in a viewport
Sourcepub fn get_world_to_screen(
&self,
position: impl Into<Vector3>,
camera: impl Into<Camera>,
) -> Vector2
pub fn get_world_to_screen( &self, position: impl Into<Vector3>, camera: impl Into<Camera>, ) -> Vector2
Returns the screen space position for a 3d world space position
Sourcepub fn get_world_to_screen2D(
&self,
position: impl Into<Vector2>,
camera: impl Into<Camera2D>,
) -> Vector2
pub fn get_world_to_screen2D( &self, position: impl Into<Vector2>, camera: impl Into<Camera2D>, ) -> Vector2
Returns the screen space position for a 2d camera world space position
Sourcepub fn get_world_to_screen_ex(
&self,
position: impl Into<Vector3>,
camera: impl Into<Camera>,
width: i32,
height: i32,
) -> Vector2
pub fn get_world_to_screen_ex( &self, position: impl Into<Vector3>, camera: impl Into<Camera>, width: i32, height: i32, ) -> Vector2
Returns size position for a 3d world space position
Sourcepub fn get_screen_to_world2D(
&self,
position: impl Into<Vector2>,
camera: impl Into<Camera2D>,
) -> Vector2
pub fn get_screen_to_world2D( &self, position: impl Into<Vector2>, camera: impl Into<Camera2D>, ) -> Vector2
Returns the world space position for a 2d camera screen space position
Sourcepub fn set_target_fps(&mut self, fps: u32)
pub fn set_target_fps(&mut self, fps: u32)
Set target FPS (maximum)
Sourcepub fn get_frame_time(&self) -> f32
pub fn get_frame_time(&self) -> f32
Returns time in seconds for last frame drawn
Sourcepub fn window_should_close(&self) -> bool
pub fn window_should_close(&self) -> bool
Checks if KEY_ESCAPE or Close icon was pressed.
Do not call on web unless you are compiling with asyncify.
Sourcepub fn is_window_ready(&self) -> bool
pub fn is_window_ready(&self) -> bool
Checks if window has been initialized successfully.
Sourcepub fn maximize_window(&mut self)
pub fn maximize_window(&mut self)
Set window state: maximized, if resizable
Sourcepub fn minimize_window(&mut self)
pub fn minimize_window(&mut self)
Set window state: minimized, if resizable
Sourcepub fn restore_window(&mut self)
pub fn restore_window(&mut self)
Set window state: not minimized/maximized
Sourcepub fn is_window_maximized(&self) -> bool
pub fn is_window_maximized(&self) -> bool
Check if window is currently maximized
Sourcepub fn is_window_minimized(&self) -> bool
pub fn is_window_minimized(&self) -> bool
Checks if window has been minimized (or lost focus).
Sourcepub fn is_window_resized(&self) -> bool
pub fn is_window_resized(&self) -> bool
Checks if window has been resized.
Checks if window has been hidden.
Sourcepub fn is_window_fullscreen(&self) -> bool
pub fn is_window_fullscreen(&self) -> bool
Returns whether or not window is in fullscreen mode
pub fn is_window_focused(&self) -> bool
Sourcepub fn get_window_scale_dpi(&self) -> Vector2
pub fn get_window_scale_dpi(&self) -> Vector2
Check if window is currently focused (only PLATFORM_DESKTOP)
Sourcepub fn is_cursor_on_screen(&self) -> bool
pub fn is_cursor_on_screen(&self) -> bool
Check if cursor is on the current screen.
Sourcepub fn set_mouse_cursor(&self, cursor: MouseCursor)
pub fn set_mouse_cursor(&self, cursor: MouseCursor)
Set mouse cursor
Sourcepub fn toggle_fullscreen(&mut self)
pub fn toggle_fullscreen(&mut self)
Toggles fullscreen mode (only on desktop platforms).
Sourcepub fn set_window_state(&mut self, state: WindowState)
pub fn set_window_state(&mut self, state: WindowState)
Set window configuration state using flags
Sourcepub fn clear_window_state(&mut self, state: WindowState)
pub fn clear_window_state(&mut self, state: WindowState)
Clear window configuration state flags
Sourcepub fn get_window_state(&self) -> WindowState
pub fn get_window_state(&self) -> WindowState
Get the window config state
Sourcepub fn set_window_icon(&mut self, image: impl AsRef<Image>)
pub fn set_window_icon(&mut self, image: impl AsRef<Image>)
Sets icon for window (only on desktop platforms).
pub fn set_window_icons(&mut self, images: &mut [Image])
Sourcepub fn set_window_title(&self, _: &RaylibThread, title: &str)
pub fn set_window_title(&self, _: &RaylibThread, title: &str)
Sets title for window (only on desktop platforms).
Sourcepub fn set_window_position(&mut self, x: i32, y: i32)
pub fn set_window_position(&mut self, x: i32, y: i32)
Sets window position on screen (only on desktop platforms).
Sourcepub fn set_window_monitor(&mut self, monitor: i32)
pub fn set_window_monitor(&mut self, monitor: i32)
Sets monitor for the current window (fullscreen mode).
Sourcepub fn set_window_min_size(&mut self, width: i32, height: i32)
pub fn set_window_min_size(&mut self, width: i32, height: i32)
Sets minimum window dimensions (for FLAG_WINDOW_RESIZABLE).
Sourcepub fn set_window_max_size(&mut self, width: i32, height: i32)
pub fn set_window_max_size(&mut self, width: i32, height: i32)
Sets maximum window dimensions (for FLAG_WINDOW_RESIZABLE).
Sourcepub fn set_window_size(&mut self, width: i32, height: i32)
pub fn set_window_size(&mut self, width: i32, height: i32)
Sets window dimensions.
Sourcepub fn set_window_opacity(&mut self, opacity: f32)
pub fn set_window_opacity(&mut self, opacity: f32)
Set window opacity, value opacity is between 0.0 and 1.0
Sourcepub fn get_render_width(&self) -> i32
pub fn get_render_width(&self) -> i32
Get current render width which is equal to screen width * dpi scale
Sourcepub fn get_render_height(&self) -> i32
pub fn get_render_height(&self) -> i32
Get current render width which is equal to screen height * dpi scale
Sourcepub fn get_screen_width(&self) -> i32
pub fn get_screen_width(&self) -> i32
Get current screen height which is equal to screen height * dpi scale
Sourcepub fn get_screen_height(&self) -> i32
pub fn get_screen_height(&self) -> i32
Gets current screen height.
Sourcepub fn get_window_position(&self) -> Vector2
pub fn get_window_position(&self) -> Vector2
Get window position
pub fn toggle_borderless_windowed(&self)
pub fn set_window_focused(&self)
Sourcepub fn show_cursor(&mut self)
pub fn show_cursor(&mut self)
Shows mouse cursor.
Sourcepub fn hide_cursor(&mut self)
pub fn hide_cursor(&mut self)
Hides mouse cursor.
Checks if mouse cursor is not visible.
Sourcepub fn enable_cursor(&mut self)
pub fn enable_cursor(&mut self)
Enables mouse cursor (unlock cursor).
Sourcepub fn disable_cursor(&mut self)
pub fn disable_cursor(&mut self)
Disables mouse cursor (lock cursor).
Sourcepub unsafe fn get_window_handle(&mut self) -> *mut c_void
pub unsafe fn get_window_handle(&mut self) -> *mut c_void
Get native window handle
Sourcepub fn gui_enable(&mut self)
pub fn gui_enable(&mut self)
Enable gui controls (global state)
Sourcepub fn gui_disable(&mut self)
pub fn gui_disable(&mut self)
Disable gui controls (global state)
Sourcepub fn gui_unlock(&mut self)
pub fn gui_unlock(&mut self)
Unlock gui controls (global state)
pub fn gui_fade(&mut self, color: Color, alpha: f32) -> Color
Sourcepub fn gui_set_state(&mut self, state: GuiState)
pub fn gui_set_state(&mut self, state: GuiState)
Set gui state (global state)
Sourcepub fn gui_get_state(&mut self) -> GuiState
pub fn gui_get_state(&mut self) -> GuiState
Get gui state (global state)
Sourcepub fn gui_set_font(&mut self, font: impl AsRef<Font>)
pub fn gui_set_font(&mut self, font: impl AsRef<Font>)
Set gui custom font (global state)
Sourcepub fn gui_get_font(&mut self) -> WeakFont
pub fn gui_get_font(&mut self) -> WeakFont
Get gui custom font (global state)
Sourcepub fn gui_set_style(
&mut self,
control: GuiControl,
property: impl GuiProperty,
value: i32,
)
pub fn gui_set_style( &mut self, control: GuiControl, property: impl GuiProperty, value: i32, )
Set one style property
Sourcepub fn gui_get_style(
&mut self,
control: GuiControl,
property: impl GuiProperty,
) -> i32
pub fn gui_get_style( &mut self, control: GuiControl, property: impl GuiProperty, ) -> i32
Get one style property
Sourcepub fn gui_load_style(&mut self, filename: &str)
pub fn gui_load_style(&mut self, filename: &str)
Load style file (.rgs)
Sourcepub fn gui_load_style_default(&mut self)
pub fn gui_load_style_default(&mut self)
Load style default over global style
Sourcepub fn gui_enable_tooltip(&mut self)
pub fn gui_enable_tooltip(&mut self)
Enable gui tooltips (global state)
Sourcepub fn gui_disable_tooltip(&mut self)
pub fn gui_disable_tooltip(&mut self)
Disable gui tooltips (global state)
Sourcepub fn gui_set_tooltip(&mut self, tooltip: &str)
pub fn gui_set_tooltip(&mut self, tooltip: &str)
Set tooltip string
Trait Implementations§
Source§impl<'a> Deref for RaylibDrawHandle<'a>
impl<'a> Deref for RaylibDrawHandle<'a>
Source§impl<'a> DerefMut for RaylibDrawHandle<'a>
impl<'a> DerefMut for RaylibDrawHandle<'a>
Source§fn deref_mut(&mut self) -> &mut RaylibHandle
fn deref_mut(&mut self) -> &mut RaylibHandle
Source§impl<'a> Drop for RaylibDrawHandle<'a>
impl<'a> Drop for RaylibDrawHandle<'a>
Source§impl<'a> RaylibDraw for RaylibDrawHandle<'a>
impl<'a> RaylibDraw for RaylibDrawHandle<'a>
Source§fn clear_background(&mut self, color: impl Into<Color>)
fn clear_background(&mut self, color: impl Into<Color>)
Source§fn get_shapes_texture(&self) -> Texture2D
fn get_shapes_texture(&self) -> Texture2D
Source§fn get_shapes_texture_rectangle(&self) -> Rectangle
fn get_shapes_texture_rectangle(&self) -> Rectangle
Source§fn set_shapes_texture(
&mut self,
texture: impl AsRef<Texture2D>,
source: impl Into<Rectangle>,
)
fn set_shapes_texture( &mut self, texture: impl AsRef<Texture2D>, source: impl Into<Rectangle>, )
Source§fn draw_pixel_v(
&mut self,
position: impl Into<Vector2>,
color: impl Into<Color>,
)
fn draw_pixel_v( &mut self, position: impl Into<Vector2>, color: impl Into<Color>, )
Source§fn draw_line(
&mut self,
start_pos_x: i32,
start_pos_y: i32,
end_pos_x: i32,
end_pos_y: i32,
color: impl Into<Color>,
)
fn draw_line( &mut self, start_pos_x: i32, start_pos_y: i32, end_pos_x: i32, end_pos_y: i32, color: impl Into<Color>, )
Source§fn draw_line_v(
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
color: impl Into<Color>,
)
fn draw_line_v( &mut self, start_pos: impl Into<Vector2>, end_pos: impl Into<Vector2>, color: impl Into<Color>, )
Source§fn draw_line_ex(
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
thick: f32,
color: impl Into<Color>,
)
fn draw_line_ex( &mut self, start_pos: impl Into<Vector2>, end_pos: impl Into<Vector2>, thick: f32, color: impl Into<Color>, )
Source§fn draw_line_bezier(
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
thick: f32,
color: impl Into<Color>,
)
fn draw_line_bezier( &mut self, start_pos: impl Into<Vector2>, end_pos: impl Into<Vector2>, thick: f32, color: impl Into<Color>, )
Source§fn draw_line_strip(&mut self, points: &[Vector2], color: impl Into<Color>)
fn draw_line_strip(&mut self, points: &[Vector2], color: impl Into<Color>)
Source§fn draw_circle(
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color: impl Into<Color>,
)
fn draw_circle( &mut self, center_x: i32, center_y: i32, radius: f32, color: impl Into<Color>, )
Source§fn draw_circle_sector(
&mut self,
center: impl Into<Vector2>,
radius: f32,
start_angle: f32,
end_angle: f32,
segments: i32,
color: impl Into<Color>,
)
fn draw_circle_sector( &mut self, center: impl Into<Vector2>, radius: f32, start_angle: f32, end_angle: f32, segments: i32, color: impl Into<Color>, )
Source§fn draw_circle_sector_lines(
&mut self,
center: impl Into<Vector2>,
radius: f32,
start_angle: f32,
end_angle: f32,
segments: i32,
color: impl Into<Color>,
)
fn draw_circle_sector_lines( &mut self, center: impl Into<Vector2>, radius: f32, start_angle: f32, end_angle: f32, segments: i32, color: impl Into<Color>, )
Source§fn draw_circle_gradient(
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color1: impl Into<Color>,
color2: impl Into<Color>,
)
fn draw_circle_gradient( &mut self, center_x: i32, center_y: i32, radius: f32, color1: impl Into<Color>, color2: impl Into<Color>, )
Source§fn draw_circle_v(
&mut self,
center: impl Into<Vector2>,
radius: f32,
color: impl Into<Color>,
)
fn draw_circle_v( &mut self, center: impl Into<Vector2>, radius: f32, color: impl Into<Color>, )
Source§fn draw_circle_lines(
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color: impl Into<Color>,
)
fn draw_circle_lines( &mut self, center_x: i32, center_y: i32, radius: f32, color: impl Into<Color>, )
Source§fn draw_circle_lines_v(
&mut self,
center: impl Into<Vector2>,
radius: f32,
color: impl Into<Color>,
)
fn draw_circle_lines_v( &mut self, center: impl Into<Vector2>, radius: f32, color: impl Into<Color>, )
Source§fn draw_ellipse(
&mut self,
center_x: i32,
center_y: i32,
radius_h: f32,
radius_v: f32,
color: impl Into<Color>,
)
fn draw_ellipse( &mut self, center_x: i32, center_y: i32, radius_h: f32, radius_v: f32, color: impl Into<Color>, )
Source§fn draw_ellipse_lines(
&mut self,
center_x: i32,
center_y: i32,
radius_h: f32,
radius_v: f32,
color: impl Into<Color>,
)
fn draw_ellipse_lines( &mut self, center_x: i32, center_y: i32, radius_h: f32, radius_v: f32, color: impl Into<Color>, )
Source§fn draw_ring(
&mut self,
center: impl Into<Vector2>,
inner_radius: f32,
outer_radius: f32,
start_angle: f32,
end_angle: f32,
segments: i32,
color: impl Into<Color>,
)
fn draw_ring( &mut self, center: impl Into<Vector2>, inner_radius: f32, outer_radius: f32, start_angle: f32, end_angle: f32, segments: i32, color: impl Into<Color>, )
Source§fn draw_ring_lines(
&mut self,
center: impl Into<Vector2>,
inner_radius: f32,
outer_radius: f32,
start_angle: f32,
end_angle: f32,
segments: i32,
color: impl Into<Color>,
)
fn draw_ring_lines( &mut self, center: impl Into<Vector2>, inner_radius: f32, outer_radius: f32, start_angle: f32, end_angle: f32, segments: i32, color: impl Into<Color>, )
Source§fn draw_rectangle(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color: impl Into<Color>,
)
fn draw_rectangle( &mut self, x: i32, y: i32, width: i32, height: i32, color: impl Into<Color>, )
Source§fn draw_rectangle_v(
&mut self,
position: impl Into<Vector2>,
size: impl Into<Vector2>,
color: impl Into<Color>,
)
fn draw_rectangle_v( &mut self, position: impl Into<Vector2>, size: impl Into<Vector2>, color: impl Into<Color>, )
Source§fn draw_rectangle_rec(
&mut self,
rec: impl Into<Rectangle>,
color: impl Into<Color>,
)
fn draw_rectangle_rec( &mut self, rec: impl Into<Rectangle>, color: impl Into<Color>, )
rec.Source§fn draw_rectangle_pro(
&mut self,
rec: impl Into<Rectangle>,
origin: impl Into<Vector2>,
rotation: f32,
color: impl Into<Color>,
)
fn draw_rectangle_pro( &mut self, rec: impl Into<Rectangle>, origin: impl Into<Vector2>, rotation: f32, color: impl Into<Color>, )
Source§fn draw_rectangle_gradient_v(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color1: impl Into<Color>,
color2: impl Into<Color>,
)
fn draw_rectangle_gradient_v( &mut self, x: i32, y: i32, width: i32, height: i32, color1: impl Into<Color>, color2: impl Into<Color>, )
Source§fn draw_rectangle_gradient_h(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color1: impl Into<Color>,
color2: impl Into<Color>,
)
fn draw_rectangle_gradient_h( &mut self, x: i32, y: i32, width: i32, height: i32, color1: impl Into<Color>, color2: impl Into<Color>, )
Source§fn draw_rectangle_gradient_ex(
&mut self,
rec: impl Into<Rectangle>,
col1: impl Into<Color>,
col2: impl Into<Color>,
col3: impl Into<Color>,
col4: impl Into<Color>,
)
fn draw_rectangle_gradient_ex( &mut self, rec: impl Into<Rectangle>, col1: impl Into<Color>, col2: impl Into<Color>, col3: impl Into<Color>, col4: impl Into<Color>, )
Source§fn draw_rectangle_lines(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color: impl Into<Color>,
)
fn draw_rectangle_lines( &mut self, x: i32, y: i32, width: i32, height: i32, color: impl Into<Color>, )
Source§fn draw_rectangle_lines_ex(
&mut self,
rec: impl Into<Rectangle>,
line_thick: f32,
color: impl Into<Color>,
)
fn draw_rectangle_lines_ex( &mut self, rec: impl Into<Rectangle>, line_thick: f32, color: impl Into<Color>, )
Source§fn draw_rectangle_rounded(
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
color: impl Into<Color>,
)
fn draw_rectangle_rounded( &mut self, rec: impl Into<Rectangle>, roundness: f32, segments: i32, color: impl Into<Color>, )
Source§fn draw_rectangle_rounded_lines(
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
color: impl Into<Color>,
)
fn draw_rectangle_rounded_lines( &mut self, rec: impl Into<Rectangle>, roundness: f32, segments: i32, color: impl Into<Color>, )
Source§fn draw_rectangle_rounded_lines_ex(
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
line_thickness: f32,
color: impl Into<Color>,
)
fn draw_rectangle_rounded_lines_ex( &mut self, rec: impl Into<Rectangle>, roundness: f32, segments: i32, line_thickness: f32, color: impl Into<Color>, )
Source§fn draw_triangle(
&mut self,
v1: impl Into<Vector2>,
v2: impl Into<Vector2>,
v3: impl Into<Vector2>,
color: impl Into<Color>,
)
fn draw_triangle( &mut self, v1: impl Into<Vector2>, v2: impl Into<Vector2>, v3: impl Into<Vector2>, color: impl Into<Color>, )
Source§fn draw_triangle_lines(
&mut self,
v1: impl Into<Vector2>,
v2: impl Into<Vector2>,
v3: impl Into<Vector2>,
color: impl Into<Color>,
)
fn draw_triangle_lines( &mut self, v1: impl Into<Vector2>, v2: impl Into<Vector2>, v3: impl Into<Vector2>, color: impl Into<Color>, )
Source§fn draw_triangle_fan(&mut self, points: &[Vector2], color: impl Into<Color>)
fn draw_triangle_fan(&mut self, points: &[Vector2], color: impl Into<Color>)
Source§fn draw_triangle_strip(&mut self, points: &[Vector2], color: impl Into<Color>)
fn draw_triangle_strip(&mut self, points: &[Vector2], color: impl Into<Color>)
Source§fn draw_poly(
&mut self,
center: impl Into<Vector2>,
sides: i32,
radius: f32,
rotation: f32,
color: impl Into<Color>,
)
fn draw_poly( &mut self, center: impl Into<Vector2>, sides: i32, radius: f32, rotation: f32, color: impl Into<Color>, )
Source§fn draw_poly_lines(
&mut self,
center: impl Into<Vector2>,
sides: i32,
radius: f32,
rotation: f32,
color: impl Into<Color>,
)
fn draw_poly_lines( &mut self, center: impl Into<Vector2>, sides: i32, radius: f32, rotation: f32, color: impl Into<Color>, )
Source§fn draw_texture(
&mut self,
texture: impl AsRef<Texture2D>,
x: i32,
y: i32,
tint: impl Into<Color>,
)
fn draw_texture( &mut self, texture: impl AsRef<Texture2D>, x: i32, y: i32, tint: impl Into<Color>, )
texture using specified position and tint color.Source§fn draw_texture_v(
&mut self,
texture: impl AsRef<Texture2D>,
position: impl Into<Vector2>,
tint: impl Into<Color>,
)
fn draw_texture_v( &mut self, texture: impl AsRef<Texture2D>, position: impl Into<Vector2>, tint: impl Into<Color>, )
texture using specified position vector and tint color.Source§fn draw_texture_ex(
&mut self,
texture: impl AsRef<Texture2D>,
position: impl Into<Vector2>,
rotation: f32,
scale: f32,
tint: impl Into<Color>,
)
fn draw_texture_ex( &mut self, texture: impl AsRef<Texture2D>, position: impl Into<Vector2>, rotation: f32, scale: f32, tint: impl Into<Color>, )
texture with extended parameters.Source§fn draw_texture_rec(
&mut self,
texture: impl AsRef<Texture2D>,
source_rec: impl Into<Rectangle>,
position: impl Into<Vector2>,
tint: impl Into<Color>,
)
fn draw_texture_rec( &mut self, texture: impl AsRef<Texture2D>, source_rec: impl Into<Rectangle>, position: impl Into<Vector2>, tint: impl Into<Color>, )
texture defined by the source_rec rectangle.Source§fn draw_texture_pro(
&mut self,
texture: impl AsRef<Texture2D>,
source_rec: impl Into<Rectangle>,
dest_rec: impl Into<Rectangle>,
origin: impl Into<Vector2>,
rotation: f32,
tint: impl Into<Color>,
)
fn draw_texture_pro( &mut self, texture: impl AsRef<Texture2D>, source_rec: impl Into<Rectangle>, dest_rec: impl Into<Rectangle>, origin: impl Into<Vector2>, rotation: f32, tint: impl Into<Color>, )
texture defined by the source_rec rectangle with pro parameters.Source§fn draw_texture_n_patch(
&mut self,
texture: impl AsRef<Texture2D>,
n_patch_info: impl Into<NPatchInfo>,
dest_rec: impl Into<Rectangle>,
origin: impl Into<Vector2>,
rotation: f32,
tint: impl Into<Color>,
)
fn draw_texture_n_patch( &mut self, texture: impl AsRef<Texture2D>, n_patch_info: impl Into<NPatchInfo>, dest_rec: impl Into<Rectangle>, origin: impl Into<Vector2>, rotation: f32, tint: impl Into<Color>, )
Source§fn draw_text(
&mut self,
text: &str,
x: i32,
y: i32,
font_size: i32,
color: impl Into<Color>,
)
fn draw_text( &mut self, text: &str, x: i32, y: i32, font_size: i32, color: impl Into<Color>, )
[RaylibDrawHandle::draw_text_codepoints] for that.Source§fn draw_text_codepoints(
&mut self,
font: impl AsRef<Font>,
text: &str,
position: Vector2,
font_size: f32,
spacing: f32,
tint: impl Into<Color>,
)
fn draw_text_codepoints( &mut self, font: impl AsRef<Font>, text: &str, position: Vector2, font_size: f32, spacing: f32, tint: impl Into<Color>, )
[RaylibDrawHandle::draw_text].Source§fn draw_text_ex(
&mut self,
font: impl AsRef<Font>,
text: &str,
position: impl Into<Vector2>,
font_size: f32,
spacing: f32,
tint: impl Into<Color>,
)
fn draw_text_ex( &mut self, font: impl AsRef<Font>, text: &str, position: impl Into<Vector2>, font_size: f32, spacing: f32, tint: impl Into<Color>, )
font and additional parameters.