Skip to content

Commit

Permalink
explicit typing to help method resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
evido committed Mar 22, 2022
1 parent 97709d5 commit 74be8a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion raylib/src/core/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::ffi::CString;
/// ```rust
/// use raylib::*;
/// fn main() {
/// let r = get_random_value(0, 10);
/// let r = get_random_value::<i32>(0, 10);
/// println!("random value: {}", r);
/// }
pub fn get_random_value<T: From<i32>>(min: i32, max: i32) -> T {
Expand Down
8 changes: 3 additions & 5 deletions showcase/src/example/textures/textures_mouse_painting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ pub fn run(mut rl: &mut RaylibHandle, thread: &RaylibThread) -> crate::SampleOut
Color::DARKBLUE,
Color::PURPLE,
Color::VIOLET,
Color::DARKPURPLE,
Color::BEIGE,
Color::BROWN,
Color::DARKBROWN,
Color::LIGHTGRAY,
Color::GRAY,
Color::DARKGRAY,
Expand All @@ -66,7 +64,7 @@ pub fn run(mut rl: &mut RaylibHandle, thread: &RaylibThread) -> crate::SampleOut
let mut color_mouse_hover = None;
let mut brush_size = 20;

let btn_save_rec = rrect(750, 10, 40, 30);
let btn_save_rec = rrect::<i32, i32, i32, i32>(750, 10, 40, 30);
let mut btn_save_mouse_hover = false;
let mut show_save_message = false;
let mut save_message_counter = 0;
Expand Down Expand Up @@ -211,8 +209,8 @@ pub fn run(mut rl: &mut RaylibHandle, thread: &RaylibThread) -> crate::SampleOut
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
d.draw_texture_rec(
&target,
rrect(0, 0, target.texture.width, -target.texture.height),
rvec2(0, 0),
rrect::<i32, i32, i32, i32>(0, 0, target.texture.width, -target.texture.height),
rvec2::<i32, i32>(0, 0),
Color::WHITE,
);

Expand Down

0 comments on commit 74be8a7

Please sign in to comment.