pub struct AppBuilder { /* private fields */ }Expand description
Builder for App
Implementations§
Source§impl AppBuilder
impl AppBuilder
Sourcepub fn new() -> AppBuilder
pub fn new() -> AppBuilder
Create a new AppBuilder
Examples found in repository?
examples/game.rs (line 8)
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 name(self, name: &'static str) -> AppBuilder
pub fn name(self, name: &'static str) -> AppBuilder
Set the window name
Examples found in repository?
examples/game.rs (line 9)
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 dimensions(self, dimensions: (u32, u32)) -> AppBuilder
pub fn dimensions(self, dimensions: (u32, u32)) -> AppBuilder
Set the window dimensions
Examples found in repository?
examples/game.rs (line 10)
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 config(self, path: &'static str) -> AppBuilder
pub fn config(self, path: &'static str) -> AppBuilder
Set the application config
Examples found in repository?
examples/game.rs (line 11)
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 build(self) -> Result<App>
pub fn build(self) -> Result<App>
Builds an App
Examples found in repository?
examples/game.rs (line 12)
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}Trait Implementations§
Source§impl Debug for AppBuilder
impl Debug for AppBuilder
Source§impl Default for AppBuilder
impl Default for AppBuilder
Source§fn default() -> AppBuilder
fn default() -> AppBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AppBuilder
impl RefUnwindSafe for AppBuilder
impl Send for AppBuilder
impl Sync for AppBuilder
impl Unpin for AppBuilder
impl UnwindSafe for AppBuilder
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().Source§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
Source§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
Source§fn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls
try_default and panics on an error case.