42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
---
|
|
obj: concept
|
|
website: https://bevyengine.org
|
|
repo: https://github.com/bevyengine/bevy
|
|
---
|
|
|
|
# Bevy Engine
|
|
Bevy is a modern, open-source game engine built in **Rust**. It emphasizes simplicity, modularity, and performance, making it an attractive choice for game developers looking for a data-driven, Entity-Component-System (ECS) architecture combined with modern rendering capabilities.
|
|
|
|
## Entity Component System (ECS)
|
|
|
|
* **Entity:** Unique identifier representing a game object.
|
|
* **Component:** Plain data attached to entities.
|
|
* **System:** Logic operating on entities with matching components, executed in parallel where possible.
|
|
|
|
This design promotes separation of data and logic, enabling highly efficient, cache-friendly processing.
|
|
|
|
## Basic Example
|
|
|
|
A simple example creating a window and spawning a 2D sprite:
|
|
|
|
```rust
|
|
use bevy::prelude::*;
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins)
|
|
.add_startup_system(setup)
|
|
.run();
|
|
}
|
|
|
|
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|
// Camera
|
|
commands.spawn(Camera2dBundle::default());
|
|
|
|
// Sprite
|
|
commands.spawn(SpriteBundle {
|
|
texture: asset_server.load("branding/icon.png"),
|
|
..Default::default()
|
|
});
|
|
}
|
|
```
|