Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 320


Ignore:
Timestamp:
Nov 28, 2007, 3:24:13 PM (17 years ago)
Author:
nicolasc
Message:

dont ask: bump

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' path
    2 // # This also contains the minimum you need to use the Ogre example framework
    3 // [Bootstrap]
    4 // Zip=../Media/packs/OgreCore.zip
    5 //
    6 // # Resource locations to be added to the default path
    7 // [General]
    8 // FileSystem=../Media
    9 // FileSystem=../Media/fonts
    10 // #FileSystem=../Media/materials/programs
    11 // FileSystem=../Media/materials/scripts
    12 // FileSystem=../Media/materials/textures
    13 // FileSystem=../Media/models
    14 // FileSystem=../Media/overlay
    15 // #FileSystem=../Media/particle
    16 // FileSystem=../Media/gui
    17 // Zip=../Media/packs/cubemap.zip
    18 // #Zip=../Media/packs/cubemapsJS.zip
    19 // #Zip=../Media/packs/dragon.zip
    20 // #Zip=../Media/packs/fresneldemo.zip
    21 // #Zip=../Media/packs/ogretestmap.zip
    22 // Zip=../Media/packs/skybox.zip
    23 
    241# Resource locations to be added to the 'boostrap' path
    252# This also contains the minimum you need to use the Ogre example framework
     
    318FileSystem=../Media
    329FileSystem=../Media/fonts
    33 FileSystem=../Media/materials/programs
     10#FileSystem=../Media/materials/programs
    3411FileSystem=../Media/materials/scripts
    3512FileSystem=../Media/materials/textures
    3613FileSystem=../Media/models
    37 FileSystem=../Media/overlays
    38 FileSystem=../Media/particle
     14FileSystem=../Media/overlay
     15#FileSystem=../Media/particle
    3916FileSystem=../Media/gui
    40 FileSystem=../Media/DeferredShading../Media
    4117Zip=../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
     18#Zip=../Media/packs/cubemapsJS.zip
     19#Zip=../Media/packs/dragon.zip
     20#Zip=../Media/packs/fresneldemo.zip
     21#Zip=../Media/packs/ogretestmap.zip
    4622Zip=../Media/packs/skybox.zip
    4723
     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  
    4141#include "xml/xmlParser.h"
    4242#include "loader/LevelLoader.h"
     43
     44#include "spaceship_steering.h"
     45SpaceshipSteering* steering;
    4346
    4447
     
    7477#endif
    7578
    76 namespace orxonox
     79
     80using namespace Ogre;
     81
     82class OrxExitListener : public FrameListener, public OIS::MouseListener
    7783{
    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
    95173
    96174  class OrxApplication
     
    191269      {
    192270
    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
    196312
    197313      void setupScene()
    198314      {
    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
    202323      }
    203324
     
    237358      }
    238359
    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    }
    245366      void startRenderLoop()
    246367      {
     
    248369      }
    249370  };
    250 }
     371// }
    251372
    252373using namespace Ogre;
  • code/branches/merger/src/orxonox/CMakeLists.txt

    r319 r320  
    11PROJECT(Orxonox)
    22
    3 SET(SRC_FILES orxonox.cc)
     3SET(SRC_FILES orxonox.cc spaceship_steering.cc)
    44
    55ADD_EXECUTABLE(../../bin/main ${SRC_FILES})
Note: See TracChangeset for help on using the changeset viewer.