Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/objects/SpaceshipSteeringObject.cc @ 856

Last change on this file since 856 was 790, checked in by nicolasc, 17 years ago

merged FICN back into trunk
awaiting release.

File size: 3.2 KB
RevLine 
[732]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      ...
23 *   Co-authors:
24 *      ...
25 *
26 */
27
[786]28#include "OrxonoxStableHeaders.h"
[784]29
[515]30#include <OgreSceneManager.h>
31#include <OgreSceneNode.h>
32#include <OgreRoot.h>
33#include <OgreRenderWindow.h>
34
35#include <string>
36
[614]37#include "../Orxonox.h"
38#include "../GraphicsEngine.h"
[742]39#include "util/tinyxml/tinyxml.h"
40#include "util/Tokenizer.h"
41#include "util/String2Number.h"
[560]42#include "../core/Debug.h"
[515]43
44#include "SpaceshipSteeringObject.h"
45
[612]46#include "../SpaceshipSteering.h"
[515]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    {
[663]63      SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();
[560]64
[663]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");
[515]72
[663]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);
[560]78
[663]79        steering = new SpaceshipSteering(forward, rotateupdown, rotaterightleft, looprightleft);
[560]80
[663]81        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
82        Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(nodeStr);
[560]83
[663]84        steering->addNode(sceneNode);
[560]85
86
87
88
[663]89        COUT(4) << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl;
90      }
[515]91   }
92}
Note: See TracBrowser for help on using the repository browser.