diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/main.rs b/src/main.rs index 368f439..2e379fc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,11 @@ -#![feature(iterator_try_collect)] -use config::Config; -use game::{server::game_server, Game}; -use spectate::server::spectate_server; -use std::sync::Arc; -use tokio::{ - spawn, - sync::{broadcast, RwLock}, +use gpn_tron2::{ + config::Config, + game::{server::game_server, Game}, + spectate::server::spectate_server, + State, }; - -pub mod config; -pub mod game; -pub mod spectate; - -pub struct State { - tick: broadcast::Sender<bool>, // true for new game - game: RwLock<Game>, -} +use std::sync::Arc; +use tokio::{spawn, sync::broadcast}; #[tokio::main] async fn main() -> anyhow::Result<()> { @@ -24,6 +14,8 @@ async fn main() -> anyhow::Result<()> { let state = Arc::new(State { tick: broadcast::channel(16).0, game: Game::new(vec![]).into(), + players: Default::default(), + chat: broadcast::channel(16).0, }); spawn(spectate_server(config.spectate, state.clone())); game_server(config.game, state.clone()).await?; |