pub struct Color(/* private fields */);
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 fn run(&mut self, dt: f32, render: &mut Self::Render) -> bool {
21 let speed = 80.0 * dt;
22 self.time = self.time + (dt * 30.0);
23 if cafe::keyboard::is_down(Scancode::Left) {
24 self.pos -= Vec2::new(speed, 0.0);
25 }
26 else if cafe::keyboard::is_down(Scancode::Right) {
27 self.pos += Vec2::new(speed, 0.0);
28 }
29 render.begin();
30 render.set_clear_color(Color::black());
31 render.clear();
32
33 render.set_canvas(Some(&self.canvas));
34 render.clear();
35 render.draw_rect(&Rect::new(self.pos.x, self.pos.y, 32.0, 64.0));
36 // render.hello_triangle();
37 render.set_canvas(None);
38
39 render.blit(&self.canvas, None, 0.0, 0.0);
40 render.blit_rotate(&self.canvas, None, 32.0, 64.0, self.time);
41 render.fill_circle(32.0, 64.0, 8.0);
42 render.hello_triangle();
43
44 render.end();
45 true
46 }
pub fn white() -> Self
pub fn to_vec4(&self) -> Vec4
Trait Implementations§
Source§impl Ord for Color
impl Ord for Color
Source§impl PartialOrd for Color
impl PartialOrd for Color
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
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