pub struct RaylibFrontend<S, D> { /* private fields */ }Expand description
The main struct that implements the frontend capabilities.
Implementations§
Source§impl<S, D> RaylibFrontend<S, D>
impl<S, D> RaylibFrontend<S, D>
Sourcepub fn new(
automaton: Automaton<S, D>,
update_rate: Duration,
cell_margin: u32,
window_size: (u32, u32),
) -> Self
pub fn new( automaton: Automaton<S, D>, update_rate: Duration, cell_margin: u32, window_size: (u32, u32), ) -> Self
Instantiates the frontend.
You may want to use FrontendBuilder for convenience.
Sourcepub fn window_should_close(&self) -> bool
pub fn window_should_close(&self) -> bool
Checks if the window should close (e.g. esc pressed).
Sourcepub fn tick(&mut self) -> Option<ExecutionState>
pub fn tick(&mut self) -> Option<ExecutionState>
Updates the inner timer to compute the next generation
according to the update rate (see
FrontendBuilder::update_rate()).
Sourcepub fn step(&mut self) -> ExecutionState
pub fn step(&mut self) -> ExecutionState
Computes the next generation of the automaton immediately.
See tick() for properly timed updating.
Sourcepub fn default_key_actions(&mut self)
pub fn default_key_actions(&mut self)
Registers default key actions:
- Space -> Pause
- LMB -> Toggle cell under cursor
Source§impl<S: RenderCell<Color>, D> RaylibFrontend<S, D>
impl<S: RenderCell<Color>, D> RaylibFrontend<S, D>
Sourcepub fn display_grid(&mut self)
pub fn display_grid(&mut self)
Displays the cell grid using Raylib.
Manages the job of clearing the background and drawing all the
cells with respect to their RenderCell implementation.
Auto Trait Implementations§
impl<S, D> Freeze for RaylibFrontend<S, D>
impl<S, D> RefUnwindSafe for RaylibFrontend<S, D>where
S: RefUnwindSafe,
impl<S, D> !Send for RaylibFrontend<S, D>
impl<S, D> !Sync for RaylibFrontend<S, D>
impl<S, D> Unpin for RaylibFrontend<S, D>where
S: Unpin,
impl<S, D> UnwindSafe for RaylibFrontend<S, D>where
S: UnwindSafe,
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