Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/animation.cc @ 3855

Last change on this file since 3855 was 3853, checked in by bensch, 19 years ago

orxonox/trunk: doxygen-comments

File size: 2.1 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16
17#include "animation.h"
18#include "debug.h"
19#include "animation_player.h"
20
21/**
22   \brief creates a new Animation
23   
24   This also adds the Animation automatically to the AnimationPlayer's list
25*/
26Animation::Animation(void)
27{ 
28  // initialize a beginning KeyFrame, that will be deleted afterwards
29  this->bHasKeys = false;
30  this->bHandled = true;
31  this->baseObject = NULL;
32
33  // setting default values
34  this->localTime = 0.0;
35  this->bRunning = true;
36
37  AnimationPlayer::getInstance()->addAnimation(this);
38}
39
40/**
41   \brief destructs the Animation
42   
43   this also takes the animation out of the AnimationPlayer's list (if it is there)
44*/
45Animation::~Animation(void)
46{
47  this->doNotHandle();
48}
49
50/**
51   \brief tells the AnimationPlayer, that we do not wish to  handle this animation
52   automatically.
53   
54   This means that it will not be ticked, and not be deleted with the AnimationPlayer
55*/
56void Animation::doNotHandle(void)
57{
58  if (this->bHandled)
59    AnimationPlayer::getInstance()->removeAnimation(this);
60}
61
62/**
63   \brief Sets the infinitymode
64   \param postInfinity How the Animation should advance after the last Keyframe
65*/
66void Animation::setInfinity(ANIM_INFINITY postInfinity)
67{
68  this->postInfinity = postInfinity;
69}
70
71/**
72   \brief plays the animation back from the current Time forward
73*/
74void Animation::play()
75{
76  this->bRunning = true;
77}
78
79/**
80   \brief Stops the animation. eg. pause(); rewind();
81*/
82void Animation::stop()
83{
84  this->rewind();
85  this->bRunning = true;
86  this->tick(0.0);
87  this->bRunning = false;
88}
89
90/**
91   \brief Pauses the animation. Stays at the current Time
92*/
93void Animation::pause()
94{
95  this->bRunning = false;
96}
97
98/**
99   \brief replays the animation, eg. rewind();play();
100*/
101void Animation::replay()
102{
103  this->rewind();
104  this->bRunning = true;
105}
Note: See TracBrowser for help on using the repository browser.