pub struct Sketch<S: State> {Show 16 fields
pub width: usize,
pub height: usize,
pub is_looping: bool,
pub frame_count: u32,
pub delta_time: f32,
pub mouse_x: f32,
pub mouse_y: f32,
pub mouse_is_pressed: bool,
pub mouse_button: MouseButton,
pub draw_method: Option<fn(_: &mut Self)>,
pub setup_method: Option<fn(_: &mut Self)>,
pub mouse_pressed_method: Option<fn(_: &mut Self)>,
pub mouse_released_method: Option<fn(_: &mut Self)>,
pub key_pressed_method: Option<fn(_: &mut Self, _: Key)>,
pub key_released_method: Option<fn(_: &mut Self, _: Key)>,
pub state: S,
/* private fields */
}Fields§
§width: usize§height: usize§is_looping: bool§frame_count: u32§delta_time: f32§mouse_x: f32§mouse_y: f32§mouse_is_pressed: bool§draw_method: Option<fn(_: &mut Self)>§setup_method: Option<fn(_: &mut Self)>§mouse_pressed_method: Option<fn(_: &mut Self)>§mouse_released_method: Option<fn(_: &mut Self)>§key_pressed_method: Option<fn(_: &mut Self, _: Key)>§key_released_method: Option<fn(_: &mut Self, _: Key)>§state: SImplementations§
Source§impl<S: State> Sketch<S>
impl<S: State> Sketch<S>
pub fn from_size(width: usize, height: usize, state: S) -> Sketch<S>
pub fn name(&mut self, name: &str)
pub fn key_is_down(&self, key: Key) -> bool
pub fn no_loop(&mut self)
pub fn framerate(&mut self, fps: usize)
pub fn fill(&mut self, color: u32)
pub fn no_fill(&mut self)
pub fn stroke(&mut self, color: u32)
pub fn no_stroke(&mut self)
pub fn stroke_weight(&mut self, weight: i8)
pub fn stroke_mode(&mut self, mode: StrokeMode)
pub fn fill_pixel(&mut self, x: u32, y: u32)
pub fn stroke_pixel(&mut self, x: u32, y: u32)
pub fn rect(&mut self, x: u32, y: u32, w: u32, h: u32)
pub fn triangle(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, x2: i32, y2: i32)
pub fn circle(&mut self, x: i32, y: i32, r: i32)
pub fn background(&mut self, color: u32)
pub fn save(&mut self, file_path: &str)
pub fn generate_mask(&self) -> Vec<(i8, i8)>
pub fn line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32)
Auto Trait Implementations§
impl<S> Freeze for Sketch<S>where
S: Freeze,
impl<S> !RefUnwindSafe for Sketch<S>
impl<S> !Send for Sketch<S>
impl<S> !Sync for Sketch<S>
impl<S> Unpin for Sketch<S>where
S: Unpin,
impl<S> !UnwindSafe for Sketch<S>
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> 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