|
From: Tapio V. <aa...@us...> - 2009-12-27 22:49:22
|
Module: performous
Branch: master
Commit: abd2834921cbe287caef52f393b278a30a60bb4c
Author: Tapio Vierros <tap...@gm...>
Date: Mon Dec 28 00:46:02 2009 +0200
Change singer layout to fullscreen if there is no instruments (and vice versa).
---
game/screen_sing.cc | 9 ++++++---
game/screen_sing.hh | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 27899b7..5899475 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -96,7 +96,9 @@ void ScreenSing::enter() {
m_engine.reset(new Engine(m_audio, *m_song, analyzers.begin(), analyzers.end(), m_database));
}
-void ScreenSing::instrumentLayout(double time) {
+/// Manages the instrument drawing
+/// Returns false if no instuments are alive
+bool ScreenSing::instrumentLayout(double time) {
int count = 0, i = 0;
// Count active instruments
for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it)
@@ -134,6 +136,7 @@ void ScreenSing::instrumentLayout(double time) {
m_audio.streamFade(it->first, level);
}
}
+ return (count > 0);
}
void ScreenSing::danceLayout(double time) {
@@ -301,8 +304,8 @@ void ScreenSing::draw() {
} else if( m_instruments.empty() ) {
m_layout_singer->draw(time, LayoutSinger::BOTTOM);
} else {
- instrumentLayout(time);
- m_layout_singer->draw(time, LayoutSinger::MIDDLE);
+ bool some_alive = instrumentLayout(time);
+ m_layout_singer->draw(time, some_alive ? LayoutSinger::MIDDLE : LayoutSinger::BOTTOM);
}
Song::Status status = m_song->status(time);
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index af07b95..de37b5c 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -70,7 +70,7 @@ class ScreenSing: public Screen {
- is the hiscore file writable
*/
void activateNextScreen();
- void instrumentLayout(double time);
+ bool instrumentLayout(double time);
void danceLayout(double time);
Audio& m_audio;
Capture& m_capture;
|