Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 538 was 531, checked in by scheusso, 17 years ago

started implementing presentation ;)

File size: 1.1 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
9#include "Entity.h"
10
11namespace orxonox
12{
13    CreateFactory(Entity);
14
15    Entity::Entity()
16    {
17        RegisterObject(Entity);
18    }
19
20    Entity::~Entity()
21    {
22    }
23
24    void Entity::loadParams(TiXmlElement* xmlElem)
25    {
26        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
27       
28        if (xmlElem->Attribute("name") && xmlElem->Attribute("src") && xmlElem->Attribute("node"))
29        {
30                std::string name = xmlElem->Attribute("name");
31                std::string src = xmlElem->Attribute("src");
32                std::string node = xmlElem->Attribute("node");
33                       
34                        Ogre::Entity* entity = mgr->createEntity(name, src);
35
36                    Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(node);
37                    sceneNode->attachObject((Ogre::MovableObject*)entity);
38
39                std::cout << "Loader: Created entity "<< name <<" with source " << src  << " at node " << node  << std::endl << std::endl;
40        }       
41   }
42   
43}
Note: See TracBrowser for help on using the repository browser.