debug stuff + switch to cranelift
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
cargo-features = ["codegen-backend"]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "openworm"
|
name = "openworm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -27,5 +29,8 @@ path = "src/bin/client/main.rs"
|
|||||||
name = "openworm-server"
|
name = "openworm-server"
|
||||||
path = "src/bin/server/main.rs"
|
path = "src/bin/server/main.rs"
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
codegen-backend = "cranelift"
|
||||||
|
|
||||||
[profile.dev.package."*"]
|
[profile.dev.package."*"]
|
||||||
opt-level = 1
|
opt-level = 1
|
||||||
|
|||||||
28
src/bin/client/debug.rs
Normal file
28
src/bin/client/debug.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
use openworm::net::Msg;
|
||||||
|
|
||||||
|
use crate::Client;
|
||||||
|
|
||||||
|
pub fn debug(_client: &mut Client) {
|
||||||
|
// let mut file = std::fs::OpenOptions::new()
|
||||||
|
// .write(true)
|
||||||
|
// .create(true)
|
||||||
|
// .truncate(true)
|
||||||
|
// .open("./old_msgs")
|
||||||
|
// .unwrap();
|
||||||
|
// bincode::encode_into_std_write(
|
||||||
|
// self.msgs.clone(),
|
||||||
|
// &mut file,
|
||||||
|
// openworm::net::BINCODE_CONFIG,
|
||||||
|
// )
|
||||||
|
// .unwrap();
|
||||||
|
let mut file = std::fs::OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.open("./old_msgs")
|
||||||
|
.unwrap();
|
||||||
|
let msgs: Vec<Msg> =
|
||||||
|
bincode::decode_from_std_read(&mut file, openworm::net::BINCODE_CONFIG).unwrap();
|
||||||
|
for msg in msgs {
|
||||||
|
println!("{msg:?}");
|
||||||
|
}
|
||||||
|
// client.ui.debug_layers();
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ use arboard::Clipboard;
|
|||||||
use input::Input;
|
use input::Input;
|
||||||
use iris::prelude::*;
|
use iris::prelude::*;
|
||||||
use openworm::{
|
use openworm::{
|
||||||
net::{ClientMsg, ServerMsg, install_crypto_provider},
|
net::{ClientMsg, Msg, ServerMsg, install_crypto_provider},
|
||||||
rsc::DataDir,
|
rsc::DataDir,
|
||||||
};
|
};
|
||||||
use render::Renderer;
|
use render::Renderer;
|
||||||
@@ -23,6 +23,7 @@ use winit::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
|
mod debug;
|
||||||
mod input;
|
mod input;
|
||||||
mod net;
|
mod net;
|
||||||
mod render;
|
mod render;
|
||||||
@@ -52,6 +53,7 @@ pub struct Client {
|
|||||||
data: ClientData,
|
data: ClientData,
|
||||||
handle: AppHandle,
|
handle: AppHandle,
|
||||||
error: Option<WidgetId<WidgetPtr>>,
|
error: Option<WidgetId<WidgetPtr>>,
|
||||||
|
msgs: Vec<Msg>,
|
||||||
ime: usize,
|
ime: usize,
|
||||||
last_click: Instant,
|
last_click: Instant,
|
||||||
}
|
}
|
||||||
@@ -81,6 +83,7 @@ impl Client {
|
|||||||
error: None,
|
error: None,
|
||||||
ime: 0,
|
ime: 0,
|
||||||
last_click: Instant::now(),
|
last_click: Instant::now(),
|
||||||
|
msgs: Vec::new(),
|
||||||
};
|
};
|
||||||
ui::init(&mut s);
|
ui::init(&mut s);
|
||||||
s
|
s
|
||||||
@@ -103,6 +106,7 @@ impl Client {
|
|||||||
ServerMsg::LoadMsgs(msgs) => {
|
ServerMsg::LoadMsgs(msgs) => {
|
||||||
if let Some(msg_area) = &self.channel {
|
if let Some(msg_area) = &self.channel {
|
||||||
for msg in msgs {
|
for msg in msgs {
|
||||||
|
self.msgs.push(msg.clone());
|
||||||
let msg = msg_widget(msg).add(&mut self.ui);
|
let msg = msg_widget(msg).add(&mut self.ui);
|
||||||
self.ui[msg_area].children.push(msg.any());
|
self.ui[msg_area].children.push(msg.any());
|
||||||
}
|
}
|
||||||
@@ -182,7 +186,7 @@ impl Client {
|
|||||||
button: MouseButton::Middle,
|
button: MouseButton::Middle,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
// self.ui.debug_layers();
|
debug::debug(self);
|
||||||
}
|
}
|
||||||
WindowEvent::Ime(ime) => {
|
WindowEvent::Ime(ime) => {
|
||||||
if let Some(sel) = &self.focus {
|
if let Some(sel) = &self.focus {
|
||||||
|
|||||||
Reference in New Issue
Block a user