Skip to content

Commit

Permalink
update egui (#638)
Browse files Browse the repository at this point in the history
Update egui. Ticks off #620 point 3
  • Loading branch information
JackCrumpLeys authored Jul 28, 2024
1 parent 80c570f commit 7cd3f5b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 24 deletions.
34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ aes = "0.8.4"
anyhow = { version = "1.0.86", features = ["backtrace"] }
approx = "0.5.1"
arrayvec = "0.7.4"
async-trait = "0.1.80"
async-trait = "0.1.81"
atty = "0.2.14"
base64 = "0.22.1"
bevy_app = { version = "0.14.0", default-features = false }
Expand All @@ -125,32 +125,32 @@ bevy_utils = { version = "0.14.0" }
bitfield-struct = "0.8.0"
bitvec = "1.0.1"
byteorder = "1.5.0"
bytes = "1.6.0"
bytes = "1.6.1"
cesu8 = "1.1.0"
cfb8 = "0.8.1"
clap = { version = "4.5.7", features = ["derive"] }
clap = { version = "4.5.11", features = ["derive"] }
derive_more = "1.0.0-beta.6"
directories = "5.0.1"
divan = "0.1.14"
eframe = { version = "0.27.2" }
egui = "0.27.2"
egui_dock = "0.12"
eframe = { version = "0.28.1" }
egui = "0.28.1"
egui_dock = "0.13"
flate2 = "1.0.30"
flume = "0.11.0"
fs_extra = "1.3.0"
glam = "0.28.0"
heck = "0.5.0"
hmac = "0.12.1"
image = "0.25.1"
image = "0.25.2"
indexmap = "2.2.6"
itertools = "0.13.0"
java_string = { path = "crates/java_string", version = "0.1.2" }
lru = "0.12.3"
noise = "0.9.0"
num = "0.4.3"
num-bigint = "0.4.5"
num-bigint = "0.4.6"
owo-colors = "4.0.0"
ordered-float = "4.2.0"
ordered-float = "4.2.1"
parking_lot = "0.12.3"
paste = "1.0.15"
petgraph = "0.6.5"
Expand All @@ -165,22 +165,22 @@ rfd = "0.14.1"
rsa = "0.9.6"
rsa-der = "0.3.0"
rustc-hash = "2.0.0"
serde = "1.0.203"
serde = "1.0.204"
serde-value = "0.7.0"
serde_json = "1.0.117"
serde_json = "1.0.121"
sha1 = "0.10.6"
sha2 = "0.10.8"
syn = "2.0.67"
syn = "2.0.72"
syntect = { version = "5.2.0", default-features = false }
tempfile = "3.10.1"
thiserror = "1.0.61"
thiserror = "1.0.63"
time = "0.3.36"
tokio = { version = "1.38.0", features = ["full"] }
toml = "0.8.14"
tokio = { version = "1.39.2", features = ["full"] }
toml = "0.8.16"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
url = { version = "2.5.2", features = ["serde"] }
uuid = "1.8.0"
uuid = "1.10.0"
valence = { path = ".", version = "0.2.0-alpha.1" }
valence_advancement = { path = "crates/valence_advancement", version = "0.2.0-alpha.1" }
valence_anvil = { path = "crates/valence_anvil", version = "0.1.0" }
Expand Down Expand Up @@ -209,7 +209,7 @@ valence_server_common = { path = "crates/valence_server_common", version = "0.2.
valence_text = { path = "crates/valence_text", version = "0.2.0-alpha.1" }
valence_weather = { path = "crates/valence_weather", version = "0.2.0-alpha.1" }
valence_world_border = { path = "crates/valence_world_border", version = "0.2.0-alpha.1" }
zip = "2.1.3"
zip = "2.1.5"

[workspace.lints.rust]
# missing_debug_implementations = "warn" # TODO: enable me.`
Expand Down
26 changes: 20 additions & 6 deletions tools/packet_inspector/src/app/packet_list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use eframe::epaint::PathShape;
use egui::{
Color32, Pos2, Rect, Response, Rgba, Sense, Shape, Stroke, TextStyle, Ui, Vec2, WidgetText,
Color32, Pos2, Rect, Response, Rgba, Sense, Shape, Stroke, TextStyle, TextWrapMode, Ui, Vec2,
WidgetText,
};
use packet_inspector::Packet;
use valence_protocol::PacketSide;
Expand Down Expand Up @@ -155,15 +156,28 @@ fn draw_packet_widget(ui: &mut Ui, packet: &Packet, selected: bool) -> Response

let identifier: WidgetText = format!("0x{:0>2X?}", packet.id).into();

let identifier =
identifier.into_galley(ui, Some(false), rect.width() - 21.0, TextStyle::Button);
let identifier = identifier.into_galley(
ui,
Some(TextWrapMode::Truncate),
rect.width() - 21.0,
TextStyle::Button,
);

let label: WidgetText = packet.name.into();
let label = label.into_galley(ui, Some(false), rect.width() - 60.0, TextStyle::Button);
let label = label.into_galley(
ui,
Some(TextWrapMode::Truncate),
rect.width() - 60.0,
TextStyle::Button,
);

let timestamp: WidgetText = systemtime_strftime(packet.timestamp.unwrap()).into();
let timestamp =
timestamp.into_galley(ui, Some(false), rect.width() - 60.0, TextStyle::Button);
let timestamp = timestamp.into_galley(
ui,
Some(TextWrapMode::Truncate),
rect.width() - 60.0,
TextStyle::Button,
);

let id_and_timestamp_color = if selected {
text_color
Expand Down
2 changes: 1 addition & 1 deletion tools/packet_inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Box::new(move |cc| {
let gui_app = app::GuiApp::new(cc);

Box::new(gui_app)
Ok(Box::new(gui_app))
}),
)?;

Expand Down
1 change: 1 addition & 0 deletions tools/packet_inspector/src/tri_checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ impl<'a> Widget for TriCheckbox<'a> {
WidgetInfo::selected(
WidgetType::Checkbox,
*checked == TriCheckboxState::Enabled,
false,
text.as_ref().map_or("", |x| x.text()),
)
});
Expand Down

0 comments on commit 7cd3f5b

Please sign in to comment.