Sort layouts in the list
[kdegames.git] / kollision / animator.cpp
bloba3cefdc425258293fcc0e27480f03bd1f3db2fc4
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 */
10 #include "animator.h"
11 #include <kdebug.h>
13 Animator::Animator()
15 connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
18 void Animator::add(Animation* a)
20 if (!m_timer.isActive()) {
21 startTimer();
23 AnimationGroup::add(a);
26 void Animator::startTimer()
28 m_time.restart();
29 m_timer.start(0);
30 start(0);
33 void Animator::stopTimer()
35 m_timer.stop();
36 stop();
39 void Animator::tick()
41 if (AnimationGroup::step(m_time.elapsed())) {
42 stopTimer();
47 #include "animator.moc"