From 69584a302d132dc2bcc3837437e7347a3e0a5114 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 14 Mar 2024 06:43:53 +0100 Subject: feat: players can teleport --- src/main.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e7a11a9..cdd7c17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,27 @@ +use lightyear::transport::io::TransportConfig; +use shared::SERVER_PORT; +use std::net::Ipv4Addr; +use std::net::SocketAddr; +use std::thread; + +mod client; +mod protocol; +mod server; +mod shared; + fn main() { - println!("Hello, world!"); + let (from_server_send, from_server_recv) = crossbeam_channel::unbounded(); + let (to_server_send, to_server_recv) = crossbeam_channel::unbounded(); + + thread::spawn(|| { + let server_addr = SocketAddr::new(Ipv4Addr::new(0, 0, 0, 0).into(), SERVER_PORT); + server::main(TransportConfig::Channels { + channels: [(server_addr, to_server_recv, from_server_send)].to_vec(), + }); + }); + + client::main(TransportConfig::LocalChannel { + recv: from_server_recv, + send: to_server_send, + }); } -- cgit v1.2.3