Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 140 for code/branches/xml


Ignore:
Timestamp:
Nov 1, 2007, 1:46:09 PM (17 years ago)
Author:
nicolape
Message:

XML-Loader so far…

Location:
code/branches/xml
Files:
11 added
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/xml/bin/run-script

    r89 r140  
    11#!/bin/bash
    2 
     2cd bin
    33if [[ !  -f main ]] ; then
    44        echo "main does not exist"
     
    2323fi
    2424exec ./main
     25cd ..
  • code/branches/xml/src/CMakeLists.txt

    r89 r140  
    22
    33# create a few variables to simplify life
    4 SET(SRC_FILES orxonox.cc)
    5 SET(INC_FILES ExampleApplication.h  ExampleFrameListener.h)
     4SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc)
     5SET(INC_FILES ExampleApplication.h  ExampleFrameListener.h loader/LevelLoader.h xml/xmlParser.h)
    66
    77#Creates an executable
  • code/branches/xml/src/orxonox.cc

    r108 r140  
    2929#include "ExampleApplication.h"
    3030
     31#include <string>
     32#include <iostream>
     33
     34#include "xml/xmlParser.h"
     35#include "loader/LevelLoader.h"
     36
     37
     38
     39using namespace std;
     40
    3141// TODO: Put creation of SceneNode and implementation of FrameListener into an extern file
    3242SceneNode *lightNode;
    3343
    34 class OrxFrameListener : public ExampleFrameListener
     44class FrameListener : public ExampleFrameListener
    3545{
    3646  public:
    37     OrxFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr)
     47    FrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr)
    3848  : ExampleFrameListener(win, cam, false, false)
    3949    {
     
    8191    void createScene(void)
    8292    {
     93
     94        string levelFile = "sp_level_moonstation.oxw";
     95                        loader::LevelLoader* loader = new loader::LevelLoader(levelFile);
     96
     97/*                     
     98                        LightManager* lightman = new LightManager();
     99                        loader->loadLights(lightman);
     100                        CameraManager* cameraman = new CameraManager();
     101                        loader->loadCameras(cameraman);                     
     102                        ScriptManager* scriptman = new ScriptManager();
     103                        loader->loadScripts(scriptman);                     
     104        */                                         
     105   
     106   
    83107        // add tutorial code here:
    84108        // ...
    85       mSceneMgr->setAmbientLight( ColourValue( 0.3, 0.3, 0.3 ) );
    86       //Entity* head = mSceneMgr->createEntity("head", "ogrehead.mesh");
     109       
     110        /*
     111      mSceneMgr->setAmbientLight( ColourValue( 1, 1, 0.1 ) );
     112      Entity* head = mSceneMgr->createEntity("head", "ogrehead.mesh");
    87113
    88       //Entity* head2 = mSceneMgr->createEntity("head2", "ogrehead.mesh");
     114      Entity* head2 = mSceneMgr->createEntity("head2", "ogrehead.mesh");
    89115
    90116      SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode( "OgreHeadNode", Vector3( 0, 0, 0 ) );
    91       //node->attachObject( head );
     117      node->attachObject( head );
    92118
    93119      SceneNode *node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "OgreHeadNode2", Vector3( 50, 0, 0 ) );
    94       //node2->attachObject( head2 );
     120      node2->attachObject( head2 );
    95121
    96122
     
    111137      lightNode->attachObject(light);
    112138      light->setPosition(0.0, 0.0, 0.0);
     139     
     140      */
    113141    }
    114142
     
    116144    {
    117145        // create frame listener
    118       mFrameListener = new OrxFrameListener(mWindow, mCamera, mSceneMgr);
     146      mFrameListener = new ExampleFrameListener(mWindow, mCamera, mSceneMgr);
    119147      mRoot->addFrameListener(mFrameListener);
    120148    }
     
    124152#define WIN32_LEAN_AND_MEAN
    125153#include "windows.h"
    126 
    127154INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
    128155#else
    129 
    130156int main(int argc, char **argv)
    131157#endif
     
    134160  Orxonox orxonox;
    135161
    136   try {
     162  try
     163  {
    137164    orxonox.go();
    138   } catch( Exception& e ) {
    139 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    140     MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
    141 #else
    142     fprintf(stderr, "An exception has occurred: %s\n",
    143             e.getFullDescription().c_str());
    144 #endif
     165  }
     166  catch( Exception& e )
     167  {
     168                #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
     169        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
     170                #else
     171        fprintf(stderr, "An exception has occurred: %s\n",e.getFullDescription().c_str());
     172                #endif
    145173  }
    146 
    147174  return 0;
    148175}
Note: See TracChangeset for help on using the changeset viewer.