~ubuntu-branches/ubuntu/trusty/manaplus/trusty-proposed

« back to all changes in this revision

Viewing changes to src/animationparticle.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-09-17 10:35:51 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130917103551-az7p3nz9jgxwqjfn
Tags: 1.3.9.15-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  The ManaPlus Client
3
 
 *  Copyright (C) 2006-2009  The Mana World Development Team
4
 
 *  Copyright (C) 2009-2010  The Mana Developers
5
 
 *  Copyright (C) 2011-2013  The ManaPlus Developers
6
 
 *
7
 
 *  This file is part of The ManaPlus Client.
8
 
 *
9
 
 *  This program is free software; you can redistribute it and/or modify
10
 
 *  it under the terms of the GNU General Public License as published by
11
 
 *  the Free Software Foundation; either version 2 of the License, or
12
 
 *  any later version.
13
 
 *
14
 
 *  This program is distributed in the hope that it will be useful,
15
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 *  GNU General Public License for more details.
18
 
 *
19
 
 *  You should have received a copy of the GNU General Public License
20
 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 
 */
22
 
 
23
 
#include "animationparticle.h"
24
 
 
25
 
#include "graphics.h"
26
 
#include "simpleanimation.h"
27
 
 
28
 
#include "debug.h"
29
 
 
30
 
AnimationParticle::AnimationParticle(Map *const map,
31
 
                                     Animation *const animation) :
32
 
    ImageParticle(map, nullptr),
33
 
    mAnimation(new SimpleAnimation(animation))
34
 
{
35
 
}
36
 
 
37
 
AnimationParticle::AnimationParticle(Map *const map,
38
 
                                     XmlNodePtr const animationNode,
39
 
                                     const std::string& dyePalettes):
40
 
    ImageParticle(map, nullptr),
41
 
    mAnimation(new SimpleAnimation(animationNode, dyePalettes))
42
 
{
43
 
}
44
 
 
45
 
AnimationParticle::~AnimationParticle()
46
 
{
47
 
    delete mAnimation;
48
 
    mAnimation = nullptr;
49
 
    mImage = nullptr;
50
 
}
51
 
 
52
 
bool AnimationParticle::update()
53
 
{
54
 
    if (mAnimation)
55
 
    {
56
 
        mAnimation->update(10);  // particle engine is updated every 10ms
57
 
        mImage = mAnimation->getCurrentImage();
58
 
    }
59
 
    return Particle::update();
60
 
}