1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2025-04-21 12:27:27 +03:00

Query animation status instead of storing it

This makes it a lot easier to support more than one possible animation
in the same layer.
This commit is contained in:
Maarten ter Huurne
2013-08-12 19:41:56 +02:00
parent f820bf8d6e
commit 90afa096e7
6 changed files with 26 additions and 50 deletions

View File

@@ -171,18 +171,14 @@ void Menu::calcSectionRange(int &leftSection, int &rightSection) {
rightSection - numSections + 1);
}
void Menu::runAnimations() {
bool Menu::runAnimations() {
if (sectionAnimation.isRunning()) {
sectionAnimation.step();
if (!sectionAnimation.isRunning()) {
stopAnimating();
}
}
return sectionAnimation.isRunning();
}
void Menu::paint(Surface &s) {
runAnimations();
const uint width = s.width(), height = s.height();
Font &font = *gmenu2x->font;
SurfaceCollection &sc = gmenu2x->sc;
@@ -371,13 +367,11 @@ vector<Link*> *Menu::sectionLinks(int i) {
void Menu::decSectionIndex() {
sectionAnimation.adjust(-1 << 16);
startAnimating();
setSectionIndex(iSection - 1);
}
void Menu::incSectionIndex() {
sectionAnimation.adjust(1 << 16);
startAnimating();
setSectionIndex(iSection + 1);
}