This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::time::Duration; | |
use bevy::color::palettes::css::RED; | |
use bevy::math::VectorSpace; | |
use bevy::prelude::*; | |
use bevy::time::common_conditions::once_after_delay; | |
fn main() { | |
App::new() | |
.add_plugins(DefaultPlugins) | |
.add_systems(Startup, |mut commands: Commands| { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::prelude::*; | |
fn main() { | |
// create an alternative Update schedule with a new set of systems | |
// and store it in a resource to swap later | |
let mut update = Schedule::new(Update); | |
update.add_systems(bar); | |
let mut app = App::new(); | |
app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[allow(unused_imports)] | |
use tracing::{info,warn,debug,error}; | |
use std::{io, fs}; | |
use std::path::Path; | |
use tracing_appender::non_blocking::WorkerGuard; | |
use tracing_subscriber::{fmt, layer::SubscriberExt, EnvFilter }; | |
/// Sets up logging to both stdout and files | |
pub fn setup<P: AsRef<Path> + Clone>(crate_name: &str, dir: P) -> WorkerGuard { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::prelude::*; | |
use bevy::reflect::{GetTypeRegistration, ReflectMut, Typed, TypeInfo}; | |
fn main() { | |
let mut app = App::new(); | |
app | |
.add_plugins(MinimalPlugins) | |
.register_type_data::<String, ReflectFoo>() | |
.register_type_data::<usize, ReflectFoo>() | |
.register_type_data::<bool, ReflectFoo>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>BEVY</title> | |
<link data-trunk rel="copy-dir" href="assets" /> | |
<style> | |
body, html { | |
height: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::app::prelude::*; | |
use dyn_clone::DynClone; | |
pub trait AppExt { | |
fn add_all_plugins(&mut self); | |
} | |
impl AppExt for App { | |
fn add_all_plugins(&mut self) { | |
for plugin in inventory::iter::<AutoPlugin> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[features] | |
default = ["tracy"] | |
tracy = [] | |
[dependencies] | |
tracing = "0.1" | |
tracing-appender = "0.2" | |
tracing-subscriber = { version = "0.3", features = ["env-filter"] } | |
tracing-tracy = "0.11.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fs::File; | |
use std::io::{BufWriter, Read}; | |
use walkdir::WalkDir; | |
use foo::Foo; | |
/// Converts postcard `.post` files to bincode `.bin` files assuming they represent `Foo` data | |
fn main() -> anyhow::Result<()> { | |
let root = std::env::current_dir()?.join("data"); | |
for entry in WalkDir::new(&root).sort_by_file_name().into_iter().filter_map(|e| e.ok()) { | |
let path = entry.into_path(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::prelude::*; | |
fn main() { | |
divan::main(); | |
} | |
#[divan::bench] | |
fn reflect() { | |
let mut input: Box<dyn MovementField> = Box::new(PlayerInput::default()); | |
for n in 1..=1000 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::app::AppExit; | |
use bevy::prelude::*; | |
use bevy::window::WindowCloseRequested; | |
fn main() { | |
App::new() | |
.init_state::<ExitState>() | |
.add_plugins(DefaultPlugins.set(WindowPlugin { | |
close_when_requested: false, | |
..default() |
NewerOlder