From 7cb07f1260b6fdbb0d6d44907608d7c44db492ca Mon Sep 17 00:00:00 2001 From: hodasemi Date: Thu, 19 Jan 2023 10:23:21 +0100 Subject: [PATCH] Add delta board --- .../elements/leaderboard/deltaboard_grid.xml | 6 + .../elements/leaderboard/leaderboard_entry.rs | 215 +++++++++++ .../elements/leaderboard/leaderboard_grid.xml | 3 +- src/overlay/elements/leaderboard/mod.rs | 350 +++++++----------- src/overlay/elements/pedals/mod.rs | 2 +- src/overlay/elements/radar/mod.rs | 2 +- 6 files changed, 365 insertions(+), 213 deletions(-) create mode 100644 src/overlay/elements/leaderboard/deltaboard_grid.xml create mode 100644 src/overlay/elements/leaderboard/leaderboard_entry.rs diff --git a/src/overlay/elements/leaderboard/deltaboard_grid.xml b/src/overlay/elements/leaderboard/deltaboard_grid.xml new file mode 100644 index 0000000..9f9f760 --- /dev/null +++ b/src/overlay/elements/leaderboard/deltaboard_grid.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/src/overlay/elements/leaderboard/leaderboard_entry.rs b/src/overlay/elements/leaderboard/leaderboard_entry.rs new file mode 100644 index 0000000..8a1acb4 --- /dev/null +++ b/src/overlay/elements/leaderboard/leaderboard_entry.rs @@ -0,0 +1,215 @@ +use std::sync::Arc; + +use anyhow::Result; + +use ui::prelude::*; +use utilities::prelude::Color; + +#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] +pub enum BehindLeader { + Time(f64), + Laps(i32), +} + +pub struct LeaderBoardEntry { + id: i32, + + name: String, + place: u8, + behind: BehindLeader, + time_behind_next: f64, + best_lap: f64, + + snippet: Arc, + + name_label: Arc