From 175a9ed19bf1d362304a9ddd1c6c61494eaad9ce Mon Sep 17 00:00:00 2001 From: Jonas Minnberg Date: Fri, 15 Apr 2016 22:06:58 +0200 Subject: [PATCH] Fixed volume icon centering --- src/ChipMachine.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ChipMachine.cpp b/src/ChipMachine.cpp index 7c55cf9..0418b06 100644 --- a/src/ChipMachine.cpp +++ b/src/ChipMachine.cpp @@ -128,6 +128,11 @@ ChipMachine::ChipMachine(const std::string &wd) }, heart_icon); //favIcon = Icon(heart_icon, favPos.x, favPos.y, favPos.w, favPos.h); + float ww = volume_icon.width() * 15; + float hh = volume_icon.height() * 10; + volPos = {((float)screen.width() - ww) / 2.0f, ((float)screen.height() - hh) / 2.0f, ww, hh}; + volumeIcon = Icon(volume_icon, volPos.x, volPos.y, volPos.w, volPos.h); + setupCommands(); setupRules(); @@ -147,10 +152,6 @@ ChipMachine::ChipMachine(const std::string &wd) mainScreen.add(&netIcon); netIcon.visible(false); - float ww = volume_icon.width() * 15; - float hh = volume_icon.height() * 10; - volPos = {((float)screen.width() - ww) / 2.0f, ((float)screen.height() - hh) / 2.0f, ww, hh}; - volumeIcon = Icon(volume_icon, volPos.x, volPos.y, volPos.w, volPos.h); showVolume = 0; musicBars.setup(spectrumWidth, spectrumHeight, 24); @@ -278,6 +279,11 @@ void ChipMachine::layoutScreen() { commandField.cursorW = searchField.cursorW; favIcon.set(favPos); + + float ww = volume_icon.width() * 15; + float hh = volume_icon.height() * 10; + volPos = {((float)screen.width() - ww) / 2.0f, ((float)screen.height() - hh) / 2.0f, ww, hh}; + volumeIcon.set(volPos); } void ChipMachine::play(const SongInfo &si) {