pub struct Color(_, _, _, _);Implementations§
source§impl Color
impl Color
pub fn rgb(r: u8, g: u8, b: u8) -> Color
pub fn rgba(r: u8, g: u8, b: u8, a: u8) -> Color
sourcepub fn black() -> Self
pub fn black() -> Self
Examples found in repository?
examples/canvas.rs (line 30)
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
fn run(&mut self, dt: f32, render: &mut Self::Render) -> bool {
let speed = 80.0 * dt;
self.time = self.time + (dt * 30.0);
if cafe::keyboard::is_down(Scancode::Left) {
self.pos -= Vec2::new(speed, 0.0);
}
else if cafe::keyboard::is_down(Scancode::Right) {
self.pos += Vec2::new(speed, 0.0);
}
render.begin();
render.set_clear_color(Color::black());
render.clear();
render.set_canvas(Some(&self.canvas));
render.clear();
render.draw_rect(&Rect::new(self.pos.x, self.pos.y, 32.0, 64.0));
// render.hello_triangle();
render.set_canvas(None);
render.blit(&self.canvas, None, 0.0, 0.0);
render.blit_rotate(&self.canvas, None, 32.0, 64.0, self.time);
render.fill_circle(32.0, 64.0, 8.0);
render.hello_triangle();
render.end();
true
}pub fn white() -> Self
pub fn to_vec4(&self) -> Vec4
Trait Implementations§
source§impl Ord for Color
impl Ord for Color
source§impl PartialEq<Color> for Color
impl PartialEq<Color> for Color
source§impl PartialOrd<Color> for Color
impl PartialOrd<Color> for Color
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for Color
impl Eq for Color
impl StructuralEq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more