Struct DrawHandle

Source
pub struct DrawHandle<'a>(/* private fields */);
Expand description

An object that handles drawing

Implementations§

Source§

impl<'a> DrawHandle<'a>

Source

pub fn end_drawing(self)

End canvas drawing and swap buffers (double buffering)

Methods from Deref<Target = Raylib>§

Source

pub fn window_should_close(&self) -> bool

Check if Escape key or Close icon is pressed

Source

pub fn is_window_fullscreen(&self) -> bool

Check if window is currently fullscreen

Source

pub fn is_window_hidden(&self) -> bool

Check if window is currently hidden (only PLATFORM_DESKTOP)

Source

pub fn is_window_minimized(&self) -> bool

Check if window is currently minimized (only PLATFORM_DESKTOP)

Source

pub fn is_window_maximized(&self) -> bool

Check if window is currently maximized (only PLATFORM_DESKTOP)

Source

pub fn is_window_focused(&self) -> bool

Check if window is currently focused (only PLATFORM_DESKTOP)

Source

pub fn is_window_resized(&self) -> bool

Check if window has been resized last frame

Source

pub fn is_window_state(&self, flag: ConfigFlags) -> bool

Check if one specific window flag is enabled

Source

pub fn get_window_handle(&self) -> *mut c_void

Get native window handle

Source

pub fn get_screen_width(&self) -> u32

Get current screen width

Source

pub fn get_screen_height(&self) -> u32

Get current screen height

Source

pub fn get_render_width(&self) -> u32

Get current render width (it considers HiDPI)

Source

pub fn get_render_height(&self) -> u32

Get current render height (it considers HiDPI)

Source

pub fn get_monitor_count(&self) -> u32

Get number of connected monitors

Source

pub fn get_current_monitor(&self) -> u32

Get current connected monitor

Source

pub fn get_monitor_position(&self, monitor: u32) -> Vector2

Get specified monitor position

Source

pub fn get_monitor_width(&self, monitor: u32) -> u32

Get specified monitor width (current video mode used by monitor)

Source

pub fn get_monitor_height(&self, monitor: u32) -> u32

Get specified monitor height (current video mode used by monitor)

Source

pub fn get_monitor_physical_width(&self, monitor: u32) -> u32

Get specified monitor physical width in millimetres

Source

pub fn get_monitor_physical_height(&self, monitor: u32) -> u32

Get specified monitor physical height in millimetres

Source

pub fn get_monitor_refresh_rate(&self, monitor: u32) -> u32

Get specified monitor refresh rate

Source

pub fn get_window_position(&self) -> Vector2

Get window position XY on monitor

Source

pub fn get_window_scale_dpi(&self) -> Vector2

Get window scale DPI factor

Source

pub fn get_monitor_name(&self, monitor: u32) -> String

Get the human-readable, UTF-8 encoded name of the primary monitor

Source

pub fn get_clipboard_text(&self) -> String

Get clipboard text content

Source

pub fn is_cursor_hidden(&self) -> bool

Check if cursor is not visible

Source

pub fn is_cursor_on_screen(&self) -> bool

Check if cursor is on the screen

Source

pub fn get_fps(&self) -> u32

Get current FPS

Source

pub fn get_frame_time(&self) -> Duration

Get time for last frame drawn (delta time)

Source

pub fn get_time(&self) -> Duration

Get elapsed time since InitWindow()

Source

pub fn get_random_value(&self, min: i32, max: i32) -> i32

Get a random value between min and max (both included)

Source

pub fn open_url(&self, url: &str)

Open URL with default system browser (if available)

Source

pub fn is_file_dropped(&self) -> bool

Check if a file has been dropped into window

Source

pub fn get_dropped_files(&self) -> Vec<String>

Load dropped filepaths

Source

pub fn is_key_pressed(&self, key: KeyboardKey) -> bool

Check if a key has been pressed once

Source

pub fn is_key_down(&self, key: KeyboardKey) -> bool

Check if a key is being pressed

Source

pub fn is_key_released(&self, key: KeyboardKey) -> bool

Check if a key has been released once

Source

pub fn is_key_up(&self, key: KeyboardKey) -> bool

Check if a key is NOT being pressed

Source

pub fn get_key_pressed(&self) -> KeyboardKey

Get key pressed (keycode), call it multiple times for keys queued, returns KeyboardKey::Null when the queue is empty

Source

pub fn get_char_pressed(&self) -> Option<char>

Get char pressed (unicode), call it multiple times for chars queued, returns None when the queue is empty

Source

pub fn is_gamepad_available(&self, gamepad: u32) -> bool

Check if a gamepad is available

Source

pub fn get_gamepad_name(&self, gamepad: u32) -> String

Get gamepad internal name id

Source

pub fn is_gamepad_button_pressed( &self, gamepad: u32, button: GamepadButton, ) -> bool

Check if a gamepad button has been pressed once

Source

pub fn is_gamepad_button_down( &self, gamepad: u32, button: GamepadButton, ) -> bool

Check if a gamepad button is being pressed

Source

pub fn is_gamepad_button_released( &self, gamepad: u32, button: GamepadButton, ) -> bool

Check if a gamepad button has been released once

Source

pub fn is_gamepad_button_up(&self, gamepad: u32, button: GamepadButton) -> bool

Check if a gamepad button is NOT being pressed

Source

pub fn get_gamepad_button_pressed(&self) -> GamepadButton

Get the last gamepad button pressed

Source

pub fn get_gamepad_axis_count(&self, gamepad: u32) -> u32

Get gamepad axis count for a gamepad

Source

pub fn get_gamepad_axis_movement(&self, gamepad: u32, axis: GamepadAxis) -> f32

Get axis movement value for a gamepad axis

Source

pub fn is_mouse_button_pressed(&self, button: MouseButton) -> bool

Check if a mouse button has been pressed once

Source

pub fn is_mouse_button_down(&self, button: MouseButton) -> bool

Check if a mouse button is being pressed

Source

pub fn is_mouse_button_released(&self, button: MouseButton) -> bool

Check if a mouse button has been released once

Source

pub fn is_mouse_button_up(&self, button: MouseButton) -> bool

Check if a mouse button is NOT being pressed

Source

pub fn get_mouse_x(&self) -> i32

Get mouse position X

Source

pub fn get_mouse_y(&self) -> i32

Get mouse position Y

Source

pub fn get_mouse_position(&self) -> Vector2

Get mouse position XY

Source

pub fn get_mouse_delta(&self) -> Vector2

Get mouse delta between frames

Source

pub fn get_mouse_wheel_move(&self) -> f32

Get mouse wheel movement for X or Y, whichever is larger

Source

pub fn get_mouse_wheel_move_vec(&self) -> Vector2

Get mouse wheel movement for both X and Y

Source

pub fn get_touch_x(&self) -> i32

Get touch position X for touch point 0 (relative to screen size)

Source

pub fn get_touch_y(&self) -> i32

Get touch position Y for touch point 0 (relative to screen size)

Source

pub fn get_touch_position(&self, index: u32) -> Vector2

Get touch position XY for a touch point index (relative to screen size)

Source

pub fn get_touch_point_id(&self, index: u32) -> u32

Get touch point identifier for given index

Source

pub fn get_touch_point_count(&self) -> u32

Get number of touch points

Source

pub fn is_gesture_detected(&self, gesture: Gesture) -> bool

Check if a gesture have been detected

Source

pub fn get_gesture_detected(&self) -> Gesture

Get latest detected gesture

Source

pub fn get_gesture_hold_duration(&self) -> Duration

Get gesture hold time

Source

pub fn get_gesture_drag_vector(&self) -> Vector2

Get gesture drag vector

Source

pub fn get_gesture_drag_angle(&self) -> f32

Get gesture drag angle

Source

pub fn get_gesture_pinch_vector(&self) -> Vector2

Get gesture pinch delta

Source

pub fn get_gesture_pinch_angle(&self) -> f32

Get gesture pinch angle

Trait Implementations§

Source§

impl<'a> Deref for DrawHandle<'a>

Source§

type Target = Raylib

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> Draw for DrawHandle<'a>

Source§

fn clear_background(&mut self, color: Color)

Set background color (framebuffer clear color)
Source§

fn begin_mode_2d(&mut self, camera: Camera2D) -> DrawMode2D<'_, Self>

Begin 2D mode with custom camera (2D)
Source§

fn begin_mode_3d(&mut self, camera: Camera3D) -> DrawMode3D<'_, Self>

Begin 3D mode with custom camera (3D)
Source§

fn begin_texture_mode( &mut self, target: &RenderTexture2D, ) -> DrawTextureMode<'_, Self>

Begin drawing to render texture
Source§

fn begin_shader_mode(&mut self, shader: &Shader) -> DrawShaderMode<'_, Self>

Begin custom shader drawing
Source§

fn begin_blend_mode(&mut self, mode: BlendMode) -> DrawBlendMode<'_, Self>

Begin blending mode (alpha, additive, multiplied, subtract, custom)
Source§

fn begin_scissor_mode( &mut self, x: u32, y: u32, width: u32, height: u32, ) -> DrawScissorMode<'_, Self>

Begin scissor mode (define screen area for following drawing)
Source§

fn begin_vr_stereo_mode( &mut self, config: VrStereoConfig, ) -> DrawVrStereoMode<'_, Self>

Begin stereo rendering (requires VR simulator)
Source§

fn draw_texture( &mut self, tex: &Texture, position: Vector2, params: DrawTextureParams, )

Draw a part of a texture defined by source and destination rectangles
Source§

fn draw_texture_patch( &mut self, tex: &Texture, position: Vector2, params: DrawTextureParams, patch_info: NPatchInfo, )

Draws a texture (or part of it) that stretches or shrinks nicely
Source§

fn set_shapes_texture(&mut self, texture: &Texture, source: Rectangle)

Set texture and rectangle to be used on shapes drawing
Source§

fn draw_pixel(&mut self, position: Vector2, color: Color)

Draw a pixel
Source§

fn draw_line(&mut self, start: Vector2, end: Vector2, color: Color)

Draw a line
Source§

fn draw_line_thick( &mut self, start: Vector2, end: Vector2, thickness: f32, color: Color, )

Draw a line defining thickness
Source§

fn draw_line_bezier( &mut self, start: Vector2, end: Vector2, thickness: f32, color: Color, )

Draw a line using cubic-bezier curves in-out
Source§

fn draw_line_bezier_quad( &mut self, start: Vector2, end: Vector2, control_pos: Vector2, thickness: f32, color: Color, )

Draw line using quadratic bezier curves with a control point
Source§

fn draw_line_bezier_cubic( &mut self, start: Vector2, end: Vector2, start_control_pos: Vector2, end_control_pos: Vector2, thickness: f32, color: Color, )

Draw line using cubic bezier curves with 2 control points
Source§

fn draw_line_strip(&mut self, points: &[Vector2], color: Color)

Draw lines sequence
Source§

fn draw_circle(&mut self, center: Vector2, radius: f32, color: Color)

Draw a color-filled circle
Source§

fn draw_circle_lines( &mut self, center_x: i32, center_y: i32, radius: f32, color: Color, )

Draw circle outline
Source§

fn draw_ellipse(&mut self, center: Vector2, radius: Vector2, color: Color)

Draw ellipse
Source§

fn draw_ellipse_lines(&mut self, center: Vector2, radius: Vector2, color: Color)

Draw ellipse outline
Source§

fn draw_circle_sector( &mut self, center: Vector2, radius: f32, angle: Range<f32>, segments: u32, color: Color, )

Draw a piece of a circle
Source§

fn draw_circle_sector_lines( &mut self, center: Vector2, radius: f32, angle: Range<f32>, segments: u32, color: Color, )

Draw circle sector outline
Source§

fn draw_circle_gradient( &mut self, center: Vector2, radius: f32, color1: Color, color2: Color, )

Draw a gradient-filled circle
Source§

fn draw_ring( &mut self, center: Vector2, inner_radius: f32, outer_radius: f32, start_angle: f32, end_angle: f32, segments: u32, color: Color, )

Draw ring
Source§

fn draw_ring_lines( &mut self, center: Vector2, radius: Range<f32>, angle: Range<f32>, segments: u32, color: Color, )

Draw ring outline
Source§

fn draw_rectangle(&mut self, rect: Rectangle, color: Color)

Draw a color-filled rectangle
Source§

fn draw_rectangle_lines(&mut self, rect: Rectangle, color: Color)

Draw rectangle outline
Source§

fn draw_rectangle_lines_thick( &mut self, rect: Rectangle, line_thickness: f32, color: Color, )

Draw rectangle outline with thickness
Source§

fn draw_rectangle_rotated( &mut self, rect: Rectangle, origin: Vector2, rotation: f32, color: Color, )

Draw a color-filled rotated
Source§

fn draw_rectangle_gradient_vertical( &mut self, rect: Rectangle, color1: Color, color2: Color, )

Draw a vertical-gradient-filled rectangle
Source§

fn draw_rectangle_gradient_horizontal( &mut self, rect: Rectangle, color1: Color, color2: Color, )

Draw a horizontal-gradient-filled rectangle
Source§

fn draw_rectangle_gradient( &mut self, rect: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color, )

Draw a gradient-filled rectangle with custom vertex colors
Source§

fn draw_rectangle_rounded( &mut self, rect: Rectangle, roundness: f32, segments: u32, color: Color, )

Draw rectangle with rounded edges
Source§

fn draw_rectangle_rounded_lines( &mut self, rect: Rectangle, roundness: f32, segments: u32, line_thickness: f32, color: Color, )

Draw rectangle with rounded edges outline
Source§

fn draw_triangle(&mut self, v1: Vector2, v2: Vector2, v3: Vector2, color: Color)

Draw a color-filled triangle (vertex in counter-clockwise order!)
Source§

fn draw_triangle_lines( &mut self, v1: Vector2, v2: Vector2, v3: Vector2, color: Color, )

Draw triangle outline (vertex in counter-clockwise order!)
Source§

fn draw_triangle_fan(&mut self, points: &[Vector2], color: Color)

Draw a triangle fan defined by points (first vertex is the center)
Source§

fn draw_triangle_strip(&mut self, points: &[Vector2], color: Color)

Draw a triangle strip defined by points
Source§

fn draw_polygon( &mut self, center: Vector2, sides: u32, radius: f32, rotation: f32, color: Color, )

Draw a regular polygon (Vector version)
Source§

fn draw_polygon_lines( &mut self, center: Vector2, sides: u32, radius: f32, rotation: f32, color: Color, )

Draw a polygon outline of n sides
Source§

fn draw_polygon_lines_thick( &mut self, center: Vector2, sides: u32, radius: f32, rotation: f32, line_thickness: f32, color: Color, )

Draw a polygon outline of n sides with thickness
Source§

fn draw_fps(&mut self, position: Vector2)

Draw current FPS
Source§

fn draw_text( &mut self, text: &str, position: Vector2, font_size: u32, color: Color, )

Draw text (using default font)
Source§

fn draw_text_with_font( &mut self, text: &str, pos: Vector2, font: &Font, font_size: f32, spacing: f32, tint: Color, )

Draw text using font and additional parameters
Source§

fn draw_text_with_font_and_rotation( &mut self, text: &str, pos: Vector2, origin: Vector2, rotation: f32, font: &Font, font_size: f32, spacing: f32, tint: Color, )

Draw text using Font and pro parameters (rotation)
Source§

fn draw_char( &mut self, ch: char, pos: Vector2, font: &Font, font_size: f32, tint: Color, )

Draw one character
Source§

fn draw_chars( &mut self, chars: &[char], pos: Vector2, font: &Font, font_size: f32, spacing: f32, tint: Color, )

Draw multiple characters
Source§

fn draw_line_3d(&mut self, start_pos: Vector3, end_pos: Vector3, color: Color)

Draw a line in 3D world space
Source§

fn draw_point_3d(&mut self, position: Vector3, color: Color)

Draw a point in 3D space, actually a small line
Source§

fn draw_circle_3d( &mut self, center: Vector3, radius: f32, rotation_axis: Vector3, rotation_angle: f32, color: Color, )

Draw a circle in 3D world space
Source§

fn draw_triangle_3d( &mut self, v1: Vector3, v2: Vector3, v3: Vector3, color: Color, )

Draw a color-filled triangle (vertex in counter-clockwise order!)
Source§

fn draw_triangle_strip_3d(&mut self, points: &[Vector3], color: Color)

Draw a triangle strip defined by points
Source§

fn draw_cube(&mut self, position: Vector3, size: Vector3, color: Color)

Draw cube
Source§

fn draw_cube_wires(&mut self, position: Vector3, size: Vector3, color: Color)

Draw cube wires (Vector version)
Source§

fn draw_sphere(&mut self, center_pos: Vector3, radius: f32, color: Color)

Draw sphere
Source§

fn draw_sphere_ex( &mut self, center_pos: Vector3, radius: f32, rings: u32, slices: u32, color: Color, )

Draw sphere with extended parameters
Source§

fn draw_sphere_wires( &mut self, center_pos: Vector3, radius: f32, rings: u32, slices: u32, color: Color, )

Draw sphere wires
Source§

fn draw_cylinder( &mut self, position: Vector3, radius_top: f32, radius_bottom: f32, height: f32, slices: u32, color: Color, )

Draw a cylinder/cone
Source§

fn draw_cylinder_ex( &mut self, pos_top: Vector3, pos_bottom: Vector3, radius_top: f32, radius_bottom: f32, sides: u32, color: Color, )

Draw a cylinder with extended parameters
Source§

fn draw_cylinder_wires( &mut self, position: Vector3, radius_top: f32, radius_bottom: f32, height: f32, slices: u32, color: Color, )

Draw a cylinder/cone wires
Source§

fn draw_cylinder_wires_ex( &mut self, pos_top: Vector3, pos_bottom: Vector3, radius_top: f32, radius_bottom: f32, sides: u32, color: Color, )

Draw a cylinder wires with extended parameters
Source§

fn draw_capsule( &mut self, start_pos: Vector3, end_pos: Vector3, radius: f32, slices: u32, rings: u32, color: Color, )

Draw a capsule with the center of its sphere caps at start_pos and end_pos
Source§

fn draw_capsule_wires( &mut self, start_pos: Vector3, end_pos: Vector3, radius: f32, slices: u32, rings: u32, color: Color, )

Draw capsule wireframe with the center of its sphere caps at start_pos and end_pos
Source§

fn draw_plane(&mut self, center_pos: Vector3, size: Vector2, color: Color)

Draw a plane XZ
Source§

fn draw_ray(&mut self, ray: Ray, color: Color)

Draw a ray line
Source§

fn draw_grid(&mut self, slices: u32, spacing: f32)

Draw a grid (centered at (0, 0, 0))
Source§

fn draw_model( &mut self, model: &Model, position: Vector3, scale: f32, tint: Color, )

Draw a model (with texture if set)
Source§

fn draw_model_ex( &mut self, model: &Model, position: Vector3, rotation_axis: Vector3, rotation_angle: f32, scale: Vector3, tint: Color, )

Draw a model with extended parameters
Source§

fn draw_model_wires( &mut self, model: &Model, position: Vector3, scale: f32, tint: Color, )

Draw a model wires (with texture if set)
Source§

fn draw_model_wires_ex( &mut self, model: &Model, position: Vector3, rotation_axis: Vector3, rotation_angle: f32, scale: Vector3, tint: Color, )

Draw a model wires (with texture if set) with extended parameters
Source§

fn draw_bounding_box(&mut self, bbox: BoundingBox, color: Color)

Draw bounding box (wires)
Source§

fn draw_billboard( &mut self, camera: Camera, texture: &Texture2D, position: Vector3, size: Vector2, params: DrawBillboardParams, )

Draw a billboard texture
Source§

fn draw_mesh(&mut self, mesh: &Mesh, material: &Material, transform: Matrix)

Draw a 3d mesh with material and transform
Source§

fn draw_mesh_instanced( &mut self, mesh: &Mesh, material: &Material, transforms: &[Matrix], )

Draw multiple mesh instances with material and different transforms
Source§

impl<'a> Drop for DrawHandle<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for DrawHandle<'a>

§

impl<'a> RefUnwindSafe for DrawHandle<'a>

§

impl<'a> !Send for DrawHandle<'a>

§

impl<'a> !Sync for DrawHandle<'a>

§

impl<'a> Unpin for DrawHandle<'a>

§

impl<'a> !UnwindSafe for DrawHandle<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.