Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gui/src/asylum/orxonox/objects/SpaceshipSteeringObject.cc @ 1695

Last change on this file since 1695 was 1505, checked in by rgrieder, 17 years ago

f* svn: It doesn't even inform you if you attempt to set a non existing property. It is svn:eol-style and not eol-style when using the command by the way…

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "OrxonoxStableHeaders.h"
30
31#include <OgreSceneManager.h>
32#include <OgreSceneNode.h>
33#include <OgreRoot.h>
34#include <OgreRenderWindow.h>
35
36#include <string>
37
38#include "../Orxonox.h"
39#include "../GraphicsEngine.h"
40#include "util/tinyxml/tinyxml.h"
41#include "util/Tokenizer.h"
42#include "util/String2Number.h"
43#include "core/CoreIncludes.h"
44#include "SpaceshipSteeringObject.h"
45
46#include "../SpaceshipSteering.h"
47
48namespace orxonox
49{
50    CreateFactory(SpaceshipSteeringObject);
51
52    SpaceshipSteeringObject::SpaceshipSteeringObject()
53    {
54        RegisterObject(SpaceshipSteeringObject);
55    }
56
57    SpaceshipSteeringObject::~SpaceshipSteeringObject()
58    {
59    }
60
61    void SpaceshipSteeringObject::loadParams(TiXmlElement* xmlElem)
62    {
63      SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();
64
65      if (xmlElem->Attribute("node") && xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft"))
66      {
67        std::string nodeStr = xmlElem->Attribute("node");
68        std::string forwardStr = xmlElem->Attribute("forward");
69        std::string rotateupdownStr = xmlElem->Attribute("rotateupdown");
70        std::string rotaterightleftStr = xmlElem->Attribute("rotaterightleft");
71        std::string looprightleftStr = xmlElem->Attribute("looprightleft");
72
73        float forward, rotateupdown, rotaterightleft, looprightleft;
74        String2Number<float>(forward, forwardStr);
75        String2Number<float>(rotateupdown, rotateupdownStr);
76        String2Number<float>(rotaterightleft, rotaterightleftStr);
77        String2Number<float>(looprightleft, looprightleftStr);
78
79        steering = new SpaceshipSteering(forward, rotateupdown, rotaterightleft, looprightleft);
80
81        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
82        Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(nodeStr);
83
84        steering->addNode(sceneNode);
85
86
87
88
89        COUT(4) << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl;
90      }
91   }
92}
Note: See TracBrowser for help on using the repository browser.