[−][src]Enum gameloop::FrameAction
Represents a tick or render instruction, to be interpreted by your game.
Example
ⓘThis example is not tested
let mut my_game = MyGame::default(); let game_loop = GameLoop::new(20, 5).unwrap(); while !my_game.should_quit() { my_game.handle_window_events(); for action in game_loop.actions() { match action { FrameAction::Tick => my_game.tick(), FrameAction::Render { interpolation } => { let prev_state = my_game.previous_state(); let curr_state = my_game.current_state(); let interpolated_state = prev_state.interpolate(curr_state, interpolation); my_game.render(interpolated_state); } } } }
Variants
The game should simulate one tick.
The game should render the game state interpolated by the given amount between the previous tick and the current.
Fields of Render
interpolation: f64
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FrameAction
impl Send for FrameAction
impl Sync for FrameAction
impl Unpin for FrameAction
impl UnwindSafe for FrameAction
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,