rename main menu -> laser menu

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-05-16 15:25:44 +02:00
parent 40b0cd7a90
commit 0cae87ce18

View file

@ -19,7 +19,7 @@ pub struct BeoUi {
const CANVAS_HEIGHT: f32 = 768.;
const CANVAS_WIDTH: f32 = 1024.;
const LASER_EPS_MATCH: f32 = 15.0;
const MAIN_MENU_CIRCLE_RADIUS: f32 = CANVAS_WIDTH - 30.;
const LASER_MENU_CIRCLE_RADIUS: f32 = CANVAS_WIDTH - 30.;
fn laser_pct_to_y_pos(pct: f32) -> f32 {
// This is only y pos in the main menu circle, which we suppose is a const
@ -60,7 +60,7 @@ impl BeoUi {
}
pub fn draw<T: Renderer>(&self, canvas: &mut Canvas<T>, fonts: &Fonts) {
self.draw_main_menu(canvas, fonts);
self.draw_laser_menu(canvas, fonts);
if let Some(selected_app) = self.current_app() {
self.draw_app(canvas, fonts, selected_app);
@ -95,17 +95,17 @@ impl BeoUi {
self.current_app_id.map(|id| &mut self.beo_apps.apps[id])
}
fn draw_main_menu<T: Renderer>(&self, canvas: &mut Canvas<T>, fonts: &Fonts) {
fn draw_laser_menu<T: Renderer>(&self, canvas: &mut Canvas<T>, fonts: &Fonts) {
let canvas_width = canvas.width();
let canvas_height = canvas.height();
// circle is centered on the right side of the screen
let main_menu_circle = roundy_math::VirtualCircle {
let laser_menu_circle = roundy_math::VirtualCircle {
center: roundy_math::Point {
x: canvas_width as f32,
y: canvas_height as f32 / 2.0,
},
radius: MAIN_MENU_CIRCLE_RADIUS,
radius: LASER_MENU_CIRCLE_RADIUS,
};
let canvas_size = roundy_math::Point {
@ -115,7 +115,7 @@ impl BeoUi {
// draw the main apps in the circle
let apps = &self.beo_apps.apps;
let pts = main_menu_circle.get_equidistant_points(apps.len(), canvas_size);
let pts = laser_menu_circle.get_equidistant_points(apps.len(), canvas_size);
// XXX To be taken from global struct
let mut paint_normal = Paint::color(Color::hex("B7410E"));
@ -142,7 +142,7 @@ impl BeoUi {
let ellipse_color = Paint::color(Color::hex("5C89D188"));
let mut path = Path::new();
let ey = laser_pct_to_y_pos(self.laser_pct);
let ex = main_menu_circle.get_x_on_circle(ey);
let ex = laser_menu_circle.get_x_on_circle(ey);
path.ellipse(ex + 15., ey, 30., 10.);
canvas.fill_path(&path, &ellipse_color);