Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10390 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jan 26, 2007, 6:59:26 PM (18 years ago)
Author:
snellen
Message:

made cameraman xml-loadable (hopefully)

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/cameraman.cc

    r10388 r10390  
    2121#include <string>
    2222#include "script_class.h"
     23#include "loading/load_param_xml.h"
    2324
    2425ObjectListDefinition(CameraMan);
     
    2829                        addMethod("changeCurrTarget", Executor2<CameraMan, lua_State*,const std::string&,const std::string&>(&CameraMan::changeCurrTarget))
    2930                        ->addMethod("changeTarget", Executor3<CameraMan, lua_State*, int, const std::string&,const std::string&>(&CameraMan::changeTarget))
     31                        ->addMethod("setCamera", Executor1<CameraMan, lua_State*, int>(&CameraMan::setCam))
    3032                        ->addMethod("togglFade", Executor0<CameraMan, lua_State*>(&CameraMan::togglFade))
     33                        ->addMethod("getCurrCameraCoorX", Executor0ret<CameraMan, lua_State*,float>(&CameraMan::getCurrCameraCoorX))
     34                        ->addMethod("getCurrCameraCoorY", Executor0ret<CameraMan, lua_State*,float>(&CameraMan::getCurrCameraCoorY))
     35                        ->addMethod("getCurrCameraCoorZ", Executor0ret<CameraMan, lua_State*,float>(&CameraMan::getCurrCameraCoorZ))
    3136                       );
    3237
    3338
    34 CameraMan::CameraMan()
     39CameraMan::CameraMan(const TiXmlElement* root)
    3540{
    3641  this->registerObject(this, CameraMan::_objectList);
     
    4348  State::setCamera(currentCam, currentCam->getTarget());
    4449  this->fadeToBlack=new BlackScreen();
     50 
     51  if (root != NULL)
     52    this->loadParams(root);
    4553}
    4654
    4755
    48 void CameraMan::createCam()
     56void CameraMan::loadParams(const TiXmlElement* root)
     57{
     58  BaseObject::loadParams(root);
     59 
     60  LOAD_PARAM_START_CYCLE(root, object);
     61  {
     62    this->createCam(root);
     63  }
     64  LOAD_PARAM_END_CYCLE(object);
     65
     66 
     67 
     68
     69}
     70
     71
     72void CameraMan::createCam(const TiXmlElement* root)
    4973{
    5074 // Camera* newCamera=new Camera();
    51   this->cameras.push_back(new Camera());
     75  this->cameras.push_back(new Camera(root));
    5276  cameras[cameras.size()-1]->target->detach();
    5377  cameras[cameras.size()-1]->setClipRegion(nearClip, farClip);
  • trunk/src/world_entities/cameraman.h

    r10388 r10390  
    1919  public:
    2020    std::vector<Camera*> cameras;
    21     CameraMan();
     21    CameraMan(const TiXmlElement* root = NULL);
    2222    void setCam(int CameraNo);
    23     void createCam();
     23    void createCam(const TiXmlElement* root);
    2424    void moveCam(int x, int y, int z,  int camNo);
    2525    void moveCurrCam(int x, int y, int z);
     
    3232    void setClipRegion(float nearClip, float farClip);
    3333    void togglFade();
     34   
     35    /// LOADING
     36    virtual void loadParams(const TiXmlElement* root);
     37   
     38    /// Polling (to be used in scripts)
     39    float getCurrCameraCoorX(){ return this->currentCam->getAbsCoorX(); }
     40    float getCurrCameraCoorY(){ return this->currentCam->getAbsCoorY(); }
     41    float getCurrCameraCoorZ(){ return this->currentCam->getAbsCoorZ(); }
    3442
    3543};
Note: See TracChangeset for help on using the changeset viewer.