-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathlib.rs.template
More file actions
90 lines (81 loc) · 2.58 KB
/
Copy pathlib.rs.template
File metadata and controls
90 lines (81 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Support configuring Bevy lints within code.
#![cfg_attr(bevy_lint, feature(register_tool), register_tool(bevy))]
mod asset_tracking;
mod audio;
mod demo;
#[cfg(feature = "dev")]
mod dev_tools;
mod screens;
mod theme;
use bevy::{
asset::AssetMetaCheck,
audio::{AudioPlugin, Volume},
prelude::*,
};
pub struct AppPlugin;
impl Plugin for AppPlugin {
fn build(&self, app: &mut App) {
// Order new `AppSystems` variants by adding them here:
app.configure_sets(
Update,
(
AppSystems::TickTimers,
AppSystems::RecordInput,
AppSystems::Update,
)
.chain(),
);
// Spawn the main camera.
app.add_systems(Startup, spawn_camera);
// Add Bevy plugins.
app.add_plugins(
DefaultPlugins
.set(AssetPlugin {
// Wasm builds will check for meta files (that don't exist) if this isn't set.
// This causes errors and even panics on web build on itch.
// See https://github.com/bevyengine/bevy_github_ci_template/issues/48.
meta_check: AssetMetaCheck::Never,
..default()
})
.set(WindowPlugin {
primary_window: Window {
title: "{{project-name | title_case}}".to_string(),
fit_canvas_to_parent: true,
..default()
}
.into(),
..default()
})
.set(AudioPlugin {
global_volume: GlobalVolume {
volume: Volume::Linear(0.3),
},
..default()
}),
);
// Add other plugins.
app.add_plugins((
asset_tracking::plugin,
demo::plugin,
#[cfg(feature = "dev")]
dev_tools::plugin,
screens::plugin,
theme::plugin,
));
}
}
/// High-level groupings of systems for the app in the `Update` schedule.
/// When adding a new variant, make sure to order it in the `configure_sets`
/// call above.
#[derive(SystemSet, Debug, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord)]
enum AppSystems {
/// Tick timers.
TickTimers,
/// Record player input.
RecordInput,
/// Do everything else (consider splitting this into further variants).
Update,
}
fn spawn_camera(mut commands: Commands) {
commands.spawn((Name::new("Camera"), Camera2d));
}