File: animator.cpp

package info (click to toggle)
kollision 4%3A4.12.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 496 kB
  • ctags: 155
  • sloc: cpp: 1,138; makefile: 9; sh: 3
file content (49 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
  Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
            
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
*/

#include "animator.h"
#include <kdebug.h>

Animator::Animator()
{
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
}

void Animator::add(Animation* a)
{
    if (!m_timer.isActive()) {
        startTimer();
    }
    AnimationGroup::add(a);
}

void Animator::startTimer()
{
    m_time.restart();
    m_timer.start(0);
    start(0);
}

void Animator::stopTimer()
{
    m_timer.stop();
    stop();
}

void Animator::tick()
{
    if (AnimationGroup::step(m_time.elapsed())) {
        stopTimer();
    }
}


#include "animator.moc"