Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/Entity.cc @ 621

Last change on this file since 621 was 614, checked in by rgrieder, 17 years ago
  • curiously (…) under windows there is no difference between orxonox.h and Orxonox.h…
File size: 1.2 KB
Line 
1#include <OgreSceneManager.h>
2#include <string>
3
4#include "../Orxonox.h"
5#include "../../tinyxml/tinyxml.h"
6#include "../../misc/Tokenizer.h"
7#include "../../misc/String2Number.h"
8#include "../core/Debug.h"
9
10#include "Entity.h"
11
12namespace orxonox
13{
14    CreateFactory(Entity);
15
16    Entity::Entity()
17    {
18        RegisterObject(Entity);
19    }
20
21    Entity::~Entity()
22    {
23    }
24
25    void Entity::loadParams(TiXmlElement* xmlElem)
26    {
27        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
28
29        if (xmlElem->Attribute("name") && xmlElem->Attribute("src") && xmlElem->Attribute("node"))
30        {
31                std::string name = xmlElem->Attribute("name");
32                std::string src = xmlElem->Attribute("src");
33                std::string node = xmlElem->Attribute("node");
34
35                        Ogre::Entity* entity = mgr->createEntity(name, src);
36
37                    Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(node);
38                    sceneNode->attachObject((Ogre::MovableObject*)entity);
39
40                COUT(4) << "Loader: Created entity "<< name <<" with source " << src  << " at node " << node  << std::endl << std::endl;
41        }
42   }
43
44}
Note: See TracBrowser for help on using the repository browser.