Replace magic numbers with consts, bump version

This commit is contained in:
Stephen Seo 2022-01-11 18:30:12 +09:00
parent b42aaeb35a
commit 0888ec3ff9
4 changed files with 9 additions and 7 deletions

2
Cargo.lock generated
View file

@ -1427,7 +1427,7 @@ dependencies = [
[[package]] [[package]]
name = "mpd_info_screen" name = "mpd_info_screen"
version = "0.2.10" version = "0.2.11"
dependencies = [ dependencies = [
"ggez", "ggez",
"image", "image",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "mpd_info_screen" name = "mpd_info_screen"
version = "0.2.10" version = "0.2.11"
edition = "2018" edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -9,7 +9,7 @@ counter, and the filename currently being played
# Usage # Usage
mpd_info_screen 0.2.10 mpd_info_screen 0.2.11
USAGE: USAGE:
mpd_info_screen [FLAGS] [OPTIONS] <host> [port] mpd_info_screen [FLAGS] [OPTIONS] <host> [port]

View file

@ -23,6 +23,8 @@ const TEXT_HEIGHT_SCALE: f32 = 0.1;
const ARTIST_HEIGHT_SCALE: f32 = 0.08; const ARTIST_HEIGHT_SCALE: f32 = 0.08;
const TIMER_HEIGHT_SCALE: f32 = 0.07; const TIMER_HEIGHT_SCALE: f32 = 0.07;
const MIN_WIDTH_RATIO: f32 = 4.0 / 5.0; const MIN_WIDTH_RATIO: f32 = 4.0 / 5.0;
const INCREASE_AMT: f32 = 6.0 / 5.0;
const DECREASE_AMT: f32 = 5.0 / 6.0;
fn seconds_to_time(seconds: f64) -> String { fn seconds_to_time(seconds: f64) -> String {
let seconds_int: u64 = seconds.floor() as u64; let seconds_int: u64 = seconds.floor() as u64;
@ -276,12 +278,12 @@ impl MPDDisplay {
text_height_limit text_height_limit
}) })
{ {
current_x = current_x * 4.0f32 / 5.0f32; current_x = current_x * DECREASE_AMT;
current_y = current_y * 4.0f32 / 5.0f32; current_y = current_y * DECREASE_AMT;
continue; continue;
} else if screen_coords.w * MIN_WIDTH_RATIO > width { } else if screen_coords.w * MIN_WIDTH_RATIO > width {
current_x = current_x * 5.0f32 / 4.0f32; current_x = current_x * INCREASE_AMT;
current_y = current_y * 5.0f32 / 4.0f32; current_y = current_y * INCREASE_AMT;
continue; continue;
} else { } else {
break; break;