[−][src]Trait raylib::core::drawing::RaylibDraw
Provided methods
fn clear_background(&mut self, color: impl Into<Color>)
Sets background color (framebuffer clear color).
fn set_shapes_texture(
&mut self,
texture: impl AsRef<Texture2D>,
source: impl Into<Rectangle>
)
&mut self,
texture: impl AsRef<Texture2D>,
source: impl Into<Rectangle>
)
Define default texture used to draw shapes
fn draw_gui<G: GuiDraw>(&mut self, widget: G) -> DrawResult
fn draw_icon(
&mut self,
icon_id: rIconDescription,
position: impl Into<Vector2>,
pixel_size: i32,
color: impl Into<Color>
)
&mut self,
icon_id: rIconDescription,
position: impl Into<Vector2>,
pixel_size: i32,
color: impl Into<Color>
)
Draw and icon on screen
fn draw_pixel(&mut self, x: i32, y: i32, color: impl Into<Color>)
Draws a pixel.
fn draw_pixel_v(
&mut self,
position: impl Into<Vector2>,
color: impl Into<Color>
)
&mut self,
position: impl Into<Vector2>,
color: impl Into<Color>
)
Draws a pixel (Vector version).
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>
)
&mut self,
start_pos_x: i32,
start_pos_y: i32,
end_pos_x: i32,
end_pos_y: i32,
color: impl Into<Color>
)
Draws a line.
fn draw_line_v(
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
color: impl Into<Color>
)
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
color: impl Into<Color>
)
Draws a line (Vector version).
fn draw_line_ex(
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
thick: f32,
color: impl Into<Color>
)
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
thick: f32,
color: impl Into<Color>
)
Draws a line with thickness.
fn draw_line_bezier(
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
thick: f32,
color: impl Into<Color>
)
&mut self,
start_pos: impl Into<Vector2>,
end_pos: impl Into<Vector2>,
thick: f32,
color: impl Into<Color>
)
Draws a line using cubic-bezier curves in-out.
fn draw_line_strip(&mut self, points: &[Vector2], color: impl Into<Color>)
Draw lines sequence
fn draw_circle(
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color: impl Into<Color>
)
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color: impl Into<Color>
)
Draws a color-filled circle.
fn draw_circle_sector(
&mut self,
center: impl Into<Vector2>,
radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
&mut self,
center: impl Into<Vector2>,
radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
Draw a piece of a circle
fn draw_circle_sector_lines(
&mut self,
center: impl Into<Vector2>,
radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
&mut self,
center: impl Into<Vector2>,
radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
Draw circle sector outline
fn draw_circle_gradient(
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color1: impl Into<Color>,
color2: impl Into<Color>
)
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color1: impl Into<Color>,
color2: impl Into<Color>
)
Draws a gradient-filled circle.
fn draw_circle_v(
&mut self,
center: impl Into<Vector2>,
radius: f32,
color: impl Into<Color>
)
&mut self,
center: impl Into<Vector2>,
radius: f32,
color: impl Into<Color>
)
Draws a color-filled circle (Vector version).
fn draw_circle_lines(
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color: impl Into<Color>
)
&mut self,
center_x: i32,
center_y: i32,
radius: f32,
color: impl Into<Color>
)
Draws circle outline.
fn draw_ring(
&mut self,
center: impl Into<Vector2>,
inner_radius: f32,
outer_radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
&mut self,
center: impl Into<Vector2>,
inner_radius: f32,
outer_radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
Draw ring
fn draw_ring_lines(
&mut self,
center: impl Into<Vector2>,
inner_radius: f32,
outer_radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
&mut self,
center: impl Into<Vector2>,
inner_radius: f32,
outer_radius: f32,
start_angle: i32,
end_angle: i32,
segments: i32,
color: impl Into<Color>
)
Draw ring lines
fn draw_rectangle(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color: impl Into<Color>
)
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color: impl Into<Color>
)
Draws a color-filled rectangle.
fn draw_rectangle_v(
&mut self,
position: impl Into<Vector2>,
size: impl Into<Vector2>,
color: impl Into<Color>
)
&mut self,
position: impl Into<Vector2>,
size: impl Into<Vector2>,
color: impl Into<Color>
)
Draws a color-filled rectangle (Vector version).
fn draw_rectangle_rec(
&mut self,
rec: impl Into<Rectangle>,
color: impl Into<Color>
)
&mut self,
rec: impl Into<Rectangle>,
color: impl Into<Color>
)
Draws a color-filled rectangle from rec
.
fn draw_rectangle_pro(
&mut self,
rec: impl Into<Rectangle>,
origin: impl Into<Vector2>,
rotation: f32,
color: impl Into<Color>
)
&mut self,
rec: impl Into<Rectangle>,
origin: impl Into<Vector2>,
rotation: f32,
color: impl Into<Color>
)
Draws a color-filled rectangle with pro parameters.
fn draw_rectangle_gradient_v(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color1: impl Into<Color>,
color2: impl Into<Color>
)
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color1: impl Into<Color>,
color2: impl Into<Color>
)
Draws a vertical-gradient-filled rectangle.
NOTE: Gradient goes from bottom (color1
) to top (color2
).
fn draw_rectangle_gradient_h(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color1: impl Into<Color>,
color2: impl Into<Color>
)
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color1: impl Into<Color>,
color2: impl Into<Color>
)
Draws a horizontal-gradient-filled rectangle.
NOTE: Gradient goes from bottom (color1
) to top (color2
).
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>
)
&mut self,
rec: impl Into<Rectangle>,
col1: impl Into<Color>,
col2: impl Into<Color>,
col3: impl Into<Color>,
col4: impl Into<Color>
)
Draws a gradient-filled rectangle with custom vertex colors.
NOTE: Colors refer to corners, starting at top-left corner and going counter-clockwise.
fn draw_rectangle_lines(
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color: impl Into<Color>
)
&mut self,
x: i32,
y: i32,
width: i32,
height: i32,
color: impl Into<Color>
)
Draws rectangle outline.
fn draw_rectangle_lines_ex(
&mut self,
rec: impl Into<Rectangle>,
line_thick: i32,
color: impl Into<Color>
)
&mut self,
rec: impl Into<Rectangle>,
line_thick: i32,
color: impl Into<Color>
)
Draws rectangle outline with extended parameters.
fn draw_rectangle_rounded(
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
color: impl Into<Color>
)
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
color: impl Into<Color>
)
Draws rectangle outline with extended parameters.
fn draw_rectangle_rounded_lines(
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
line_thickness: i32,
color: impl Into<Color>
)
&mut self,
rec: impl Into<Rectangle>,
roundness: f32,
segments: i32,
line_thickness: i32,
color: impl Into<Color>
)
Draws rectangle outline with extended parameters.
fn draw_triangle(
&mut self,
v1: impl Into<Vector2>,
v2: impl Into<Vector2>,
v3: impl Into<Vector2>,
color: impl Into<Color>
)
&mut self,
v1: impl Into<Vector2>,
v2: impl Into<Vector2>,
v3: impl Into<Vector2>,
color: impl Into<Color>
)
Draws a triangle.
fn draw_triangle_lines(
&mut self,
v1: impl Into<Vector2>,
v2: impl Into<Vector2>,
v3: impl Into<Vector2>,
color: impl Into<Color>
)
&mut self,
v1: impl Into<Vector2>,
v2: impl Into<Vector2>,
v3: impl Into<Vector2>,
color: impl Into<Color>
)
Draws a triangle using lines.
fn draw_triangle_fan(&mut self, points: &[Vector2], color: impl Into<Color>)
Draw a triangle fan defined by points.
fn draw_poly(
&mut self,
center: impl Into<Vector2>,
sides: i32,
radius: f32,
rotation: f32,
color: impl Into<Color>
)
&mut self,
center: impl Into<Vector2>,
sides: i32,
radius: f32,
rotation: f32,
color: impl Into<Color>
)
Draws a regular polygon of n sides (Vector version).
fn draw_texture(
&mut self,
texture: impl AsRef<Texture2D>,
x: i32,
y: i32,
tint: impl Into<Color>
)
&mut self,
texture: impl AsRef<Texture2D>,
x: i32,
y: i32,
tint: impl Into<Color>
)
Draws a texture
using specified position and tint
color.
fn draw_texture_v(
&mut self,
texture: impl AsRef<Texture2D>,
position: impl Into<Vector2>,
tint: impl Into<Color>
)
&mut self,
texture: impl AsRef<Texture2D>,
position: impl Into<Vector2>,
tint: impl Into<Color>
)
Draws a texture
using specified position
vector and tint
color.
fn draw_texture_ex(
&mut self,
texture: impl AsRef<Texture2D>,
position: impl Into<Vector2>,
rotation: f32,
scale: f32,
tint: impl Into<Color>
)
&mut self,
texture: impl AsRef<Texture2D>,
position: impl Into<Vector2>,
rotation: f32,
scale: f32,
tint: impl Into<Color>
)
Draws a texture
with extended parameters.
fn draw_texture_rec(
&mut self,
texture: impl AsRef<Texture2D>,
source_rec: impl Into<Rectangle>,
position: impl Into<Vector2>,
tint: impl Into<Color>
)
&mut self,
texture: impl AsRef<Texture2D>,
source_rec: impl Into<Rectangle>,
position: impl Into<Vector2>,
tint: impl Into<Color>
)
Draws from a region of texture
defined by the source_rec
rectangle.
fn draw_texture_quad(
&mut self,
texture: impl AsRef<Texture2D>,
tiling: impl Into<Vector2>,
offset: impl Into<Vector2>,
quad: impl Into<Rectangle>,
tint: impl Into<Color>
)
&mut self,
texture: impl AsRef<Texture2D>,
tiling: impl Into<Vector2>,
offset: impl Into<Vector2>,
quad: impl Into<Rectangle>,
tint: impl Into<Color>
)
Draw texture quad with tiling and offset parameters
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>
)
&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>
)
Draw from a region of texture
defined by the source_rec
rectangle with pro parameters.
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>
)
&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>
)
Draws a texture (or part of it) that stretches or shrinks nicely
fn draw_fps(&mut self, x: i32, y: i32)
Shows current FPS.
fn draw_text(
&mut self,
text: &str,
x: i32,
y: i32,
font_size: i32,
color: impl Into<Color>
)
&mut self,
text: &str,
x: i32,
y: i32,
font_size: i32,
color: impl Into<Color>
)
Draws text (using default font).
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>
)
&mut self,
font: impl AsRef<Font>,
text: &str,
position: impl Into<Vector2>,
font_size: f32,
spacing: f32,
tint: impl Into<Color>
)
Draws text using font
and additional parameters.
fn draw_text_rec(
&mut self,
font: impl AsRef<Font>,
text: &str,
rec: impl Into<Rectangle>,
font_size: f32,
spacing: f32,
word_wrap: bool,
tint: impl Into<Color>
)
&mut self,
font: impl AsRef<Font>,
text: &str,
rec: impl Into<Rectangle>,
font_size: f32,
spacing: f32,
word_wrap: bool,
tint: impl Into<Color>
)
Draws text using font
and additional parameters.
fn draw_text_rec_ex(
&mut self,
font: impl AsRef<Font>,
text: &str,
rec: impl Into<Rectangle>,
font_size: f32,
spacing: f32,
word_wrap: bool,
tint: impl Into<Color>,
select_start: i32,
select_length: i32,
select_text: impl Into<Color>,
select_back: impl Into<Color>
)
&mut self,
font: impl AsRef<Font>,
text: &str,
rec: impl Into<Rectangle>,
font_size: f32,
spacing: f32,
word_wrap: bool,
tint: impl Into<Color>,
select_start: i32,
select_length: i32,
select_text: impl Into<Color>,
select_back: impl Into<Color>
)
Draws text using font
and additional parameters.