pub struct App {
pub window: Window,
pub world: World,
pub dispatcher: Dispatcher<'static, 'static>,
}Expand description
The application struct which contains fennel_core::Window, specs::World and specs
Dispatcher
Fields§
§window: WindowResponsible for GFX and audio
world: WorldECS world
dispatcher: Dispatcher<'static, 'static>ECS dispatcher
Implementations§
Source§impl App
impl App
Sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
Runs the event loop, must be called only once, UB otherwise
Examples found in repository?
examples/game.rs (line 33)
7async fn main() -> anyhow::Result<()> {
8 let mut app = AppBuilder::new()
9 .name("game")
10 .dimensions((800, 800))
11 .config("fennel-engine/examples/game.toml")
12 .build()
13 .unwrap();
14
15 app
16 .world
17 .create_entity()
18 .with(Sprite {
19 image: String::from("assets/example.png"),
20 position: (100.0, 100.0)
21 })
22 .build();
23
24 app
25 .world
26 .create_entity()
27 .with(Sprite {
28 image: String::from("assets/example.png"),
29 position: (300.0, 100.0)
30 })
31 .build();
32
33 app.run().await?;
34 Ok(())
35}Sourcepub fn frame_tick(&mut self)
pub fn frame_tick(&mut self)
Evaluate systems
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