summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ef1894b)
The priority system is used to determine which screen is shown first if two or more screens
have updated information (ie. a group screen is more important than a "today's high scores"
screen, which is in turn more important than "today's most chosen songs", as the latter is
mainly a curiosity).
- Add a get_priority() to GenericScreen, default 0.
- Implement get_priority() for GroupScreen and Top10ScoreScreen, set to 10 and 5 resp.
- Make RotateScreen automatically pick the screen with the highest priority if two or more
have forced updates.
+int GroupScreen::get_priority()
+{
+ return 10;
+}
bool check_invalidated();
void draw(unsigned char *buf);
bool check_invalidated();
void draw(unsigned char *buf);
};
#endif /* !defined(_GROUPSCREEN_H) */
};
#endif /* !defined(_GROUPSCREEN_H) */
// determine if we want to switch screens
unsigned old_current_screen = current_screen;
// determine if we want to switch screens
unsigned old_current_screen = current_screen;
+ int priority = -9999; // bah :-P
// push any invalidated screen first (for now)
for (unsigned i = 0; i < subscreens.size(); ++i) {
// push any invalidated screen first (for now)
for (unsigned i = 0; i < subscreens.size(); ++i) {
- if (subscreens[i].screen->check_invalidated()) {
+ if (subscreens[i].screen->check_invalidated() && subscreens[i].screen->get_priority() > priority) {
current_screen = i;
force = true;
current_screen = i;
force = true;
+ priority = subscreens[i].screen->get_priority();
GenericScreen::GenericScreen() {}
GenericScreen::~GenericScreen() {}
GenericScreen::GenericScreen() {}
GenericScreen::~GenericScreen() {}
+int GenericScreen::get_priority()
+{
+ return 0;
+}
virtual ~GenericScreen();
virtual bool check_invalidated() = 0;
virtual void draw(unsigned char *buf) = 0;
virtual ~GenericScreen();
virtual bool check_invalidated() = 0;
virtual void draw(unsigned char *buf) = 0;
+ virtual int get_priority();
};
#endif /* !defined(_SCREEN_H) */
};
#endif /* !defined(_SCREEN_H) */
std::copy(scores.begin(), scores.end(), std::inserter(seen_topscore, seen_topscore.end()));
}
std::copy(scores.begin(), scores.end(), std::inserter(seen_topscore, seen_topscore.end()));
}
+int Top10ScoreScreen::get_priority()
+{
+ return 5;
+}
bool check_invalidated();
void draw(unsigned char *buf);
bool check_invalidated();
void draw(unsigned char *buf);
};
#endif /* !defined(_TOP10SCORESCREEN_H) */
};
#endif /* !defined(_TOP10SCORESCREEN_H) */