more refactor

This commit is contained in:
2025-11-18 02:38:23 -05:00
parent db15f43610
commit 01cd02c0f9
11 changed files with 39 additions and 24 deletions

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -1,13 +1,18 @@
#![windows_subsystem = "windows"]
use crate::{app::App, net::NetSender, ui::*};
use crate::{
app::App,
net::NetSender,
rsc::{CLIENT_DATA, ClientData},
ui::*,
};
pub use app::AppHandle;
use arboard::Clipboard;
use input::Input;
use iris::prelude::*;
use openworm::{
net::{ClientMsg, ServerMsg, install_crypto_provider},
rsc::{CLIENT_DATA, ClientData, DataDir},
rsc::DataDir,
};
use render::Renderer;
use std::sync::Arc;
@@ -17,17 +22,18 @@ use winit::{
window::Window,
};
fn main() {
install_crypto_provider();
App::run();
}
mod app;
mod input;
mod net;
mod render;
mod rsc;
mod ui;
fn main() {
install_crypto_provider();
App::run();
}
pub enum ClientEvent {
Connect { send: NetSender, username: String },
ServerMsg(ServerMsg),

16
src/bin/client/rsc.rs Normal file
View File

@@ -0,0 +1,16 @@
pub const CLIENT_DATA: &str = "client_data";
#[derive(bincode::Encode, bincode::Decode)]
pub struct ClientData {
pub ip: String,
pub username: String,
}
impl Default for ClientData {
fn default() -> Self {
Self {
ip: "localhost:39420".to_string(),
username: "your [NOVEMBER]".to_string(),
}
}
}

View File

@@ -1,3 +1,5 @@
// stolen default impl from example
use quinn::rustls::{self, pki_types::*};
use std::sync::Arc;

View File

@@ -7,8 +7,6 @@ use directories_next::ProjectDirs;
use crate::net::BINCODE_CONFIG;
pub const CLIENT_DATA: &str = "client_data";
pub struct DataDir {
dirs: ProjectDirs,
}
@@ -44,18 +42,3 @@ impl DataDir {
bincode::encode_into_std_write(data, &mut file, BINCODE_CONFIG).unwrap();
}
}
#[derive(bincode::Encode, bincode::Decode)]
pub struct ClientData {
pub ip: String,
pub username: String,
}
impl Default for ClientData {
fn default() -> Self {
Self {
ip: "localhost:39420".to_string(),
username: "your [NOVEMBER]".to_string(),
}
}
}