Changeset 474
- Timestamp:
- Dec 12, 2007, 6:26:56 PM (17 years ago)
- Location:
- code/branches/FICN/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/loader/LevelLoader.cc
r471 r474 3 3 4 4 #include "LevelLoader.h" 5 //#include "xml/xmlParser.h"6 5 #include "tinyxml/tinyxml.h" 6 #include "orxonox/core/IdentifierIncludes.h" 7 7 8 8 using namespace std; … … 17 17 dir.append(file); 18 18 19 // Open xml file 19 20 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 } 24 80 } 25 81 else … … 29 85 std::cout << err << std::endl; 30 86 } 87 88 89 //orxonox::BaseObject* bla = orxonox::ID("classname")->fabricate(); 90 //bla->loadParams(); 91 31 92 32 93 /* -
code/branches/FICN/src/loader/LevelLoader.h
r471 r474 10 10 11 11 #include "loader_platform.h" 12 #include "tinyxml/tinyxml.h" 13 12 14 //#include "xml/xmlParser.h" 13 15 … … 34 36 std::string description_; 35 37 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_; 36 46 37 47 public: -
code/branches/FICN/src/orxonox/core/OrxonoxClass.h
r384 r474 14 14 #include "ObjectList.h" 15 15 #include "MetaObjectList.h" 16 17 #include "../../tinyxml/tinyxml.h" 18 16 19 17 20 namespace orxonox … … 89 92 inline const bool isVisible() const { return this->bVisible_; } 90 93 94 //virtual void loadParams(TIXMLNode n); 95 91 96 private: 92 97 Identifier* identifier_; //!< The Identifier of the object
Note: See TracChangeset
for help on using the changeset viewer.