Changeset 507
- Timestamp:
- Dec 12, 2007, 11:34:58 PM (17 years ago)
- Location:
- code/branches/FICN/src
- Files:
-
- 6 added
- 5 deleted
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/loader/LevelLoader.cc
r496 r507 1 #include <string.h> 1 #include <string> 2 #include <vector> 2 3 #include <iostream> 4 #include <algorithm> 5 #include <iterator> 3 6 4 7 #include "LevelLoader.h" … … 127 130 } 128 131 129 130 //orxonox::BaseObject* bla = orxonox::ID("classname")->fabricate(); 131 //bla->loadParams(); 132 LevelLoader::~LevelLoader() 133 { 134 135 } 132 136 133 137 134 /* 135 rootNode = XMLNode::openFileHelper(dir.c_str(),"orxonoxworld"); 136 // TODO: Error handling 137 138 // Assing general level infos to class variables 138 string LevelLoader::name() 139 { 140 return this->name_; 141 } 139 142 140 this->name_ = rootNode.getAttribute("name"); 141 this->image_ = rootNode.getAttribute("image"); 142 this->description_ = rootNode.getChildNode("description").getText(); 143 144 loadingScreenNode = rootNode.getChildNode("loading"); 145 if (!loadingScreenNode.isEmpty()) 146 { 147 this->showLoadingScreen(); 148 } 149 150 worldNode = rootNode.getChildNode("world"); 151 if (!worldNode.isEmpty()) 152 { 153 154 } 155 */ 156 157 158 /* 159 // Assign sub-nodes 160 if (rootNode.nChildNode("LightManager")==1) 161 { 162 // Init Luightmanager... 163 }*/ 164 165 /* 166 167 worldNode = rootNode.getChildNode("WorldEntities"); 168 scriptNode = rootNode.getChildNode("ScriptManager"); 169 cameraNode = rootNode.getChildNode("CameraMan"); 170 lightNode = rootNode.getChildNode("LightManager"); 171 */ 172 173 174 175 LevelLoader::~LevelLoader() 176 { 143 string LevelLoader::description() 144 { 145 return this->description_; 146 } 147 148 string LevelLoader::image() 149 { 150 return this->image_; 151 } 177 152 178 153 179 154 } 180 155 181 182 string LevelLoader::name()183 {184 return this->name_;185 }186 187 string LevelLoader::description()188 {189 return this->description_;190 }191 192 string LevelLoader::image()193 {194 return this->image_;195 }196 197 198 /*199 200 201 void LevelLoader::loadWorld(WorldManager* wm)202 {203 if (!worldNode.getChildNode("lights").isEmpty())204 {205 206 207 }208 }209 210 211 void LevelLoader::loadLights(LightManager* lm)212 {213 if (!lightNode.getChildNode("lights").isEmpty())214 {215 int nLights = lightNode.getChildNode("lights").nChildNode("light");216 for (int i=0; i<nLights;i++)217 {218 XMLNode t = lightNode.getChildNode("lights").getChildNode("light",i);219 const char* diffuse = t.getAttribute("diffuse-color");220 const char* coor = t.getAttribute("abs-coor");221 lm->addLight(diffuse,coor);222 }223 }224 lm->setAmbient(lightNode.getChildNode("ambient").getAttribute("color"));225 }226 227 void LevelLoader::loadCameras(CameraManager* cm)228 {229 if (!cameraNode.getChildNode("cameras").isEmpty())230 {231 int nCameras = cameraNode.getChildNode("cameras").nChildNode("camera");232 for (int i=0; i<nCameras;i++)233 {234 XMLNode t = cameraNode.getChildNode("cameras").getChildNode("camera",i);235 236 237 cm->addCamera();238 }239 }240 }241 242 243 void LevelLoader::loadScripts(ScriptManager* sm)244 {245 if (!scriptNode.getChildNode("scripts").isEmpty())246 {247 int nScripts = scriptNode.getChildNode("scripts").nChildNode("script");248 for (int i=0; i<nScripts;i++)249 {250 XMLNode t = scriptNode.getChildNode("scripts").getChildNode("script",i);251 sm->addScript(t.getAttribute("file"));252 }253 254 }255 }256 */257 258 259 }260 -
code/branches/FICN/src/loader/LevelLoader.h
r480 r507 7 7 8 8 #include <string> 9 #include <vector> 9 10 #include <iostream> 10 11 … … 23 24 class _LoaderExport LevelLoader 24 25 { 26 public: 27 // Constructors, loads the level file and some information data 28 LevelLoader(string file, string dir="levels"); 29 // Destructor 30 ~LevelLoader(); 31 // Shows a simple loading screen 32 void showLoadingScreen(); 33 // Loads all level data 34 void loadLevel(); 35 36 // Getters 37 string name(); 38 string description(); 39 string image(); 25 40 private: 26 41 // Level information … … 36 51 std::string loadingBarHeight_; 37 52 53 // Set to true if it was possible to load the level file 38 54 bool valid_; 39 55 56 // Xml-Stuff 40 57 TiXmlDocument doc; 41 58 TiXmlElement* rootElement; 42 public:43 59 44 // Constructors45 LevelLoader(string file, string dir="levels");46 ~LevelLoader();47 48 void showLoadingScreen();49 void loadLevel();50 51 // Getters52 string name();53 string description();54 string image();55 56 // Managers57 58 60 59 61 }; -
code/branches/FICN/src/misc/String2Number.h
r487 r507 32 32 * should be one of std::hex, std::dec or std::oct (dec is default value) 33 33 */ 34 String2Number(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec, int haltOnError=1)34 inline String2Number(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec, int haltOnError=1) 35 35 { 36 36 std::istringstream iss(s); -
code/branches/FICN/src/orxonox/objects/CMakeLists.txt
r496 r507 7 7 test2.cc 8 8 test3.cc 9 Ambient.cc 10 Skybox.cc 9 11 ) 10 12 -
code/branches/FICN/src/orxonox/objects/test1.cc
r482 r507 72 72 void Test1::loadParams(TiXmlElement* xmlElem) 73 73 { 74 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager(); 75 76 mgr->setAmbientLight(ColourValue(1,0,0)); 77 78 79 80 std::cout<< xmlElem->GetText()<<std::endl; 74 81 75 82 76 -
code/branches/FICN/src/orxonox/orxonox.cc
r505 r507 56 56 #include "core/Factory.h" 57 57 58 #include "../xml/xmlParser.h"59 58 #include "../loader/LevelLoader.h" 60 59 #include "../audio/AudioManager.h" … … 360 359 { 361 360 SceneManager *mgr = ogre_->getSceneManager(); 361 362 362 Camera *cam = mgr->createCamera("Camera"); 363 363 cam->setPosition(Vector3(0,0,-250)); … … 370 370 node->attachObject(head); 371 371 node->attachObject(cam); 372 mgr->setSkyBox(true, "Examples/SceneSkyBox2"); 372 373 373 374 374 375 Entity* head1 = mgr->createEntity("head1", "ogrehead.mesh");
Note: See TracChangeset
for help on using the changeset viewer.