pub struct App {
pub window: Window,
pub world: World,
pub dispatcher: Dispatcher<'static, 'static>,
}Fields§
§window: Window§world: World§dispatcher: Dispatcher<'static, 'static>Implementations§
Source§impl App
impl App
Sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
Examples found in repository?
examples/game.rs (line 32)
7async fn main() -> anyhow::Result<()> {
8 let mut app = AppBuilder::new()
9 .name("game")
10 .dimensions((800, 800))
11 .build()
12 .unwrap();
13
14 app
15 .world
16 .create_entity()
17 .with(Sprite {
18 image: String::from("assets/example.png"),
19 position: (100.0, 100.0)
20 })
21 .build();
22
23 app
24 .world
25 .create_entity()
26 .with(Sprite {
27 image: String::from("assets/example.png"),
28 position: (300.0, 100.0)
29 })
30 .build();
31
32 app.run().await?;
33 Ok(())
34}pub fn frame_tick(&mut self)
Trait Implementations§
Source§impl WindowEventHandler for App
impl WindowEventHandler for App
fn update(&self, _window: &mut Window) -> Result<()>
fn draw(&mut self, window: &mut Window) -> Result<()>
fn key_down_event( &self, _window: &mut Window, event: KeyboardEvent, ) -> Result<()>
fn key_up_event( &self, _window: &mut Window, _event: KeyboardEvent, ) -> Result<(), Error>
fn mouse_motion_event( &self, _window: &mut Window, _event: MouseMotionEvent, ) -> Result<(), Error>
fn mouse_wheel_event( &self, _window: &mut Window, _event: MouseWheelEvent, ) -> Result<(), Error>
impl Send for App
impl Sync for App
Auto Trait Implementations§
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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