Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2007, 6:45:17 PM (17 years ago)
Author:
nicolape
Message:

Loading the steering works, but there is something odd with the steering object in orxonox.cc… it was defined global, i moved it to orxonox class and made it available with the singleton stuff.. it works for my loader and it compiles well, but when running the listener got a porblem with it and crashes. can someone take a look at id, thx

Location:
code/branches/FICN/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/objects/SpaceshipSteeringObject.cc

    r515 r519  
    5454                steering->addNode(sceneNode);
    5555   
     56   
     57   
     58   
    5659                std::cout << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl;
    5760        }       
  • code/branches/FICN/src/orxonox/orxonox.cc

    r515 r519  
    8080  {
    8181    public:
    82       OrxListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse, audio::AudioManager*  auMan)
     82      OrxListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse, audio::AudioManager*  auMan, SpaceshipSteering* steering)
    8383      : mKeyboard(keyboard), mMouse(mouse)
    8484      {
    8585       
    86         SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();
     86       
    8787       
    8888        speed = 250;
     
    9494        minMouseX = 0;
    9595        moved = false;
    96         steering->brakeRotate(rotate*10);
    97         steering->brakeLoop(loop);
     96       
     97        steering_ = steering;
     98
     99        steering_->brakeRotate(rotate*10);
     100        steering_->brakeLoop(loop);
     101   
     102
    98103        mMouse->setEventCallback(this);
    99104        auMan_ = auMan;
     
    104109        auMan_->update();
    105110
    106         SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();
    107 
    108111        mKeyboard->capture();
    109112        mMouse->capture();
    110113        if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W))
    111           steering->moveForward(speed);
     114          steering_->moveForward(speed);
    112115        else
    113           steering->moveForward(0);
     116          steering_->moveForward(0);
    114117        if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S))
    115           steering->brakeForward(speed);
     118          steering_->brakeForward(speed);
    116119        else
    117           steering->brakeForward(speed/10);
     120          steering_->brakeForward(speed/10);
    118121        if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D))
    119           steering->loopRight(loop);
     122          steering_->loopRight(loop);
    120123        else
    121           steering->loopRight(0);
     124          steering_->loopRight(0);
    122125        if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A))
    123           steering->loopLeft(loop);
     126          steering_->loopLeft(loop);
    124127        else
    125           steering->loopLeft(0);
     128          steering_->loopLeft(0);
    126129
    127130        if(moved) {
    128131          if (mouseY<=0)
    129             steering->rotateUp(-mouseY*rotate);
     132            steering_->rotateUp(-mouseY*rotate);
    130133          if (mouseY>0)
    131             steering->rotateDown(mouseY*rotate);
     134            steering_->rotateDown(mouseY*rotate);
    132135          if (mouseX>0)
    133             steering->rotateRight(mouseX*rotate);
     136            steering_->rotateRight(mouseX*rotate);
    134137          if (mouseX<=0)
    135             steering->rotateLeft(-mouseX*rotate);
     138            steering_->rotateLeft(-mouseX*rotate);
    136139          mouseY = 0;
    137140          mouseX = 0;
     
    139142        }
    140143        else {
    141           steering->rotateUp(0);
    142           steering->rotateDown(0);
    143           steering->rotateRight(0);
    144           steering->rotateLeft(0);
     144          steering_->rotateUp(0);
     145          steering_->rotateDown(0);
     146          steering_->rotateRight(0);
     147          steering_->rotateLeft(0);
    145148        }
    146149
    147                 steering->tick(evt.timeSinceLastFrame);
     150                steering_->tick(evt.timeSinceLastFrame);
    148151               
    149152               
     
    181184      OIS::Mouse *mMouse;
    182185      audio::AudioManager*  auMan_;
     186      SpaceshipSteering* steering_;
    183187  };
    184188  // init static singleton reference of Orxonox
     
    444448    ogre_->getRoot()->addFrameListener(TimerFL);
    445449
    446     frameListener_ = new OrxListener(keyboard_, mouse_, auMan_);
     450    frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_);
    447451    ogre_->getRoot()->addFrameListener(frameListener_);
    448452  }
Note: See TracChangeset for help on using the changeset viewer.