switch to default iris app
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::{AppHandle, ClientEvent};
|
||||
use crate::ClientEvent;
|
||||
use openworm::net::{
|
||||
ClientMsg, RecvHandler, SERVER_NAME, ServerMsg, SkipServerVerification, recv_uni, send_uni,
|
||||
};
|
||||
@@ -13,6 +13,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use winit::{event_loop::EventLoopProxy, window::Window};
|
||||
|
||||
pub const CLIENT_SOCKET: SocketAddr =
|
||||
SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, 0, 0, 0));
|
||||
@@ -26,6 +27,19 @@ pub struct NetHandle {
|
||||
pub thread: JoinHandle<()>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppHandle {
|
||||
pub proxy: EventLoopProxy<ClientEvent>,
|
||||
pub window: Arc<Window>,
|
||||
}
|
||||
|
||||
impl AppHandle {
|
||||
pub fn send(&self, event: ClientEvent) {
|
||||
self.proxy.send_event(event).unwrap_or_else(|_| panic!());
|
||||
self.window.request_redraw();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn connect(handle: AppHandle, info: ConnectInfo) -> JoinHandle<()> {
|
||||
std::thread::spawn(move || {
|
||||
if let Err(msg) = connect_the(handle.clone(), info) {
|
||||
|
||||
Reference in New Issue
Block a user