]> git.seodisparate.com - mpd_info_screen/commitdiff
Replace magic numbers with consts, bump version 0.2.11
authorStephen Seo <seo.disparate@gmail.com>
Tue, 11 Jan 2022 09:30:12 +0000 (18:30 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Tue, 11 Jan 2022 09:30:12 +0000 (18:30 +0900)
Cargo.lock
Cargo.toml
README.md
src/display.rs

index ed7865cacca927fd32a6c349a62d44b2d7a950f2..2a8a0b67eff65165acc069850b3429f5725d7015 100644 (file)
@@ -1427,7 +1427,7 @@ dependencies = [
 
 [[package]]
 name = "mpd_info_screen"
-version = "0.2.10"
+version = "0.2.11"
 dependencies = [
  "ggez",
  "image",
index b7263fde7644eb20ed4b2f3408f089cb063e8556..ac99307d7368c1e55bac039273f9b0a42dfbfe91 100644 (file)
@@ -1,6 +1,6 @@
 [package]
 name = "mpd_info_screen"
-version = "0.2.10"
+version = "0.2.11"
 edition = "2018"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
index c787ddbd89e1aca6149c3c279defb1a6644b3052..10db2cca90ff7101c7d7f4aeeeae5e67fee0aaa5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ counter, and the filename currently being played
 
 # Usage
 
-    mpd_info_screen 0.2.10
+    mpd_info_screen 0.2.11
     
     USAGE:
         mpd_info_screen [FLAGS] [OPTIONS] <host> [port]
index 594d998fd16e08bb57f769586f042cc7ff94ace1..c611017ff3d4ba500c5b650fb03cb40457e5a2ed 100644 (file)
@@ -23,6 +23,8 @@ const TEXT_HEIGHT_SCALE: f32 = 0.1;
 const ARTIST_HEIGHT_SCALE: f32 = 0.08;
 const TIMER_HEIGHT_SCALE: f32 = 0.07;
 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 {
     let seconds_int: u64 = seconds.floor() as u64;
@@ -276,12 +278,12 @@ impl MPDDisplay {
                                 text_height_limit
                             })
                     {
-                        current_x = current_x * 4.0f32 / 5.0f32;
-                        current_y = current_y * 4.0f32 / 5.0f32;
+                        current_x = current_x * DECREASE_AMT;
+                        current_y = current_y * DECREASE_AMT;
                         continue;
                     } else if screen_coords.w * MIN_WIDTH_RATIO > width {
-                        current_x = current_x * 5.0f32 / 4.0f32;
-                        current_y = current_y * 5.0f32 / 4.0f32;
+                        current_x = current_x * INCREASE_AMT;
+                        current_y = current_y * INCREASE_AMT;
                         continue;
                     } else {
                         break;