Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3781 in orxonox.OLD for orxonox/branches/textEngine/src


Ignore:
Timestamp:
Apr 12, 2005, 1:05:46 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: some simple animation-template-class implemented, to animate floats
This class will in the Future be able to animate everything one needs to animate

Location:
orxonox/branches/textEngine/src
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/Makefile.am

    r3778 r3781  
    8080                 track_manager.h \
    8181                 track_node.h \
     82                 animation.h \
    8283                 simple_animation.h \
    8384                 garbage_collector.h \
  • orxonox/branches/textEngine/src/Makefile.in

    r3778 r3781  
    288288                 track_manager.h \
    289289                 track_node.h \
     290                 animation.h \
    290291                 simple_animation.h \
    291292                 garbage_collector.h \
  • orxonox/branches/textEngine/src/animation.h

    r3779 r3781  
    1 /*!
    2     \file proto_class.h
    3     \brief Definition of the proto class template, used quickly start work
    4     \todo Example: this shows how to use simply add a Marker that here has to be done something.
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
    53
    6     The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
    7     It is an example for the CODING-CONVENTION, and a starting-point for every class.
     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: ...
    814*/
    915
    10 #ifndef _PROTO_CLASS_H
    11 #define _PROTO_CLASS_H
    1216
    13 #include "what realy has to be included"
     17/*!
     18    \file animation.h
     19    A Set of functions to animate some floats inside of an Object
     20*/
     21
     22#ifndef _ANIMATION_H
     23#define _ANIMATION_H
     24
    1425#include "base_object.h"
    1526
    16 // FORWARD DEFINITION \\
    17 class someClassWeNeed;
     27enum ANIM_FUNCTION {ANIM_LINEAR };
     28
     29//! A Class to handle some animation for single floated values.
     30template<class T> class Animation : public BaseObject
     31{
     32 public:
     33  Animation();
     34  virtual ~Animation();
     35
     36  void setFuncToAnim(T* object, void (T::*animFunc)(float));
     37  void setAnimFunc();
     38  void setValue(float value);
     39
     40  void tick(float time);
     41
     42 private:
     43  void (T::*animFunc)(float);
     44 
     45  float value;
     46  T* object;
     47};
    1848
    1949
    20 /*class Test;*/ /* forward definition of class Test (without including it here!)*/
    2150
    22 //! A default class that aids you to start creating a new class
    2351/**
    24    here can be some longer description of this class
     52   \brief standard constructor
     53
    2554*/
    26 class ProtoClass : public BaseObject {
     55template<class T>
     56Animation<T>::Animation ()
     57{
     58   this->setClassName ("Animation");
     59   this->value = 0.0;
     60}
    2761
    28  public:
    29   ProtoClass();
    30   virtual ~ProtoClass();
    3162
    32   bool doNonSense (int nothing);
     63/**
     64   \brief standard deconstructor
    3365
    34  private:
    35   int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
     66*/
     67template<class T>
     68Animation<T>::~Animation ()
     69{
     70  // delete what has to be deleted here
     71}
    3672
    37 };
    3873
    39 #endif /* _PROTO_CLASS_H */
     74template<class T>
     75void Animation<T>::setFuncToAnim(T* object, void (T::*animFunc)(float))
     76{
     77  this->object = object;
     78  this->animFunc = animFunc;
     79}
     80
     81template<class T>
     82void Animation<T>::setValue(float value)
     83{
     84  this->value = value;
     85  (object->*(animFunc))(value);
     86}
     87
     88template<class T>
     89void Animation<T>::tick(float time)
     90{
     91  setValue(value+time/1000);
     92  if (value >1)
     93    setValue (0);
     94}
     95
     96#endif /* _ANIMATION_H */
  • orxonox/branches/textEngine/src/story_entities/world.cc

    r3777 r3781  
    4040#include "glmenu_imagescreen.h"
    4141#include "list.h"
     42
     43#include "animation.h"
    4244
    4345using namespace std;
     
    354356            this->testText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);
    355357            testText->setText("TEXT  rocks");
    356             testText->setBlending(.5);
     358            testText->setBlending(1.0);
    357359            testText->setBindNode(tn);
    358360
     361           
     362            tmpAnim = new Animation<Text>();
     363
     364            tmpAnim->setFuncToAnim(testText, &Text::setBlending);
    359365            break;
    360366          }
     
    780786      this->localCamera->tick(this->dt);
    781787      this->garbageCollector->tick(seconds);
     788      tmpAnim->tick(this->dt);
    782789    }
    783790  this->lastFrame = currentFrame;
  • orxonox/branches/textEngine/src/story_entities/world.h

    r3769 r3781  
    2424class GarbageCollector;
    2525class Text;
     26template<class T> class Animation;
    2627
    2728//! The game world Interface
     
    9596  bool bPause;                  //!< pause mode
    9697
     98  Animation<Text>* tmpAnim;
    9799  Text* testText;               //!< A text to Test the TextEngine;
    98100  GLMenuImageScreen* glmis;     //!< The Level-Loader Display
Note: See TracChangeset for help on using the changeset viewer.