forked from janhohenheim/foxtrot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rs
80 lines (74 loc) · 2.9 KB
/
lib.rs
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
// These two generate a lot of false positives for Bevy systems
#![allow(clippy::too_many_arguments, clippy::type_complexity)]
// This is not a library, so we don't need to worry about intra-doc links
#![allow(rustdoc::private_intra_doc_links)]
//! Foxtrot is split into many plugins with their own set of responsibilities.
//! This is an organizational measure and not meant to be imply that you can turn them on or off at will,
//! since the plugins are interdependent.
//! Instead, decide for yourself which features you like and which one's you don't and simply trim the code accordingly.
//! Feel free to [file an issue](https://github.com/janhohenheim/foxtrot/issues/new) if you need help!
//! The docs are organized such that you can click through the plugins to explore the systems at play.
use bevy::prelude::*;
mod bevy_config;
#[cfg(feature = "dev")]
mod dev;
mod file_system_interaction;
mod ingame_menu;
mod level_instantiation;
mod menu;
pub(crate) mod movement;
pub(crate) mod particles;
mod player_control;
mod shader;
mod system_set;
pub(crate) mod util;
mod world_interaction;
pub(crate) use system_set::GameSystemSet;
#[derive(States, Default, Clone, Eq, PartialEq, Debug, Hash)]
enum GameState {
/// During the loading State the loading_plugin will load our assets
#[default]
Loading,
/// During this State the actual game logic is executed
Playing,
/// Here the menu is drawn and waiting for player interaction
Menu,
}
/// Main entrypoint for Foxtrot.
///
/// The top-level plugins are:
/// - [`system_set::plugin`]: Sets up the system set used to order systems across Foxtrot.
/// - [`bevy_config::plugin`]: Sets up the bevy configuration.
/// - [`menu::plugin`]: Handles the menu.
/// - [`movement::plugin`]: Handles the movement of entities.
/// - [`player_control::plugin`]: Handles the player's control.
/// - [`world_interaction::plugin`]: Handles the interaction of entities with the world.
/// - [`level_instantiation::plugin`]: Handles the creation of levels and objects.
/// - [`file_system_interaction::plugin`]: Handles the loading and saving of games.
/// - [`shader::plugin`]: Handles the shaders.
/// - [`dev::plugin`]: Handles the dev tools.
/// - [`ingame_menu::plugin`]: Handles the ingame menu accessed via ESC.
/// - [`particles::plugin`]: Handles the particle system.
pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut App) {
app
.add_plugins((
system_set::plugin,
bevy_config::plugin,
menu::plugin,
movement::plugin,
player_control::plugin,
world_interaction::plugin,
level_instantiation::plugin,
file_system_interaction::plugin,
shader::plugin,
ingame_menu::plugin,
particles::plugin,
#[cfg(feature = "dev")]
dev::plugin,
))
.init_state::<GameState>()
;
}
}