Skip to content

Instantly share code, notes, and snippets.

@bones-ai
Last active June 25, 2025 23:17
Show Gist options
  • Save bones-ai/96f165f9206261dd5561338b571c64cd to your computer and use it in GitHub Desktop.
Save bones-ai/96f165f9206261dd5561338b571c64cd to your computer and use it in GitHub Desktop.
An basic empty bevy app template with all the plugins I use
use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
use bevy::prelude::*;
use bevy::window::close_on_esc;
const WW: f32 = 1200.0;
const WH: f32 = 900.0;
const BG_COLOR: (u8, u8, u8) = (25, 20, 43);
fn main() {
App::new()
.add_plugins(
DefaultPlugins
.set(ImagePlugin::default_nearest())
.set(WindowPlugin {
primary_window: Some(Window {
resizable: true,
focused: true,
resolution: (WW, WH).into(),
..default()
}),
..default()
}),
)
.insert_resource(ClearColor(Color::rgb_u8(
BG_COLOR.0, BG_COLOR.1, BG_COLOR.2,
)))
.insert_resource(Msaa::Off)
.add_plugins(LogDiagnosticsPlugin::default())
.add_plugins(FrameTimeDiagnosticsPlugin)
.add_systems(Startup, setup)
.add_systems(Update, close_on_esc)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
}
@bones-ai
Copy link
Author

bones-ai commented Apr 5, 2024

Initial setup that goes into cargo.toml

[workspace]
resolver = "2" # Important! wgpu/Bevy needs this!

# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment