Skip to content

Instantly share code, notes, and snippets.

@ChristopherBiscardi
ChristopherBiscardi / bevys-4th-birthday.org
Created September 8, 2024 22:36
Bevy's 4th Birthday

Bevy’s 4th birthday.

Its Bevy’s 4th birthday and while I’ve been around for a couple of previous birthday posts I’ve never written something myself.

This year I chose to step up into some additional maintainer duties on ecosystem crates like bevy_ecs_tilemap, which I consider foundational and important to update to new versions, and I started This Week in Bevy, which I’ll talk about a bit more later.

Why Bevy?

The overriding reason I started writing Rust in the first place is that it expanded the kinds of programs I could write. Game development falls into that category, so I started working with Bevy a number of years ago, before there were regular releases, but really ramped up when 0.8 introduced the Material APIs which really inspired me to dig deeper into rendering, and feel like this year was an

@ChristopherBiscardi
ChristopherBiscardi / changes.diff
Created August 27, 2024 23:43
center-of-tile bevy_ecs_tilemap
diff --git a/examples/mouse_to_tile.rs b/examples/mouse_to_tile.rs
index 9ea13ec..3b03fc0 100644
--- a/examples/mouse_to_tile.rs
+++ b/examples/mouse_to_tile.rs
@@ -1,4 +1,8 @@
-use bevy::{color::palettes, math::Vec4Swizzles};
+use bevy::{
+ color::palettes::{self, tailwind::GREEN_400},
+ math::Vec4Swizzles,
+ sprite::MaterialMesh2dBundle,
@ChristopherBiscardi
ChristopherBiscardi / main.rs
Created August 16, 2024 04:55
all events get read
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(
Update,
(
produce,
read_one.run_if(on_event::<MyEvent>()),
@ChristopherBiscardi
ChristopherBiscardi / insert_if.rs
Created July 21, 2024 22:14
InsertIf for Bevy
use bevy::{ecs::system::EntityCommand, prelude::*};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, (startup, log).chain())
.run();
}
fn startup(mut commands: Commands) {
@ChristopherBiscardi
ChristopherBiscardi / calculator.bevy.rs
Created July 19, 2024 19:29
A calculator in bevy! (codegolf)
use std::ops::Deref;
use bevy::{color::palettes::tailwind::*, prelude::*};
use calc::*;
use itertools::Itertools;
use rust_decimal::prelude::*;
fn main() {
App::new()
.insert_resource(ClearColor(SLATE_950.into()))
@ChristopherBiscardi
ChristopherBiscardi / _readme.md
Last active July 8, 2024 20:16
IceSentry Shield from Bevy 0.10 release post
@ChristopherBiscardi
ChristopherBiscardi / no_pow.asm
Created December 5, 2023 02:04
Assembly output of the detailed rust files using godbolt rust 1.73
# Compilation provided by Compiler Explorer at https://godbolt.org/
example::no_pow:
push rax
mov eax, edi
sub eax, 1
mov dword ptr [rsp + 4], eax
cmp edi, 1
setb al
test al, 1
jne .LBB0_2
@ChristopherBiscardi
ChristopherBiscardi / custom_error.rs
Created February 7, 2023 14:19
nom custom error examples
use color_eyre::eyre::{Result, Context};
use nom::{
bytes::complete::tag,
character::complete::alpha1,
combinator::rest,
error::{ErrorKind, ParseError},
sequence::preceded,
*,
};
use thiserror::Error; // 1.0.38
@ChristopherBiscardi
ChristopherBiscardi / .yabairc
Created September 11, 2022 21:08
What VSCode theme is that? youtube video
# the scripting-addition must be loaded manually if
# you are running yabai on macOS Big Sur. Uncomment
# the following line to have the injection performed
# when the config is executed during startup.
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
#import bevy_pbr::mesh_view_bindings
#import bevy_pbr::mesh_bindings
// NOTE: Bindings must come before functions that use them!
#import bevy_pbr::mesh_functions
#import bevy_shader_utils::simplex_noise_3d
#import bevy_shader_utils::simplex_noise_2d
struct StandardMaterial {