Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3851 in orxonox.OLD for orxonox/trunk/src/t_animation.h


Ignore:
Timestamp:
Apr 17, 2005, 1:21:59 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: animation: more adaptions to the new Framework

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/t_animation.h

    r3849 r3851  
    1 
    2 
     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/*!
     18    \file t_animation.h
     19*/
     20
     21#ifndef _T_ANIMATION_H
     22#define _T_ANIMATION_H
    323
    424#include "animation.h"
     
    1636  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
    1737
    18   virtual void tick(float time);
     38  virtual void tick(float timePassed);
    1939
    2040  // animation functions
    2141  void setAnimFunc(ANIM_FUNCTION animFunc);
     42
     43 private:
    2244
    2345  float constant(float timePassed) const;
     
    2951  float quadratic(float timePassed) const;
    3052  float random(float timePassed) const;
     53
     54
    3155  //  ANIM_FUNCTION animFunc;
    3256  float (tAnimation<T>::*animFunc)(float) const;
     
    3559  tList<KeyFrameF>* keyFrameList;
    3660
    37 
    38 
    39 
    40  private:
    4161  float expFactor;
    4262  T* object;
     
    110130  if (duration <= 0.0)
    111131    duration = 1.0;
    112  
    113132
    114133  KeyFrameF* tmpKeyFrame;
     
    135154
    136155template<class T>
    137 void tAnimation<T>::tick(float time)
     156void tAnimation<T>::tick(float timePassed)
    138157{
    139158  if (this->bRunning)
    140159    {
    141       this->localTime += time;
     160      this->localTime += timePassed;
    142161      if (localTime >= this->currentKeyFrame->duration)
    143162        {
    144163          // switching to the next Key-Frame
     164          this->localTime -= this->currentKeyFrame->duration;
     165
    145166          this->currentKeyFrame = this->nextKeyFrame;
    146           this->localTime = 0;
    147167          // checking, if we should still Play the animation
    148168          if (this->currentKeyFrame == this->keyFrameList->lastElement())
     
    270290
    271291}
     292
     293
     294#endif /* _T_ANIMATION_H */
Note: See TracChangeset for help on using the changeset viewer.