rework networking indicator dot

This commit is contained in:
2025-04-20 07:33:34 +01:00
parent 6079a72f47
commit d789b0f62d
5 changed files with 31 additions and 30 deletions
+13 -9
View File
@@ -139,9 +139,20 @@ impl App {
.outer_margin(egui::vec2(0.0, -2.0))
.show(ui, |ui| {
let response = ui.add_enabled_ui(self.flags.elevated, |ui| {
let label = ui.label("Game's network access");
let label = ui.horizontal(|ui| {
let label = ui.label("Game's network access");
ui.add_space(1.0);
ui.add(
egui::Image::new(egui::include_image!("../../assets/circle.svg"))
.max_size([4.0, 4.0].into())
.tint(self.game_networking.blocked_status.to_color32()),
)
.on_hover_text("This turns yellow if GTA Tools\ncannot find your game.");
self.game_networking.if_failed_return_to_unblocked();
label
});
ui.horizontal(|ui| {
let available_width = label.rect.width();
let available_width = label.inner.rect.width();
let spacing = ui.spacing().item_spacing.x;
let button_width = (available_width - spacing) / 2.0;
if ui
@@ -156,13 +167,6 @@ impl App {
{
self.game_networking.unblock_all();
}
ui.add(
egui::Image::new(egui::include_image!("../../assets/circle.svg"))
.max_size([4.0, 4.0].into())
.tint(self.game_networking.blocked_status.to_color32()),
)
.on_hover_text("This turns yellow if GTA Tools\ncannot find your game.");
self.game_networking.if_failed_return_to_unblocked();
});
});
response.response.on_disabled_hover_text(
+16
View File
@@ -0,0 +1,16 @@
use crate::features::game_networking::BlockedStatus;
use eframe::egui;
pub const RED: egui::Color32 = egui::Color32::from_rgb(255, 128, 128);
pub const YELLOW: egui::Color32 = egui::Color32::from_rgb(255, 255, 128);
pub const GREEN: egui::Color32 = egui::Color32::from_rgb(128, 255, 128);
impl From<BlockedStatus> for egui::Color32 {
fn from(value: BlockedStatus) -> Self {
match value {
BlockedStatus::Blocked => RED,
BlockedStatus::Failed => YELLOW,
BlockedStatus::Unblocked => GREEN,
}
}
}
+1
View File
@@ -1,4 +1,5 @@
mod app;
mod colours;
mod debug;
pub mod run;
pub mod settings;