Changeset 320
- Timestamp:
- Nov 28, 2007, 3:24:13 PM (17 years ago)
- Location:
- code/branches/merger
- Files:
-
- 2 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/merger/bin/resources.cfg
r319 r320 1 // # Resource locations to be added to the 'boostrap' path2 // # This also contains the minimum you need to use the Ogre example framework3 // [Bootstrap]4 // Zip=../Media/packs/OgreCore.zip5 //6 // # Resource locations to be added to the default path7 // [General]8 // FileSystem=../Media9 // FileSystem=../Media/fonts10 // #FileSystem=../Media/materials/programs11 // FileSystem=../Media/materials/scripts12 // FileSystem=../Media/materials/textures13 // FileSystem=../Media/models14 // FileSystem=../Media/overlay15 // #FileSystem=../Media/particle16 // FileSystem=../Media/gui17 // Zip=../Media/packs/cubemap.zip18 // #Zip=../Media/packs/cubemapsJS.zip19 // #Zip=../Media/packs/dragon.zip20 // #Zip=../Media/packs/fresneldemo.zip21 // #Zip=../Media/packs/ogretestmap.zip22 // Zip=../Media/packs/skybox.zip23 24 1 # Resource locations to be added to the 'boostrap' path 25 2 # This also contains the minimum you need to use the Ogre example framework … … 31 8 FileSystem=../Media 32 9 FileSystem=../Media/fonts 33 FileSystem=../Media/materials/programs10 #FileSystem=../Media/materials/programs 34 11 FileSystem=../Media/materials/scripts 35 12 FileSystem=../Media/materials/textures 36 13 FileSystem=../Media/models 37 FileSystem=../Media/overlay s38 FileSystem=../Media/particle14 FileSystem=../Media/overlay 15 #FileSystem=../Media/particle 39 16 FileSystem=../Media/gui 40 FileSystem=../Media/DeferredShading../Media41 17 Zip=../Media/packs/cubemap.zip 42 Zip=../Media/packs/cubemapsJS.zip43 Zip=../Media/packs/dragon.zip44 Zip=../Media/packs/fresneldemo.zip45 Zip=../Media/packs/ogretestmap.zip18 #Zip=../Media/packs/cubemapsJS.zip 19 #Zip=../Media/packs/dragon.zip 20 #Zip=../Media/packs/fresneldemo.zip 21 #Zip=../Media/packs/ogretestmap.zip 46 22 Zip=../Media/packs/skybox.zip 47 23 24 # # Resource locations to be added to the 'boostrap' path 25 # # This also contains the minimum you need to use the Ogre example framework 26 # [Bootstrap] 27 # Zip=../Media/packs/OgreCore.zip 28 # 29 # # Resource locations to be added to the default path 30 # [General] 31 # FileSystem=../Media 32 # FileSystem=../Media/fonts 33 # FileSystem=../Media/materials/programs 34 # FileSystem=../Media/materials/scripts 35 # FileSystem=../Media/materials/textures 36 # FileSystem=../Media/models 37 # FileSystem=../Media/overlays 38 # FileSystem=../Media/particle 39 # FileSystem=../Media/gui 40 # FileSystem=../Media/DeferredShading../Media 41 # Zip=../Media/packs/cubemap.zip 42 # Zip=../Media/packs/cubemapsJS.zip 43 # Zip=../Media/packs/dragon.zip 44 # Zip=../Media/packs/fresneldemo.zip 45 # Zip=../Media/packs/ogretestmap.zip 46 # Zip=../Media/packs/skybox.zip -
code/branches/merger/src/orxonox.cc
r304 r320 41 41 #include "xml/xmlParser.h" 42 42 #include "loader/LevelLoader.h" 43 44 #include "spaceship_steering.h" 45 SpaceshipSteering* steering; 43 46 44 47 … … 74 77 #endif 75 78 76 namespace orxonox 79 80 using namespace Ogre; 81 82 class OrxExitListener : public FrameListener, public OIS::MouseListener 77 83 { 78 class OrxExitListener : public Ogre::FrameListener 79 { 80 public: 81 OrxExitListener(OIS::Keyboard *keyboard) 82 : mKeyboard(keyboard) 83 { 84 } 85 86 bool frameStarted(const Ogre::FrameEvent& evt) 87 { 88 mKeyboard->capture(); 89 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 90 } 91 92 private: 93 OIS::Keyboard *mKeyboard; 94 }; 84 public: 85 OrxExitListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse) 86 : mKeyboard(keyboard), mMouse(mouse) 87 { 88 speed = 250; 89 loop = 100; 90 rotate = 10; 91 mouseX = 0; 92 mouseY = 0; 93 maxMouseX = 0; 94 minMouseX = 0; 95 moved = false; 96 steering->brakeRotate(rotate*10); 97 steering->brakeLoop(loop); 98 mMouse->setEventCallback(this); 99 } 100 bool frameStarted(const FrameEvent& evt) 101 { 102 mKeyboard->capture(); 103 mMouse->capture(); 104 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 105 steering->moveForward(speed); 106 else 107 steering->moveForward(0); 108 if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) 109 steering->brakeForward(speed); 110 else 111 steering->brakeForward(speed/10); 112 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) 113 steering->loopRight(loop); 114 else 115 steering->loopRight(0); 116 if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) 117 steering->loopLeft(loop); 118 else 119 steering->loopLeft(0); 120 121 if(moved) { 122 if (mouseY<0) 123 steering->rotateUp(-mouseY*rotate); 124 if (mouseY>0) 125 steering->rotateDown(mouseY*rotate); 126 if (mouseX>0) 127 steering->rotateRight(mouseX*rotate); 128 if (mouseX<0) 129 steering->rotateLeft(-mouseX*rotate); 130 moved = false; 131 } 132 else { 133 steering->rotateUp(0); 134 steering->rotateDown(0); 135 steering->rotateRight(0); 136 steering->rotateLeft(0); 137 } 138 139 steering->tick(evt.timeSinceLastFrame); 140 // scenemanager->spacehip->tick(evt.timesincelastframe); 141 if(mKeyboard->isKeyDown(OIS::KC_ESCAPE)) 142 cout << "maximal MouseX: " << maxMouseX << "\tminMouseX: " << minMouseX << endl; 143 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 144 } 145 146 bool mouseMoved(const OIS::MouseEvent &e) 147 { 148 mouseX = e.state.X.rel; 149 mouseY = e.state.Y.rel; 150 if(mouseX>maxMouseX) maxMouseX = mouseX; 151 if(mouseX<minMouseX) minMouseX = mouseX; 152 cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl; 153 moved = true; 154 return true; 155 } 156 157 bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; } 158 bool mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; } 159 160 private: 161 float speed; 162 float rotate; 163 float loop; 164 float mouseY; 165 float mouseX; 166 float maxMouseX; 167 float minMouseX; 168 bool moved; 169 OIS::Keyboard *mKeyboard; 170 OIS::Mouse *mMouse; 171 }; 172 95 173 96 174 class OrxApplication … … 191 269 { 192 270 193 string levelFile = "sp_level_moonstation.oxw"; 194 loader::LevelLoader* loader = new loader::LevelLoader(levelFile); 195 } 271 string levelFile = "sp_level_moonstation.oxw"; 272 loader::LevelLoader* loader = new loader::LevelLoader(levelFile); 273 } 274 275 void setupScene() 276 { 277 SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager"); 278 Camera *cam = mgr->createCamera("Camera"); 279 cam->setPosition(Vector3(0,0,-250)); 280 cam->lookAt(Vector3(0,0,0)); 281 Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam); 282 283 284 mgr->setAmbientLight(ColourValue(1,1,1)); 285 Entity* head = mgr->createEntity("head", "ogrehead.mesh"); 286 SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode", Vector3(0,0,0)); 287 node->attachObject(head); 288 node->attachObject(cam); 289 mgr->setSkyBox(true, "Examples/SceneSkyBox2"); 290 291 Entity* head1 = mgr->createEntity("head1", "ogrehead.mesh"); 292 SceneNode *node1 = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode1", Vector3(200,0,0)); 293 node1->attachObject(head1); 294 Entity* head2 = mgr->createEntity("head2", "ogrehead.mesh"); 295 SceneNode *node2 = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode2", Vector3(200,400,-100)); 296 node2->attachObject(head2); 297 Entity* head3 = mgr->createEntity("head3", "ogrehead.mesh"); 298 SceneNode *node3 = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode3", Vector3(0,400,200)); 299 node3->attachObject(head3); 300 Entity* head4 = mgr->createEntity("head4", "ogrehead.mesh"); 301 SceneNode *node4 = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode4", Vector3(-400,-200,600)); 302 node4->attachObject(head4); 303 Entity* head5 = mgr->createEntity("head5", "ogrehead.mesh"); 304 SceneNode *node5 = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode5", Vector3(0,0,-400)); 305 node5->attachObject(head5); 306 307 steering = new SpaceshipSteering(500, 200, 200, 200); 308 steering->addNode(node); 309 310 } 311 196 312 197 313 void setupScene() 198 314 { 199 Ogre::SceneManager *mgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager"); 200 Ogre::Camera *cam = mgr->createCamera("Camera"); 201 Ogre::Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam); 315 // <<<<<<< .working 316 // Ogre::SceneManager *mgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager"); 317 // Ogre::Camera *cam = mgr->createCamera("Camera"); 318 // Ogre::Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam); 319 // ======= 320 mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false)); 321 mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true)); 322 202 323 } 203 324 … … 237 358 } 238 359 239 void createFrameListener() 240 {241 mListener = new OrxExitListener(mKeyboard);242 mRoot->addFrameListener(mListener);243 }244 360 361 void createFrameListener() 362 { 363 mListener = new OrxExitListener(mKeyboard, mMouse); 364 mRoot->addFrameListener(mListener); 365 } 245 366 void startRenderLoop() 246 367 { … … 248 369 } 249 370 }; 250 }371 // } 251 372 252 373 using namespace Ogre; -
code/branches/merger/src/orxonox/CMakeLists.txt
r319 r320 1 1 PROJECT(Orxonox) 2 2 3 SET(SRC_FILES orxonox.cc )3 SET(SRC_FILES orxonox.cc spaceship_steering.cc) 4 4 5 5 ADD_EXECUTABLE(../../bin/main ${SRC_FILES})
Note: See TracChangeset
for help on using the changeset viewer.