mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
expand top level crate docs slightly and add hello world example
This commit is contained in:
parent
ecf89a5ba7
commit
574bc93e4f
4 changed files with 36 additions and 12 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
## What is Bevy?
|
||||
|
||||
Bevy is a modular game engine built in Rust, with a focus on developer productivity and performance.
|
||||
Bevy is an open-source modular game engine built in Rust, with a focus on developer productivity and performance.
|
||||
|
||||
## WARNING
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
stage, App, Events,
|
||||
};
|
||||
|
||||
use legion::prelude::{Resources, Runnable, Schedulable, Universe, World};
|
||||
use legion::prelude::{Resources, Runnable, Schedulable, Universe, World, SystemBuilder, CommandBuffer};
|
||||
|
||||
static APP_MISSING_MESSAGE: &str = "This AppBuilder no longer has an App. Check to see if you already called run(). A call to app_builder.run() consumes the AppBuilder's App.";
|
||||
|
||||
|
@ -121,6 +121,15 @@ impl AppBuilder {
|
|||
self.add_system_to_stage(stage::UPDATE, system)
|
||||
}
|
||||
|
||||
pub fn add_system_fn(&mut self, name: &'static str, system: impl Fn(&mut CommandBuffer) + Send + Sync + 'static) -> &mut Self {
|
||||
let built_system = SystemBuilder::new(name)
|
||||
.build(move |command_buffer, _, _, _| {
|
||||
system(command_buffer);
|
||||
});
|
||||
self.add_system_to_stage(stage::UPDATE, built_system);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_startup_system_to_stage(
|
||||
&mut self,
|
||||
stage_name: &str,
|
||||
|
|
8
examples/hello_world.rs
Normal file
8
examples/hello_world.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
App::build()
|
||||
.add_default_plugins()
|
||||
.add_system_fn("hello", |_| println!("hello world!"))
|
||||
.run();
|
||||
}
|
27
src/lib.rs
27
src/lib.rs
|
@ -1,13 +1,20 @@
|
|||
//! Bevy is a modular game engine built in Rust, with a focus on developer productivity and performance.
|
||||
//!
|
||||
//! It has the following design goals:
|
||||
//! * Provide a first class user-experience for both 2D and 3D games
|
||||
//! * Easy for newbies to pick up, but infinitely flexible for power users
|
||||
//! * Fast iterative compile times. Ideally less than 1 second for small to medium sized projects
|
||||
//! * Data-first game development using ECS (Entity Component Systems)
|
||||
//! * High performance and parallel architecture
|
||||
//! * Use the latest and greatest rendering technologies and techniques
|
||||
//!
|
||||
//! Bevy is an open-source modular game engine built in Rust, with a focus on developer productivity and performance.
|
||||
//!
|
||||
//! Check out the [Bevy website](https://bevyengine.org) for more information, read the
|
||||
//! [Bevy Book](https://bevyengine.org/learn/book/introduction) for a step-by-step guide, and [engage with our
|
||||
//! community](https://bevyengine.org/community/) if you have any questions or ideas!
|
||||
//!
|
||||
//! ```
|
||||
//!use bevy::prelude::*;
|
||||
//!
|
||||
//!fn main() {
|
||||
//! App::build()
|
||||
//! .add_default_plugins()
|
||||
//! .add_system_fn("hello", |_| println!("hello world!"))
|
||||
//! .run();
|
||||
//!}
|
||||
//! ```
|
||||
//!
|
||||
//! The "bevy" crate is just a container crate that makes it easier to consume Bevy components.
|
||||
//! The defaults provide a "full" engine experience, but you can easily enable / disable features
|
||||
//! in your project's Cargo.toml to meet your specific needs. See Bevy's Cargo.toml for a full list of features available.
|
||||
|
|
Loading…
Reference in a new issue