Function pixel_game_lib::window::window
source · pub fn window<G, U, R>(
game_state: G,
window_config: WindowConfig,
update: U,
render: R
) -> Result<()>where
G: 'static,
U: FnMut(&mut G, &WinitInputHelper, Option<Vec2<usize>>, f32) -> bool + 'static,
R: FnMut(&mut G, &mut Canvas<'_>, f32) + 'static,Expand description
Create a new window with an event loop and run the game.
Arguments
game_state- Global state passed around in the render and update functions.window_config- Configuration options for the window.update- Function called every update tick, arguments are the state, window input event that can be used to handle input events, mouse position in pixels and the time between this and the previous tick. Whentrueis returned the window will be closed.render- Function called every render tick, arguments are the state and the time between this and the previous tick.