Struct Macropix

Source
pub struct Macropix {
    pub camera_position: Vec2,
    /* private fields */
}

Fields§

§camera_position: Vec2

Implementations§

Source§

impl Macropix

Source

pub fn new(width: u32, height: u32) -> Self

Examples found in repository?
examples/pixel.rs (line 6)
5async fn main() {
6    let mut pix = Macropix::new(100, 100);
7
8    loop {
9        let mouse_pos = pix.mouse_position();
10
11        pix.begin_draw();
12        clear_background(BLACK);
13        draw_circle_lines(mouse_pos.x, mouse_pos.y, 5.0, 1.0, WHITE);
14        pix.end_draw();
15
16        next_frame().await;
17    }
18}
Source

pub fn mouse_position(&self) -> Vec2

Examples found in repository?
examples/pixel.rs (line 9)
5async fn main() {
6    let mut pix = Macropix::new(100, 100);
7
8    loop {
9        let mouse_pos = pix.mouse_position();
10
11        pix.begin_draw();
12        clear_background(BLACK);
13        draw_circle_lines(mouse_pos.x, mouse_pos.y, 5.0, 1.0, WHITE);
14        pix.end_draw();
15
16        next_frame().await;
17    }
18}
Source

pub fn begin_draw(&mut self)

Examples found in repository?
examples/pixel.rs (line 11)
5async fn main() {
6    let mut pix = Macropix::new(100, 100);
7
8    loop {
9        let mouse_pos = pix.mouse_position();
10
11        pix.begin_draw();
12        clear_background(BLACK);
13        draw_circle_lines(mouse_pos.x, mouse_pos.y, 5.0, 1.0, WHITE);
14        pix.end_draw();
15
16        next_frame().await;
17    }
18}
Source

pub fn end_draw(&mut self)

Examples found in repository?
examples/pixel.rs (line 14)
5async fn main() {
6    let mut pix = Macropix::new(100, 100);
7
8    loop {
9        let mouse_pos = pix.mouse_position();
10
11        pix.begin_draw();
12        clear_background(BLACK);
13        draw_circle_lines(mouse_pos.x, mouse_pos.y, 5.0, 1.0, WHITE);
14        pix.end_draw();
15
16        next_frame().await;
17    }
18}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,