pub struct Pixel {
pub position: GridPosition,
pub color: Color,
}
Fields§
§position: GridPosition
§color: Color
Implementations§
Source§impl Pixel
impl Pixel
Sourcepub fn new(position: GridPosition, color: Color) -> Self
pub fn new(position: GridPosition, color: Color) -> Self
Examples found in repository?
More examples
examples/simple_render.rs (line 54)
43 fn mouse_button_down_event(
44 &mut self,
45 _ctx: &mut Context,
46 _button: MouseButton,
47 x: f32,
48 y: f32,
49 ) -> GameResult {
50 let position = GridPosition::from_vec2(Vec2::new(x, y), CELL_SIZE);
51
52 println!("Adding pixel at {:?}", position);
53
54 let pixel = Pixel::new(position, Color::new(0.0, 0.0, 0.0, 1.0));
55 self.pixel_handler.pixels.insert(position, pixel);
56
57 Ok(())
58 }
pub fn append_to_mesh(&mut self, mesh_builder: &mut MeshBuilder)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pixel
impl RefUnwindSafe for Pixel
impl Send for Pixel
impl Sync for Pixel
impl Unpin for Pixel
impl UnwindSafe for Pixel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
Source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more