Проектная работа - WIP
bevy learning
This commit is contained in:
@@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.18", default-features = false, features = ["2d_bevy_render", "bevy_log", "bevy_winit"] }
|
||||
bevy = { version = "0.18", default-features = false, features = ["2d_bevy_render", "bevy_log", "bevy_winit", "debug"] }
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
/// Эксперименты в ходе прохождения туториала:
|
||||
/// https://github.com/fogarecious/bevy_tutorial
|
||||
use bevy::{prelude::*, winit::WinitSettings};
|
||||
use tracing::Level;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
// .add_plugins(MinimalPlugins)
|
||||
.add_plugins(
|
||||
DefaultPlugins
|
||||
.build()
|
||||
.set(bevy::log::LogPlugin {
|
||||
level: Level::INFO,
|
||||
filter: "bevy_app=trace".to_string(),
|
||||
fmt_layer: |_| snake_game::define_log_layer(),
|
||||
..Default::default()
|
||||
})
|
||||
@@ -18,6 +22,7 @@ fn main() {
|
||||
.insert_resource(WinitSettings::desktop_app())
|
||||
.insert_resource(ClearColor(Color::srgb(0.3, 0.6, 0.8)))
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(PostStartup, print_all_entities)
|
||||
.run();
|
||||
}
|
||||
|
||||
@@ -29,3 +34,9 @@ fn setup(mut commands: Commands) {
|
||||
Sprite::from_color(Color::srgb(1., 1., 1.), Vec2::new(100., 50.)),
|
||||
);
|
||||
}
|
||||
|
||||
fn print_all_entities(mut commands: Commands, query: Query<Entity>) {
|
||||
for entity in query {
|
||||
commands.entity(entity).log_components();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-14
@@ -4,20 +4,7 @@ pub fn define_log_layer() -> Option<bevy::log::BoxedFmtLayer> {
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::{Layer, filter::Targets, fmt::layer};
|
||||
|
||||
let targets = Targets::new()
|
||||
.with_target("bevy_asset", Level::INFO)
|
||||
.with_target("bevy_app", Level::INFO)
|
||||
.with_target("bevy_diagnostic", Level::WARN)
|
||||
.with_target("bevy_render", Level::INFO)
|
||||
.with_target("bevy_shader", Level::INFO)
|
||||
.with_target("bevy_time", Level::INFO)
|
||||
.with_target("bevy_winit", Level::INFO)
|
||||
.with_target("gilrs", Level::INFO)
|
||||
.with_target("naga", Level::INFO)
|
||||
.with_target("wgpu_core", Level::INFO)
|
||||
.with_target("wgpu_hal", Level::WARN)
|
||||
.with_target("offset_allocator", Level::INFO)
|
||||
.with_default(Level::TRACE);
|
||||
let targets = Targets::new().with_default(Level::TRACE);
|
||||
|
||||
let stdout = layer()
|
||||
.compact()
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#[test]
|
||||
fn test_saturating_sub() {
|
||||
let a: usize = 10;
|
||||
dbg!(a.saturating_sub(5));
|
||||
dbg!(a.saturating_sub(10));
|
||||
dbg!(a.saturating_sub(15));
|
||||
}
|
||||
Reference in New Issue
Block a user