App indicate the application which control the life time of the app.
AppBuilder just like a helper to add plugins, resources, systems into the stage, and the systems (game logics)
would be triggered every frame to update the entities on stage(scene), finally the renderer would render the scence.
via Winit to cross platform(native window)
system can query the components to manipulate the properties, ex:
add_system()
Registered components must implement the Properties
and FromResources
traits.
The Properties
trait enables serialization, deserialization, dynamic property access, and change detection.
Properties
enable a bunch of cool behaviors, so its worth checking out the dedicated properties.rs
example.
The FromResources
trait determines how your component is constructed when it loads. For simple use cases you can just implement the Default
trait (which automatically implements FromResources). The simplest registered component just needs these two derives:
#[derive(Properties, Default)]
struct ComponentA {
pub x: f32,
pub y: f32,
}
Some components have fields that cannot (or should not) be written to scene files. These can be ignored with the #[property(ignore)] attribute. This is also generally where the FromResources
trait comes into play.
#[derive(Properties)]
struct ComponentB {
pub value: String,
#[property(ignore)]
pub time_since_startup: Duration,
}
FromResources
gives you access to your App's current ECS Resources
when you construct your component.
Res<T> : Shared borrow of an entity's component.
ResMut<T> : Unique borrow of an entity's component.
Resources : A collection of resource instances identified by their type.
cargo build --release
is much faster then
cargo build (debug)
fn game_loop() {
...
}
App::build()
.set_runner(game_loop)
bevy use glam
for SIMD support.
https://docs.rs/glam/0.11.0/glam/
Assets<ColorMaterial>
also the floating pointer number is more precision within -1~+1
game dev
rust
bevy