cargo: lockfile

cargo: deps and compile options

nix: shell.nix

nix: add flake

nix: use rustoverlay; thanks nullcube <3

actually using bevy

more bevy gettings started code

default plugins

custom plugin

resources

remove hello

nix: rust-bin

formatting

nix: shell.nix works standalone again

circle time

nix: drop aarch64-linux

I don't know if it ever worked, not gonna claim I did

nix: formatting

assets: add firasans

update bevy

beeg comment

use clang + mold: experimental

some tiles?

winit desktop app

off by one errors baby

compute tile offset

variable naming

add Board marker

simpler calculation

hee hee spinny square

Revert "hee hee spinny square"

This reverts commit 26cf4c745314674fb3886409a34a358faf3dd89d.

easier numbers?

xyz defaults to 0

mod_picking

bevy-inspector-egui

Init
main
Zynh Ludwig 2024-07-29 21:45:52 -07:00
commit 190ac3b9d5
8 changed files with 4477 additions and 0 deletions

8
.cargo/config.toml Normal file
View File

@ -0,0 +1,8 @@
[target.x86_64-unknown-linux-gnu]
rustflags = [
# (Nightly) Make the current crate share its generic instantiations
"-Zshare-generics=y",
"-C",
"link-arg=-fuse-ld=mold",
]
linker = "clang"

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

4297
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

34
Cargo.toml Normal file
View File

@ -0,0 +1,34 @@
[package]
name = "boids-rs"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = "0.14.1"
# Enable a small amount of optimization in the dev profile.
[profile.dev]
opt-level = 1
# Enable a large amount of optimization in the dev profile for dependencies.
[profile.dev.package."*"]
opt-level = 3
# Enable more optimization in the release profile at the cost of compile time.
[profile.release]
# Compile the entire crate as one unit.
# Slows compile times, marginal improvements.
codegen-units = 1
# Do a second optimization pass over the entire program, including dependencies.
# Slows compile times, marginal improvements.
lto = "thin"
# Optimize for size in the wasm-release profile to reduce load times and bandwidth usage on web.
[profile.wasm-release]
# Default to release profile values.
inherits = "release"
# Optimize with size in mind (also try "z", sometimes it is better).
# Slightly slows compile times, great improvements to file size and runtime performance.
opt-level = "s"
# Strip all debugging information from the binary to slightly reduce file size.
strip = "debuginfo"

48
flake.lock Normal file
View File

@ -0,0 +1,48 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1722062969,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722305989,
"narHash": "sha256-ljiuTGSFuEtudqFqp/5Wr1OuEsVCjur/F2CmlNujSjc=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "38c2f156fca1868c8be7195ddac150522752f6ab",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

36
flake.nix Normal file
View File

@ -0,0 +1,36 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, rust-overlay, ... }:
let
# System types to support.
supportedSystems = [
"x86_64-linux"
];
forAllSystems = function: nixpkgs.lib.genAttrs supportedSystems
(system: function (import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
}));
in
{
devShells = forAllSystems
(pkgs: {
default = import ./shell.nix {
inherit pkgs;
additionalBuildInputs = [
(pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))
];
};
});
};
}

25
shell.nix Normal file
View File

@ -0,0 +1,25 @@
{ pkgs ? import <nixpkgs> { }, additionalBuildInputs ? [ ] }:
with pkgs;
mkShell rec {
nativeBuildInputs = [
pkg-config
mold
clang
];
buildInputs = [
udev
alsa-lib
vulkan-loader
xorg.libX11 # To use the x11 feature
xorg.libXcursor
xorg.libXrandr
xorg.libXi
libxkbcommon # To use the wayland feature
wayland
] ++ additionalBuildInputs;
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
}

28
src/main.rs Normal file
View File

@ -0,0 +1,28 @@
#![allow(unused)]
use bevy::{prelude::*, sprite::MaterialMesh2dBundle};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
#[derive(Component)]
struct Boid;
struct BoidBundle {
outer_mesh: MaterialMesh2dBundle<ColorMaterial>,
inner_mesh: MaterialMesh2dBundle<ColorMaterial>,
position: TransformBundle,
velocity: Vec2,
}
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
}