Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 474


Ignore:
Timestamp:
Dec 12, 2007, 6:26:56 PM (16 years ago)
Author:
nicolape
Message:
 
Location:
code/branches/FICN/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/loader/LevelLoader.cc

    r471 r474  
    33
    44#include "LevelLoader.h"
    5 //#include "xml/xmlParser.h"
    65#include "tinyxml/tinyxml.h"
     6#include "orxonox/core/IdentifierIncludes.h"
    77
    88using namespace std;
     
    1717        dir.append(file);       
    1818       
     19        // Open xml file
    1920        TiXmlDocument doc(file);
    20         bool loadOkay = doc.LoadFile();
    21         if (loadOkay)
    22         {
    23 
     21
     22        // Check if file was loaded
     23        if (doc.LoadFile())
     24        {
     25                TiXmlHandle hDoc(&doc);
     26                TiXmlHandle hRoot(0);   
     27
     28                TiXmlElement* pElem;
     29               
     30
     31                // Check for root element
     32                pElem = hDoc.FirstChildElement("orxonoxworld").Element();
     33                if (pElem)
     34                {
     35                        // Set root element
     36                        hRoot = TiXmlHandle(pElem);
     37
     38                        // Set level description
     39                        pElem = hRoot.FirstChild("description").Element();
     40                        if (pElem)
     41                        {
     42                                description_ = pElem->GetText();       
     43                        }
     44                       
     45                        // Set level name
     46                        pElem = hRoot.Element();
     47                        name_ = pElem->Attribute("name");
     48                        image_ = pElem->Attribute("image");
     49                       
     50                        // Set loading screen
     51                        pElem = hRoot.FirstChild("loading").Element();
     52                        if (pElem)
     53                        {
     54                                // Set background
     55                                pElem = hRoot.FirstChild("loading").FirstChild("background").Element();
     56                                if (pElem)
     57                                {
     58                                        loadingBackgroundColor_ = pElem->Attribute("color");
     59                                        loadingBackgroundImage_ = pElem->Attribute("image");
     60                                }
     61                                // Set bar
     62                                pElem = hRoot.FirstChild("loading").FirstChild("bar").Element();
     63                                if (pElem)
     64                                {
     65                                        loadingBarImage_ = pElem->Attribute("image");;
     66                                        loadingBarTop_ = pElem->Attribute("top");
     67                                        loadingBarLeft_ = pElem->Attribute("left");
     68                                        loadingBarWidth_ = pElem->Attribute("width");
     69                                        loadingBarHeight_ = pElem->Attribute("height");
     70                                }
     71                        }
     72                                               
     73                       
     74                }
     75                else
     76                {
     77                        std::string err = "Level file has no valid root node";
     78                        std::cout << err << std::endl;
     79                }       
    2480        }
    2581        else
     
    2985                std::cout << err << std::endl;
    3086        }       
     87       
     88       
     89        //orxonox::BaseObject* bla = orxonox::ID("classname")->fabricate();
     90        //bla->loadParams();
     91       
    3192       
    3293        /*
  • code/branches/FICN/src/loader/LevelLoader.h

    r471 r474  
    1010
    1111#include "loader_platform.h"
     12#include "tinyxml/tinyxml.h"
     13
    1214//#include "xml/xmlParser.h"
    1315
     
    3436                std::string description_;
    3537                std::string image_;
     38               
     39                std::string loadingBackgroundColor_;
     40                std::string loadingBackgroundImage_;
     41                std::string loadingBarImage_;
     42                std::string loadingBarTop_;
     43                std::string loadingBarLeft_;
     44                std::string loadingBarWidth_;
     45                std::string loadingBarHeight_;
    3646                       
    3747        public:
  • code/branches/FICN/src/orxonox/core/OrxonoxClass.h

    r384 r474  
    1414#include "ObjectList.h"
    1515#include "MetaObjectList.h"
     16
     17#include "../../tinyxml/tinyxml.h"
     18
    1619
    1720namespace orxonox
     
    8992            inline const bool isVisible() const { return this->bVisible_; }
    9093
     94                        //virtual void loadParams(TIXMLNode n);
     95
    9196        private:
    9297            Identifier* identifier_;        //!< The Identifier of the object
Note: See TracChangeset for help on using the changeset viewer.