Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4293 in orxonox.OLD for orxonox/branches/physics/src/util


Ignore:
Timestamp:
May 26, 2005, 10:34:14 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: intoducing state: stors the Camera position globally somewhere we have to store this data

Location:
orxonox/branches/physics/src/util
Files:
2 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/util/state.cc

    r4289 r4293  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    1717
    18 #include "proto_singleton.h"
     18#include "state.h"
    1919
    2020using namespace std;
     
    2424   \brief standard constructor
    2525*/
    26 ProtoSingleton::ProtoSingleton ()
     26State::State ()
    2727{
    28    this->setClassName ("ProtoSingleton");
     28   this->setClassName ("State");
    2929
     30   this->camera = NULL;
     31   this->cameraTarget = NULL;
    3032}
    3133
     
    3335   \brief the singleton reference to this class
    3436*/
    35 ProtoSingleton* ProtoSingleton::singletonRef = NULL;
     37State* State::singletonRef = NULL;
    3638
    3739/**
    3840   \returns a Pointer to this Class
    3941*/
    40 ProtoSingleton* ProtoSingleton::getInstance(void)
     42State* State::getInstance(void)
    4143{
    42   if (!ProtoSingleton::singletonRef)
    43     ProtoSingleton::singletonRef = new ProtoSingleton();
    44   return ProtoSingleton::singletonRef;
     44  if (!State::singletonRef)
     45    State::singletonRef = new State();
     46  return State::singletonRef;
    4547}
    4648
     
    4951
    5052*/
    51 ProtoSingleton::~ProtoSingleton ()
     53State::~State ()
    5254{
    53   ProtoSingleton::singletonRef = NULL;
     55  State::singletonRef = NULL;
    5456
    5557}
     58
     59/**
     60   \sets camera and target of the current Camera
     61*/
     62void State::setCamera(const PNode* camera, const PNode* cameraTarget)
     63{
     64  this->camera = camera;
     65  this->cameraTarget = cameraTarget;
     66}
  • orxonox/branches/physics/src/util/state.h

    r4289 r4293  
    11/*!
    22    \file proto_singleton.h
    3     \brief Definition of the ... singleton Class
     3    \brief Definition of the States-singleton Class
    44   
    55*/
    66
    7 #ifndef _PROTO_SINGLETON_H
    8 #define _PROTO_SINGLETON_H
     7#ifndef _STATE_H
     8#define _STATE_H
    99
    1010#include "base_object.h"
    1111
    1212// FORWARD DEFINITION
     13class PNode;
    1314
    14 //! A default singleton class.
    15 class ProtoSingleton : public BaseObject {
     15//! A Singleton class, that handles some states about orxonox's objects
     16class State : public BaseObject {
    1617
    1718 public:
    18   static ProtoSingleton* getInstance(void);
    19   virtual ~ProtoSingleton(void);
     19  static State* getInstance(void);
     20  virtual ~State(void);
     21
     22  void setCamera(const PNode* camera, const PNode* cameraTarget);
     23  const PNode* getCamera(void) const { return this->camera; };
     24  const PNode* getCameraTarget(void) const { return this->cameraTarget; };
    2025
    2126 private:
    22   ProtoSingleton(void);
    23   static ProtoSingleton* singletonRef;
     27  State(void);
     28  static State* singletonRef;
     29
     30  const PNode* camera;
     31  const PNode* cameraTarget;
    2432};
    2533
    26 #endif /* _PROTO_SINGLETON_H */
     34#endif /* _STATE_H */
Note: See TracChangeset for help on using the changeset viewer.