Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10394 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 26, 2007, 9:02:57 PM (18 years ago)
Author:
snellen
Message:

CameraMan gets created by the gameworld

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world_data.cc

    r10379 r10394  
    102102    localCamera->setName ("GameWorld-Camera");
    103103  State::setCamera(localCamera, localCamera->getTarget());
    104   CameraMan* camMan = new CameraMan();
    105   State::setCameraman(camMan);
     104  //CameraMan* camMan = new CameraMan();
     105  //State::setCameraman(camMan);
    106106  LightManager::getInstance();
    107107
     
    132132  this->loadGUI(root);
    133133  this->loadWorldEntities(root);
     134  this->loadCameras(root);
    134135  this->loadScene(root);
    135136
     
    146147  this->unloadWorldEntities();
    147148  this->unloadScene();
    148 
     149  this->unloadCameras();
     150
     151  return ErrorMessage();
     152}
     153
     154/**
     155 * @brief creates the cameras
     156 * @param root reference to the xml root element
     157 */
     158ErrorMessage GameWorldData::loadCameras(const TiXmlElement* root)
     159{
     160  const TiXmlElement* element = root->FirstChildElement("CameraMan");
     161  if( element != NULL)
     162  {
     163    printf("found CameraMan tag  \n");
     164    CameraMan* camMan = new CameraMan(element);
     165    State::setCameraman(camMan);
     166  }
     167  return ErrorMessage();
     168}
     169
     170
     171/**
     172 * @brief unloads the camera
     173 */
     174ErrorMessage GameWorldData::unloadCameras()
     175{
     176  CameraMan* camMan = State::getCameraman() ;
     177  if(camMan != NULL){
     178    delete  camMan;
     179    State::setCameraman(NULL);
     180   }
    149181  return ErrorMessage();
    150182}
  • trunk/src/story_entities/game_world_data.h

    r10379 r10394  
    4848    virtual ErrorMessage loadWorldEntities(const TiXmlElement* root);
    4949    virtual ErrorMessage loadScene(const TiXmlElement* root);
     50    virtual ErrorMessage loadCameras(const TiXmlElement* root);
    5051
    5152    virtual ErrorMessage unloadGUI();
    5253    virtual ErrorMessage unloadWorldEntities();
    5354    virtual ErrorMessage unloadScene();
     55    virtual ErrorMessage unloadCameras();
     56
    5457
    5558  public:
  • trunk/src/world_entities/cameraman.cc

    r10393 r10394  
    1111### File Specific:
    1212   main-programmer: Filip Gospodinov
    13    co-programmer:
     13   co-programmer: Silvan Nellen
    1414*/
    1515
     
    2828CREATE_SCRIPTABLE_CLASS(CameraMan,
    2929                        addMethod("changeCurrTarget", Executor2<CameraMan, lua_State*,const std::string&,const std::string&>(&CameraMan::changeCurrTarget))
    30                         ->addMethod("changeTarget", Executor3<CameraMan, lua_State*, int, const std::string&,const std::string&>(&CameraMan::changeTarget))
     30                        ->addMethod("changeTarget", Executor3<CameraMan, lua_State*, const std::string&, const std::string&,const std::string&>(&CameraMan::changeTarget))
    3131                        ->addMethod("setCam", Executor1<CameraMan, lua_State*, const std::string&>(&CameraMan::setCam))
    3232                        ->addMethod("togglFade", Executor0<CameraMan, lua_State*>(&CameraMan::togglFade))
     
    6969void CameraMan::createCam(const TiXmlElement* root)
    7070{
     71  printf("create Camera\n");
    7172  //Camera* newCamera=new Camera(root);
    7273  this->cameras.push_back(new Camera(root));
     
    132133
    133134
     135void CameraMan::changeTarget(const std::string& camName,const std::string& className, const std::string& objectName)
     136{
     137  BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
     138  BaseObject* newCam = ObjectListBase::getBaseObject("Camera", camName);
     139  if( object != NULL && object->isA(PNode::staticClassID()))
     140    dynamic_cast<Camera*>(newCam)->lookAt(dynamic_cast<PNode*>(object));
     141}
     142
    134143void CameraMan::changeCurrTarget(const std::string& className, const std::string& objectName)
    135144{
  • trunk/src/world_entities/cameraman.h

    r10393 r10394  
    2626    void moveCurrCam(int x, int y, int z);
    2727    void changeTarget(int camNo, const std::string& className,const std::string& objectName);
     28    void changeTarget(const std::string& camName,const std::string& className, const std::string& objectName);
    2829    void changeCurrTarget(const std::string& className, const std::string& objectName);
    2930    void atachCurrTarget(PNode* target);
Note: See TracChangeset for help on using the changeset viewer.