playing with bevy

This commit is contained in:
Edgar 2023-05-04 19:41:55 +02:00
parent a101f5b187
commit 3a582c8ec4
7 changed files with 3895 additions and 1 deletions

3860
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,4 +5,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev.package."*"]
opt-level = 3
[dependencies]
bevy = { version = "0.10.1", features = ["dynamic_linking"] }
bevy-inspector-egui = "0.18.3"

View file

@ -1 +1,3 @@
# teecity
`cargo run --features bevy/dynamic_linking`

2
rust-toolchain.toml Normal file
View file

@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"

1
src/entity.rs Normal file
View file

@ -0,0 +1 @@
use bevy::prelude::*;

View file

@ -1,3 +1,19 @@
use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;
pub mod entity;
pub mod player;
fn main() {
println!("Hello, world!");
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(player::add_player)
.run();
}
fn print_position_system(query: Query<&Transform>) {
for transform in &query {
println!("position: {:?}", transform.translation);
}
}

8
src/player.rs Normal file
View file

@ -0,0 +1,8 @@
use bevy::prelude::*;
#[derive(Component)]
pub struct Player;
pub fn add_player(mut commands: Commands) {
commands.spawn((Player, Name::new("Ryo"), Transform::default()));
}