1mod net;
2mod util;
3
4#[cfg(feature = "client")]
5mod client;
6
7fn main() {
8
9 #[cfg(not(feature = "client"))]
10 net::handle_net().expect("Network Module Failed.");
11
12 #[cfg(feature = "client")]
13 {
14 use std::sync::mpsc::channel;
15
16 use bevy::{DefaultPlugins, app::{App, FixedUpdate, Startup, Update}, ecs::system::Commands};
17
18 use crate::net::client::component::ClientNetworkingManager;
19
20 let (sender, recv) = channel();
21 let net_manager = ClientNetworkingManager::from(sender);
22
23 net::handle_net(recv).expect("Network Module Failed.");
24
25 App::new()
26 .add_plugins(DefaultPlugins)
27 .add_systems(Startup, client::setup)
28 .add_systems(Startup, move | mut commands: Commands | {
29 commands.spawn(net_manager.clone());
30 })
31 .add_systems(Update, client::debug_camera::update)
32 .add_systems(FixedUpdate, client::debug_camera::fixed_update)
33 .run();
34 }
35}