Index: /code/branches/main_reto/include/Bullet.h
===================================================================
--- /code/branches/main_reto/include/Bullet.h (revision 140)
+++ /code/branches/main_reto/include/Bullet.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __Bullet__
#define __Bullet__
Index: /code/branches/main_reto/include/CameraManager.h
===================================================================
--- /code/branches/main_reto/include/CameraManager.h (revision 140)
+++ /code/branches/main_reto/include/CameraManager.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __CameraManager__
#define __CameraManager__
Index: de/branches/main_reto/include/MyListener.h
===================================================================
--- /code/branches/main_reto/include/MyListener.h (revision 140)
+++ (revision )
@@ -1,23 +1,0 @@
-#ifndef __MyListener__
-#define __MyListener__
-
-#include "OgreControl.h"
-#include "ExampleFrameListener.h"
-
-// Declare a subclass of the ExampleFrameListener class
-class MyListener : public ExampleFrameListener
-{
-public:
- MyListener(RenderWindow* win, Camera* cam);
-
- void setReceiver(OgreControl*);
-
- bool frameStarted(const FrameEvent& evt);
-
- bool frameEnded(const FrameEvent& evt);
-
-private:
- OgreControl *myApp;
-};
-
-#endif
Index: /code/branches/main_reto/include/OgreControl.h
===================================================================
--- /code/branches/main_reto/include/OgreControl.h (revision 140)
+++ /code/branches/main_reto/include/OgreControl.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __OgreControl__
#define __OgreControl__
Index: /code/branches/main_reto/include/Orxonox.h
===================================================================
--- /code/branches/main_reto/include/Orxonox.h (revision 140)
+++ /code/branches/main_reto/include/Orxonox.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __Orxonox__
#define __Orxonox__
Index: /code/branches/main_reto/include/OrxonoxScene.h
===================================================================
--- /code/branches/main_reto/include/OrxonoxScene.h (revision 140)
+++ /code/branches/main_reto/include/OrxonoxScene.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __DemoScene__
#define __DemoScene__
Index: /code/branches/main_reto/include/OrxonoxShip.h
===================================================================
--- /code/branches/main_reto/include/OrxonoxShip.h (revision 140)
+++ /code/branches/main_reto/include/OrxonoxShip.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __OrxonoxShip__
#define __OrxonoxShip__
@@ -29,9 +57,10 @@
Bullet* fire();
- bool tick(unsigned long, float);
+ bool tick(unsigned long, Real);
+
+ SceneNode *mRootNode;
protected:
SceneManager *mSceneMgr;
- SceneNode *mRootNode;
Entity *mShip;
Index: /code/branches/main_reto/include/RunManager.h
===================================================================
--- /code/branches/main_reto/include/RunManager.h (revision 140)
+++ /code/branches/main_reto/include/RunManager.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __RunManager__
#define __RunManager__
@@ -9,5 +37,4 @@
#include "OrxonoxScene.h"
#include "OrxonoxShip.h"
-#include "SteerableNode.h"
//Use this define to signify OIS will be used as a DLL
Index: de/branches/main_reto/include/SteerableNode.h
===================================================================
--- /code/branches/main_reto/include/SteerableNode.h (revision 140)
+++ (revision )
@@ -1,22 +1,0 @@
-#ifndef __SteerableNode__
-#define __SteerableNode__
-
-#include "Ogre.h"
-
-using namespace Ogre;
-
-class SteerableNode
-{
-public:
- SteerableNode(SceneManager*, const Ogre::String&);
- SteerableNode(SceneManager*);
- virtual ~SteerableNode();
-
- virtual bool initialise();
-
-protected:
- SceneNode *mNode;
-};
-
-
-#endif
Index: /code/branches/main_reto/include/WeaponManager.h
===================================================================
--- /code/branches/main_reto/include/WeaponManager.h (revision 140)
+++ /code/branches/main_reto/include/WeaponManager.h (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#ifndef __WeaponManager__
#define __WeaponManager__
Index: /code/branches/main_reto/src/Bullet.cpp
===================================================================
--- /code/branches/main_reto/src/Bullet.cpp (revision 140)
+++ /code/branches/main_reto/src/Bullet.cpp (revision 141)
@@ -1,6 +1,34 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "Bullet.h"
-Bullet::Bullet(SceneNode *mNode, Entity *mEntity, Vector3 mSpeed) : mNode(mNode), mEntity(mEntity), mSpeed(mSpeed)
+Bullet::Bullet(SceneNode *mNode, Entity *mEntity, Vector3 mSpeed)
+ : mNode(mNode), mEntity(mEntity), mSpeed(mSpeed)
{
mNode->attachObject(mEntity);
Index: /code/branches/main_reto/src/CameraManager.cpp
===================================================================
--- /code/branches/main_reto/src/CameraManager.cpp (revision 140)
+++ /code/branches/main_reto/src/CameraManager.cpp (revision 141)
@@ -1,2 +1,29 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "CameraManager.h"
Index: de/branches/main_reto/src/MyListener.cpp
===================================================================
--- /code/branches/main_reto/src/MyListener.cpp (revision 140)
+++ (revision )
@@ -1,22 +1,0 @@
-#include "MyListener.h"
-
-// Declare a subclass of the ExampleFrameListener class
-MyListener::MyListener(RenderWindow* win, Camera* cam) : ExampleFrameListener(win, cam)
-{
-}
-
-bool MyListener::frameStarted(const FrameEvent& evt)
-{
- myApp->render(evt.timeSinceLastFrame);
- return ExampleFrameListener::frameStarted(evt);
-}
-
-bool MyListener::frameEnded(const FrameEvent& evt)
-{
- return ExampleFrameListener::frameEnded(evt);
-}
-
-void MyListener::setReceiver(OgreControl* app)
-{
- myApp = app;
-}
Index: /code/branches/main_reto/src/OgreControl.cpp
===================================================================
--- /code/branches/main_reto/src/OgreControl.cpp (revision 140)
+++ /code/branches/main_reto/src/OgreControl.cpp (revision 141)
@@ -1,2 +1,29 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "OgreControl.h"
@@ -14,5 +41,6 @@
assert(mainBundleURL);
- CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
+ CFStringRef cfStringRef =
+ CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
assert(cfStringRef);
@@ -30,7 +58,8 @@
{
mRoot = 0;
- // Provide a nice cross platform solution for locating the configuration files
- // On windows files are searched for in the current working directory, on OS X however
- // you must provide the full path, the helper function macBundlePath does this for us.
+ // Provide a nice cross platform solution for locating the configuration
+ // files. On windows files are searched for in the current working
+ // directory, on OS X however you must provide the full path, the helper
+ // function macBundlePath does this for us.
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
mResourcePath = macBundlePath() + "/Contents/Resources/";
@@ -71,5 +100,6 @@
-/// Method which will define the source of resources (other than current folder)
+// Method which will define the source of resources
+// (other than current folder)
void OgreControl::setupResources(void)
{
@@ -115,5 +145,6 @@
// user clicked OK so initialise
- // Here we choose to let the system create a default rendering window by passing 'true'
+ // Here we choose to let the system create a default
+ // rendering window by passing 'true'
mWindow = mRoot->initialise(true);
mRoot->saveConfig();
Index: /code/branches/main_reto/src/Orxonox.cpp
===================================================================
--- /code/branches/main_reto/src/Orxonox.cpp (revision 140)
+++ /code/branches/main_reto/src/Orxonox.cpp (revision 141)
@@ -1,2 +1,30 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
#include "Orxonox.h"
@@ -18,5 +46,6 @@
mOgre->getRoot()->renderOneFrame();
- if (!mRunMgr->tick(mTimer->getMilliseconds(), (mTimer->getMilliseconds() - lastTime) / 1000.0))
+ if (!mRunMgr->tick(mTimer->getMilliseconds(),
+ (mTimer->getMilliseconds() - lastTime) / 1000.0))
break;
lastTime = mTimer->getMilliseconds();
@@ -26,4 +55,5 @@
destroy();
}
+
bool Orxonox::setup(void)
Index: /code/branches/main_reto/src/OrxonoxScene.cpp
===================================================================
--- /code/branches/main_reto/src/OrxonoxScene.cpp (revision 140)
+++ /code/branches/main_reto/src/OrxonoxScene.cpp (revision 141)
@@ -1,2 +1,29 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "OrxonoxScene.h"
@@ -26,6 +53,7 @@
-/// method where you can perform resource group loading
-/// Must at least do ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+// method where you can perform resource group loading
+// Must at least do
+// ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
void OrxonoxScene::loadResources(void)
{
@@ -44,11 +72,11 @@
//create a scene node to attach the head to
- SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode",
- Vector3(0,0,0));
+ SceneNode *node = mSceneMgr->getRootSceneNode()
+ ->createChildSceneNode("OgreHeadNode", Vector3(0,0,0));
//attach the ogre head
node->attachObject(head);
// set up skybox
- mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox");
+ mSceneMgr->setSkyBox(true, "Examples/SceneSkyBox2");
// set up one mLight source
@@ -64,6 +92,6 @@
bbs->setMaterialName("Examples/Flare");
- lightNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("LightNode",
- Vector3(0, 100, 0));
+ lightNode = mSceneMgr->getRootSceneNode()
+ ->createChildSceneNode("LightNode", Vector3(0, 100, 0));
lightNode->attachObject(bbs);
@@ -82,4 +110,5 @@
mLight->setSpecularColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
- bbs->getBillboard(0)->setColour(ColourValue(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2)));
+ bbs->getBillboard(0)->setColour(ColourValue(sin(1*t),
+ sin(1*t + 2.09), sin(1*t + 2.09*2)));
}
Index: /code/branches/main_reto/src/OrxonoxShip.cpp
===================================================================
--- /code/branches/main_reto/src/OrxonoxShip.cpp (revision 140)
+++ /code/branches/main_reto/src/OrxonoxShip.cpp (revision 141)
@@ -1,7 +1,35 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "OrxonoxShip.h"
OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode)
- : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)), baseThrust(1000), thrust(0), sideThrust(0), n(0),
+ : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)),
+ baseThrust(1000), thrust(0), sideThrust(0), n(0),
bulletSpeed(400)
{
@@ -16,6 +44,7 @@
bool OrxonoxShip::initialise()
{
- // load all the resources needed (no resource groups yet, so the allInit is not executed!)
- //ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+ // load all the resources needed (no resource groups yet,
+ // so the allInit is not executed!)
+ // ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// create the "space ship" (currently a fish..)
@@ -64,18 +93,22 @@
{
// TODO: Names must be unique!
- SceneNode *temp = mRootNode->getParentSceneNode()->createChildSceneNode("BulletNode" + StringConverter::toString(n));
+ SceneNode *temp = mRootNode->getParentSceneNode()->createChildSceneNode(
+ "BulletNode" + StringConverter::toString(n));
temp->setOrientation(mRootNode->getOrientation());
temp->setPosition(mRootNode->getPosition());
temp->setScale(Vector3(1, 1, 1) * 10);
temp->yaw(Degree(-90));
- return new Bullet(temp,
- mSceneMgr->createEntity("bullet" + StringConverter::toString(n++), "Barrel.mesh"),
- speed + (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy() * bulletSpeed);
+ return new Bullet(temp, mSceneMgr->createEntity("bullet"
+ + StringConverter::toString(n++), "Barrel.mesh"), speed
+ + (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy()
+ * bulletSpeed);
}
-bool OrxonoxShip::tick(unsigned long time, float deltaTime)
+bool OrxonoxShip::tick(unsigned long time, Real deltaTime)
{
- speed += (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy() * thrust * deltaTime;
- speed += (mRootNode->getLocalAxes() * Vector3(-1, 0, 0)).normalisedCopy() * sideThrust * deltaTime;
+ Quaternion quad = mRootNode->getOrientation();
+ quad.normalise();
+ speed += quad * Vector3(0, 0, -1) * thrust * deltaTime;
+ speed += quad * Vector3(-1, 0, 0) * sideThrust * deltaTime;
mRootNode->translate(speed * deltaTime);
Index: /code/branches/main_reto/src/RunManager.cpp
===================================================================
--- /code/branches/main_reto/src/RunManager.cpp (revision 140)
+++ /code/branches/main_reto/src/RunManager.cpp (revision 141)
@@ -1,378 +1,541 @@
+/*
+* ORXONOX - the hottest 3D action shooter ever to exist
+*
+*
+* License notice:
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+*
+* Author:
+* Reto Grieder
+* Co-authors:
+* ...
+*/
+
+/**
+* RunManager is the basic control object during the game.
+*
+* The RunManger class is designed to actually "run" the main part of the
+* game. The Idea is, that you could derive from the RunManager in order
+* to distinguish between a first person shooter or a space craft shooter.
+* RunManager loads and initialises everything in the scene (like the ship,
+* the enemies in the scene, any scripts, the physics, window events,
+* environment, HUD, etc.).
+* It also captures any input from keyboard, mous, joystick (optional) or
+* Ogre (window events).
+*/
+
#include "RunManager.h"
-// Constructor takes a RenderWindow because it uses that to determine input context
-RunManager::RunManager(OgreControl * mOgre, bool bufferedKeys, bool bufferedMouse,
- bool bufferedJoy ) :
-mOgre(mOgre), mWindow(mOgre->getRenderWindow()), leftButtonDown(false),
-mStatsOn(true), mNumScreenShots(0),
-mTimeUntilNextToggle(0), mFiltering(TFO_BILINEAR),
-mAniso(1), mSceneDetailIndex(0), mDebugOverlay(0),
-mInputManager(0), mMouse(0), mKeyboard(0), mJoy(0)
-{
- // create new SceneManger
- mSceneMgr = mOgre->getRoot()->createSceneManager(ST_GENERIC,"mScene");
-
-
- // create various objects
- // background scene
- mScene = new OrxonoxScene(mSceneMgr);
-
- // create a steerable SceneNode for the spaceship to be attached to
- mShipNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("ShipNode", Vector3(20, 20, 20));
-
- // spaceship
- mShip = new OrxonoxShip(mSceneMgr, mShipNode);
-
- // load all resources and create the entities
- mScene->initialise();
- mShip->initialise();
-
- // create camera and viewport
- createCamera();
- createViewports();
-
- // Set default mipmap level (NB some APIs ignore this)
- TextureManager::getSingleton().setDefaultNumMipmaps(5);
-
- // initialise bullets list
- mBullets = new Bullet*[10];
- mBulletsPosition = 0;
- mBulletsSize = 10;
-
- using namespace OIS;
-
- mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");
-
- LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
- ParamList pl;
- size_t windowHnd = 0;
- std::ostringstream windowHndStr;
-
- mWindow->getCustomAttribute("WINDOW", &windowHnd);
- windowHndStr << windowHnd;
- pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
-
- mInputManager = InputManager::createInputSystem( pl );
-
- //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
- mKeyboard = static_cast(mInputManager->createInputObject( OISKeyboard, bufferedKeys ));
- mMouse = static_cast(mInputManager->createInputObject( OISMouse, bufferedMouse ));
- try {
- mJoy = static_cast(mInputManager->createInputObject( OISJoyStick, bufferedJoy ));
- }
- catch(...) {
- mJoy = 0;
- }
-
- //Set initial mouse clipping size
- windowResized(mWindow);
-
- showDebugOverlay(true);
-
- //Register as a Window listener
- WindowEventUtilities::addWindowEventListener(mWindow, this);
-}
-
-
+/**
+* Contructor only needs the render window and the Root object which are both
+* the OgreControl object.
+* Right now the constructor does all the initialisation work. This could also
+* be done in a new method "initialize()", for whatever purpose.
+*
+*
+* @param mOgre The OgreControl object holding the render window and the Root
+*/
+RunManager::RunManager(OgreControl * mOgre, bool bufferedKeys,
+ bool bufferedMouse, bool bufferedJoy )
+ : mOgre(mOgre), mWindow(mOgre->getRenderWindow()), leftButtonDown(false),
+ mStatsOn(true), mNumScreenShots(0), mTimeUntilNextToggle(0),
+ mFiltering(TFO_BILINEAR), mAniso(1), mSceneDetailIndex(0),
+ mDebugOverlay(0), mInputManager(0), mMouse(0), mKeyboard(0), mJoy(0)
+{
+
+ // SETTING UP THE SCENE
+
+ // create one new SceneManger
+ mSceneMgr = mOgre->getRoot()->createSceneManager(ST_GENERIC, "mScene");
+
+ // background scene (world objects, skybox, lights, etc.)
+ mScene = new OrxonoxScene(mSceneMgr);
+
+ // PLAYER SPACESHIP
+
+ // create a steerable SceneNode (not derived!) object. The idea is that this
+ // object only receives the mouse and the keyboard input (not specifi keys,
+ // more like up, down, left, right, roll left, roll right, move down,
+ // move up). The steering class can then decide how to control the node for
+ // the spaceship. This gives a certain flexibility.
+ // It should also be considered, that this class should provide another Node
+ // for a camera to be attached (otherwise the spaceship in front of the
+ // would be very static, never moving at all.
+ mShipNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("ShipNode",
+ Vector3(20, 20, 20));
+
+ // Construct a new spaceship and attach it to the node
+ mShip = new OrxonoxShip(mSceneMgr, mShipNode);
+
+
+ // RESOURCE LOADING (using ResourceGroups if implemented)
+
+ // load all resources and create the entities by calling the initialise()
+ // methods for each object (don't initialise in the constructor!).
+ mScene->initialise();
+ mShip->initialise();
+
+
+ // CAMERA AND VIEWPORT
+ // TODO: create a camera manager. It should be able to change its position
+ // around the space ship (predefined states would be nice too). And it should
+ // also be able to switch between different locations (like ship, spactator,
+ // certain fixed positions (e.g. finish line, etc.)). These are just ideas.
+
+ // create camera and viewport
+ createCamera();
+ createViewports();
+
+
+ // Set default mipmap level (NB some APIs ignore this)
+ TextureManager::getSingleton().setDefaultNumMipmaps(5);
+
+
+ // BULLET LIST FOR THE TEST APPLICATION
+
+ // TODO: Use STL to make life easier. But it works this way too..
+ mBullets = new Bullet*[10];
+ mBulletsPosition = 0;
+ mBulletsSize = 10;
+
+
+ // HUMAN INTERFACE
+
+ using namespace OIS;
+
+ mDebugOverlay = OverlayManager::getSingleton()
+ .getByName("Core/DebugOverlay");
+
+ LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
+ ParamList pl;
+ size_t windowHnd = 0;
+ std::ostringstream windowHndStr;
+
+ mWindow->getCustomAttribute("WINDOW", &windowHnd);
+ windowHndStr << windowHnd;
+ pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+
+ mInputManager = InputManager::createInputSystem( pl );
+
+ // Create all devices (We only catch joystick exceptions here,
+ // as, most people have Key/Mouse)
+ mKeyboard = static_cast(mInputManager
+ ->createInputObject( OISKeyboard, bufferedKeys ));
+ mMouse = static_cast(mInputManager
+ ->createInputObject( OISMouse, bufferedMouse ));
+ try {
+ mJoy = static_cast(mInputManager
+ ->createInputObject( OISJoyStick, bufferedJoy ));
+ }
+ catch(...) {
+ mJoy = 0;
+ }
+
+ //Set initial mouse clipping size
+ windowResized(mWindow);
+
+ showDebugOverlay(true);
+
+ // REGISTER THIS OBJECT AS A WINDOW EVENT LISTENER IN OGRE
+ // It will then receive events liek windowClosed, windowResized, etc.
+ WindowEventUtilities::addWindowEventListener(mWindow, this);
+}
+
+/**
+* Standard destructor.
+* Removes this object as a window event listener and deletes all created
+* variables.
+*/
RunManager::~RunManager()
{
- //Remove ourself as a Window listener
- WindowEventUtilities::removeWindowEventListener(mWindow, this);
- windowClosed(mWindow);
-
- if (mScene)
- delete mScene;
-
- for (int i = 0; i < mBulletsPosition; i++)
- delete mBullets[i];
- delete mBullets;
-}
-
-
-// Override frameStarted event to process that (don't care about frameEnded)
+ //Remove ourself as a Window listener
+ WindowEventUtilities::removeWindowEventListener(mWindow, this);
+ windowClosed(mWindow);
+
+ if (mScene)
+ delete mScene;
+ if (mShip)
+ delete mShip;
+
+ // clean up the bullet list
+ for (int i = 0; i < mBulletsPosition; i++)
+ delete mBullets[i];
+ delete mBullets;
+}
+
+
+/**
+* Method to compute anyting between 2 frames.
+*
+* Everything that needs to be computed during the games happens right here.
+* The only exception are the listeners (which should only set variables,
+* not actually do something).
+*
+* @param time Absolute play time
+* @param deltaTime Time passed since last frame
+* @return Return false to end rendering
+*/
bool RunManager::tick(unsigned long time, float deltaTime)
{
- mTime = time;
-
- updateStats();
-
- mScene->tick(time, deltaTime);
- mShip->tick(time, deltaTime);
-
- // update the bullet positions
- for (int i = 0; i < mBulletsPosition; i++)
- {
- mBullets[i]->mNode->translate(mBullets[i]->mSpeed*deltaTime);
- mBullets[i]->mNode->yaw(Degree(deltaTime*100));
- mBullets[i]->mNode->roll(Degree(deltaTime*300));
- }
-
- using namespace OIS;
-
- if(mWindow->isClosed()) return false;
-
- //Need to capture/update each device
- mKeyboard->capture();
- mMouse->capture();
- if( mJoy ) mJoy->capture();
-
- bool buffJ = (mJoy) ? mJoy->buffered() : true;
-
- //Check if one of the devices is not buffered
- if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
- {
- // one of the input modes is immediate, so setup what is needed for immediate movement
- if (mTimeUntilNextToggle >= 0)
- mTimeUntilNextToggle -= deltaTime;
- }
-
- //Check to see which device is not buffered, and handle it
- if( !mKeyboard->buffered() )
- if( processUnbufferedKeyInput() == false )
- return false;
- if( !mMouse->buffered() )
- if( processUnbufferedMouseInput() == false )
- return false;
-
- return true;
-}
-
-
-//Adjust mouse clipping area
+ // synchronize with internal class timer
+ mTime = time;
+
+ // Call tick() for every object
+ // This could be done by registering (needs a factory..)
+ mScene->tick(time, deltaTime);
+ mShip->tick(time, deltaTime);
+
+
+ // Update the 'HUD'
+ updateStats();
+
+ // update the bullet positions
+ for (int i = 0; i < mBulletsPosition; i++)
+ {
+ mBullets[i]->mNode->translate(mBullets[i]->mSpeed*deltaTime);
+ mBullets[i]->mNode->yaw(Degree(deltaTime*100));
+ mBullets[i]->mNode->roll(Degree(deltaTime*300));
+ }
+
+ // HUMAN INTERFACE
+
+ using namespace OIS;
+
+ if(mWindow->isClosed()) return false;
+
+ //Need to capture/update each device
+ mKeyboard->capture();
+ mMouse->capture();
+ if( mJoy ) mJoy->capture();
+
+ bool buffJ = (mJoy) ? mJoy->buffered() : true;
+
+ //Check if one of the devices is not buffered
+ if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
+ {
+ // one of the input modes is immediate, so setup what
+ // is needed for immediate movement
+ if (mTimeUntilNextToggle >= 0)
+ mTimeUntilNextToggle -= deltaTime;
+ }
+
+ //Check to see which device is not buffered, and handle it
+ if( !mKeyboard->buffered() )
+ if( processUnbufferedKeyInput() == false )
+ return false;
+ if( !mMouse->buffered() )
+ if( processUnbufferedMouseInput() == false )
+ return false;
+
+ // keep rendering
+ return true;
+}
+
+
+/**
+* Adjust mouse clipping area.
+* This method is called by Ogre without regards of tick()!
+* Avoid doing too much in this call.
+* @param rw render window
+*/
void RunManager::windowResized(RenderWindow* rw)
{
- unsigned int width, height, depth;
- int left, top;
- rw->getMetrics(width, height, depth, left, top);
-
- const OIS::MouseState &ms = mMouse->getMouseState();
- ms.width = width;
- ms.height = height;
-}
-
-
-//Unattach OIS before window shutdown (very important under Linux)
+ unsigned int width, height, depth;
+ int left, top;
+ rw->getMetrics(width, height, depth, left, top);
+
+ const OIS::MouseState &ms = mMouse->getMouseState();
+ ms.width = width;
+ ms.height = height;
+}
+
+
+/**
+* Unattach OIS before window shutdown (very important under Linux).
+* Again, avoid computing a lot in this function.
+* @param rw Render Window
+*/
void RunManager::windowClosed(RenderWindow* rw)
{
- //Only close for window that created OIS (the main window in these demos)
- if( rw == mWindow )
- {
- if( mInputManager )
- {
- mInputManager->destroyInputObject( mMouse );
- mInputManager->destroyInputObject( mKeyboard );
- mInputManager->destroyInputObject( mJoy );
-
- OIS::InputManager::destroyInputSystem(mInputManager);
- mInputManager = 0;
- }
- }
-}
-
-
+ //Only close for window that created OIS (the main window in these demos)
+ if( rw == mWindow )
+ {
+ if( mInputManager )
+ {
+ mInputManager->destroyInputObject( mMouse );
+ mInputManager->destroyInputObject( mKeyboard );
+ mInputManager->destroyInputObject( mJoy );
+
+ OIS::InputManager::destroyInputSystem(mInputManager);
+ mInputManager = 0;
+ }
+ }
+}
+
+/**
+* Processes the Keyboard input.
+* TODO: Use listeners to improve performance.
+* A lookup table should be implemented to bind any key to a specific action.
+* @return Return true to keep rendering
+*/
bool RunManager::processUnbufferedKeyInput()
{
- using namespace OIS;
-
- if(mKeyboard->isKeyDown(KC_A) || mKeyboard->isKeyDown(KC_LEFT))
- mShip->setSideThrust(1);
- else if(mKeyboard->isKeyDown(KC_D) || mKeyboard->isKeyDown(KC_RIGHT))
- mShip->setSideThrust(-1);
- else
- mShip->setSideThrust(0);
-
- if(mKeyboard->isKeyDown(KC_UP) || mKeyboard->isKeyDown(KC_W) )
- mShip->setThrust(1);
- else if(mKeyboard->isKeyDown(KC_DOWN) || mKeyboard->isKeyDown(KC_S) )
- mShip->setThrust(-1);
- else
- mShip->setThrust(0);
-
- if( mKeyboard->isKeyDown(KC_ESCAPE) || mKeyboard->isKeyDown(KC_Q) )
- return false;
-
- if( mKeyboard->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0 )
- {
- mStatsOn = !mStatsOn;
- showDebugOverlay(mStatsOn);
- mTimeUntilNextToggle = 1;
- }
-
- if( mKeyboard->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0 )
- {
- switch(mFiltering)
- {
- case TFO_BILINEAR:
- mFiltering = TFO_TRILINEAR;
- mAniso = 1;
- break;
- case TFO_TRILINEAR:
- mFiltering = TFO_ANISOTROPIC;
- mAniso = 8;
- break;
- case TFO_ANISOTROPIC:
- mFiltering = TFO_BILINEAR;
- mAniso = 1;
- break;
- default: break;
- }
- MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
- MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
-
- showDebugOverlay(mStatsOn);
- mTimeUntilNextToggle = 1;
- }
-
- if(mKeyboard->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
- {
- std::ostringstream ss;
- ss << "screenshot_" << ++mNumScreenShots << ".png";
- mWindow->writeContentsToFile(ss.str());
- mTimeUntilNextToggle = 0.5;
- mDebugText = "Saved: " + ss.str();
- }
-
- if(mKeyboard->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
- {
- mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
- switch(mSceneDetailIndex) {
- case 0 : mCamera->setPolygonMode(PM_SOLID); break;
- case 1 : mCamera->setPolygonMode(PM_WIREFRAME); break;
- case 2 : mCamera->setPolygonMode(PM_POINTS); break;
- }
- mTimeUntilNextToggle = 0.5;
- }
-
- static bool displayCameraDetails = false;
- if(mKeyboard->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
- {
- displayCameraDetails = !displayCameraDetails;
- mTimeUntilNextToggle = 0.5;
- if (!displayCameraDetails)
- mDebugText = "";
- }
-
- // Print camera details
- if(displayCameraDetails)
- mDebugText = StringConverter::toString(mShip->getThrust())
- + " | Speed = " + StringConverter::toString(mShip->speed);
- // mDebugText = "P: " + StringConverter::toString(mCamera->getDerivedPosition()) +
- // " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation());
-
- // Return true to continue rendering
- return true;
-}
-
-
+ using namespace OIS;
+
+ if(mKeyboard->isKeyDown(KC_A) || mKeyboard->isKeyDown(KC_LEFT))
+ mShip->setSideThrust(1);
+ else if(mKeyboard->isKeyDown(KC_D) || mKeyboard->isKeyDown(KC_RIGHT))
+ mShip->setSideThrust(-1);
+ else
+ mShip->setSideThrust(0);
+
+ if(mKeyboard->isKeyDown(KC_UP) || mKeyboard->isKeyDown(KC_W) )
+ mShip->setThrust(1);
+ else if(mKeyboard->isKeyDown(KC_DOWN) || mKeyboard->isKeyDown(KC_S) )
+ mShip->setThrust(-1);
+ else
+ mShip->setThrust(0);
+
+ if( mKeyboard->isKeyDown(KC_ESCAPE) || mKeyboard->isKeyDown(KC_Q) )
+ return false;
+
+ if( mKeyboard->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0 )
+ {
+ mStatsOn = !mStatsOn;
+ showDebugOverlay(mStatsOn);
+ mTimeUntilNextToggle = 1;
+ }
+
+ if( mKeyboard->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0 )
+ {
+ switch(mFiltering)
+ {
+ case TFO_BILINEAR:
+ mFiltering = TFO_TRILINEAR;
+ mAniso = 1;
+ break;
+ case TFO_TRILINEAR:
+ mFiltering = TFO_ANISOTROPIC;
+ mAniso = 8;
+ break;
+ case TFO_ANISOTROPIC:
+ mFiltering = TFO_BILINEAR;
+ mAniso = 1;
+ break;
+ default: break;
+ }
+ MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
+ MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
+
+ showDebugOverlay(mStatsOn);
+ mTimeUntilNextToggle = 1;
+ }
+
+ if(mKeyboard->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
+ {
+ std::ostringstream ss;
+ ss << "screenshot_" << ++mNumScreenShots << ".png";
+ mWindow->writeContentsToFile(ss.str());
+ mTimeUntilNextToggle = 0.5;
+ mDebugText = "Saved: " + ss.str();
+ }
+
+ if(mKeyboard->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
+ {
+ mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
+ switch(mSceneDetailIndex) {
+ case 0 : mCamera->setPolygonMode(PM_SOLID); break;
+ case 1 : mCamera->setPolygonMode(PM_WIREFRAME); break;
+ case 2 : mCamera->setPolygonMode(PM_POINTS); break;
+ }
+ mTimeUntilNextToggle = 0.5;
+ }
+
+ static bool displayCameraDetails = false;
+ if(mKeyboard->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
+ {
+ displayCameraDetails = !displayCameraDetails;
+ mTimeUntilNextToggle = 0.5;
+ if (!displayCameraDetails)
+ mDebugText = "";
+ }
+
+ // Print camera details
+ if(displayCameraDetails)
+ mDebugText = StringConverter::toString(mShip->getThrust())
+ + " | Speed = " + StringConverter::toString(mShip->speed);
+ // mDebugText = "P: " + StringConverter::toString(mCamera
+ // ->getDerivedPosition()) + " " + "O: "
+ // + StringConverter::toString(mCamera->getDerivedOrientation());
+
+ // Return true to continue rendering
+ return true;
+}
+
+
+/**
+* Processes the Mouse input.
+* TODO: Use listeners to improve performance.
+* A lookup table should be implemented to bind ANY button or movement
+* to a specific action.
+* @return Return true to keep rendering
+*/
bool RunManager::processUnbufferedMouseInput()
{
- using namespace OIS;
-
- // Rotation factors, may not be used if the second mouse button is pressed
- // 2nd mouse button - slide, otherwise rotate
- const MouseState &ms = mMouse->getMouseState();
-
- if (ms.buttonDown(MB_Left) && !leftButtonDown)
- {
- leftButtonDown = true;
- // fire
- Bullet *mTempBullet = mShip->fire();
- if (mBulletsPosition >= mBulletsSize)
- {
- // redimension the array
- Bullet **mTempArray = new Bullet*[2*mBulletsSize];
- for (int i = 0; i < mBulletsSize; i++)
- mTempArray[i] = mBullets[i];
- mBulletsSize *= 2;
- delete mBullets;
- mBullets = mTempArray;
- }
- mBullets[mBulletsPosition++] = mTempBullet;
-
- }
- else if (!ms.buttons)
- leftButtonDown = false;
-
- mShip->setYaw(Degree(-ms.X.rel * 0.13));
- mShip->setPitch(Degree(-ms.Y.rel * 0.13));
-
- return true;
-}
-
-
+ using namespace OIS;
+
+ const MouseState &ms = mMouse->getMouseState();
+
+ // This is a 'hack' to show some flying barrels..
+ // Usually, the Bullet created by the ship should be managed
+ // by the physics engine..
+ if (ms.buttonDown(MB_Left) && !leftButtonDown)
+ {
+ // Prevent continuous fire for the moment.
+ leftButtonDown = true;
+
+ // let ship fire one shot with its only weapon (Barrels..)
+ Bullet *mTempBullet = mShip->fire();
+
+ // resize array if neccessary (double the size then)
+ if (mBulletsPosition >= mBulletsSize)
+ {
+ // redimension the array
+ Bullet **mTempArray = new Bullet*[2*mBulletsSize];
+ for (int i = 0; i < mBulletsSize; i++)
+ mTempArray[i] = mBullets[i];
+ mBulletsSize *= 2;
+ delete mBullets;
+ mBullets = mTempArray;
+ }
+
+ // add the bullet to the list
+ mBullets[mBulletsPosition++] = mTempBullet;
+
+ }
+ else if (!ms.buttons)
+ leftButtonDown = false;
+
+ // space ship steering. This should definitely be done in the steering object
+ // Simply give it the mouse movements.
+ mShip->mRootNode->pitch(Degree(-ms.Y.rel * 0.13), Ogre::Node::TransformSpace::TS_LOCAL);
+ mShip->mRootNode->yaw(Degree(-ms.X.rel * 0.13), Ogre::Node::TransformSpace::TS_PARENT);
+
+ // keep rendering
+ return true;
+}
+
+/**
+* Show the debug overlay of desired.
+* @param show Whether or not to show the debug overlay
+*/
void RunManager::showDebugOverlay(bool show)
{
- if (mDebugOverlay)
- {
- if (show)
- mDebugOverlay->show();
- else
- mDebugOverlay->hide();
- }
-}
-
-
-
+ if (mDebugOverlay)
+ {
+ if (show)
+ mDebugOverlay->show();
+ else
+ mDebugOverlay->hide();
+ }
+}
+
+
+/**
+* Show stats (e.g. FPS) in the left lower corner of the screen.
+* Copied from the ExampleFrameListener.h in the Ogre SDK
+*/
void RunManager::updateStats(void)
{
- static String currFps = "Current FPS: ";
- static String avgFps = "Average FPS: ";
- static String bestFps = "Best FPS: ";
- static String worstFps = "Worst FPS: ";
- static String tris = "Triangle Count: ";
- static String batches = "Batch Count: ";
-
- // update stats when necessary
- try {
- OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
- OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
- OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
- OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");
- //OverlayElement* asfd = OverlayManager::getSingleton().getOverlayElement(
-
- const RenderTarget::FrameStats& stats = mWindow->getStatistics();
- guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
- guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
- guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
- +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
- guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
- +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
-
- OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
- guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
-
- OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Core/NumBatches");
- guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount));
-
- OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
- guiDbg->setCaption(mDebugText);
- }
- catch(...) { /* ignore */ }
-}
-
-
-
-// create camera
+ static String currFps = "Current FPS: ";
+ static String avgFps = "Average FPS: ";
+ static String bestFps = "Best FPS: ";
+ static String worstFps = "Worst FPS: ";
+ static String tris = "Triangle Count: ";
+ static String batches = "Batch Count: ";
+
+ // update stats when necessary
+ try {
+ OverlayElement* guiAvg = OverlayManager::getSingleton()
+ .getOverlayElement("Core/AverageFps");
+ OverlayElement* guiCurr = OverlayManager::getSingleton()
+ .getOverlayElement("Core/CurrFps");
+ OverlayElement* guiBest = OverlayManager::getSingleton()
+ .getOverlayElement("Core/BestFps");
+ OverlayElement* guiWorst = OverlayManager::getSingleton()
+ .getOverlayElement("Core/WorstFps");
+
+ const RenderTarget::FrameStats& stats = mWindow->getStatistics();
+ guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
+ guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
+ guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
+ +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
+ guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
+ +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
+
+ OverlayElement* guiTris = OverlayManager::getSingleton()
+ .getOverlayElement("Core/NumTris");
+ guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
+
+ OverlayElement* guiBatches = OverlayManager::getSingleton()
+ .getOverlayElement("Core/NumBatches");
+ guiBatches->setCaption(batches
+ + StringConverter::toString(stats.batchCount));
+
+ OverlayElement* guiDbg = OverlayManager::getSingleton()
+ .getOverlayElement("Core/DebugText");
+ guiDbg->setCaption(mDebugText);
+ }
+ catch(...) { /* ignore */ }
+}
+
+
+
+/**
+* Simple camera creator.
+* mShipNode->attachObject(mCamera) should no be here! This is what the camera
+* manager is for. Right now, this method should do just fine, setting the
+* cam behind the ship.
+*/
void RunManager::createCamera(void)
{
- mCamera = mSceneMgr->createCamera("PlayerCam");
- mShipNode->attachObject(mCamera);
- mCamera->setNearClipDistance(5);
- mCamera->setPosition(Vector3(0,10,500));
- mCamera->lookAt(Vector3(0,0,0));
-}
-
-
+ mCamera = mSceneMgr->createCamera("PlayerCam");
+ mShipNode->attachObject(mCamera);
+ mCamera->setNearClipDistance(5);
+ mCamera->setPosition(Vector3(0,10,500));
+ mCamera->lookAt(Vector3(0,0,0));
+}
+
+/**
+* Simple viewport creator.
+* TODO: fully understand the concept of viewports concerning orxnox.
+* E.g. do we need splitscreen mode?
+* For now the viewport uses the entire render window and is based on the one
+* camera created so far.
+*/
void RunManager::createViewports(void)
{
- // Create one viewport, entire window
- Viewport* vp = mWindow->addViewport(mCamera);
- vp->setBackgroundColour(ColourValue(0,0,0));
-
- // Alter the camera aspect ratio to match the viewport
- mCamera->setAspectRatio(
- Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
-}
-
-
+ // Create one viewport, entire window
+ Viewport* vp = mWindow->addViewport(mCamera);
+ vp->setBackgroundColour(ColourValue(0,0,0));
+
+ // Alter the camera aspect ratio to match the viewport
+ mCamera->setAspectRatio(
+ Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
+}
+
+
Index: de/branches/main_reto/src/SteerableNode.cpp
===================================================================
--- /code/branches/main_reto/src/SteerableNode.cpp (revision 140)
+++ (revision )
@@ -1,24 +1,0 @@
-#include "SteerableNode.h"
-
-
-SteerableNode::SteerableNode(SceneManager *creator, const Ogre::String &name) : SceneNode(creator, name)
-{
-
-}
-
-
-SteerableNode::SteerableNode(SceneManager *creator) : SceneNode(creator)
-{
-
-}
-
-
-SteerableNode::~SteerableNode()
-{
-}
-
-
-bool SteerableNode::initialise()
-{
- return true;
-}
Index: /code/branches/main_reto/src/WeaponManager.cpp
===================================================================
--- /code/branches/main_reto/src/WeaponManager.cpp (revision 140)
+++ /code/branches/main_reto/src/WeaponManager.cpp (revision 141)
@@ -1,2 +1,29 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "WeaponManager.h"
Index: /code/branches/main_reto/src/main.cpp
===================================================================
--- /code/branches/main_reto/src/main.cpp (revision 140)
+++ /code/branches/main_reto/src/main.cpp (revision 141)
@@ -1,2 +1,31 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+
#include "Orxonox.h"
@@ -8,27 +37,28 @@
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
- INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+ INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
#else
- int main(int argc, char **argv)
+ int main(int argc, char **argv)
#endif
- {
- try {
- Orxonox myApp;
+ {
+ try {
+ // create an orxonox aplication and run it
+ Orxonox myApp;
- // ExampleApplication provides a go method, which starts the rendering.
- myApp.go();
- }
- catch (Ogre::Exception& e) {
+ myApp.go();
+ }
+ catch (Ogre::Exception& e) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
- MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+ MessageBoxA(NULL, e.getFullDescription().c_str(),
+ "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
- std::cerr << "Exception:\n";
- std::cerr << e.getFullDescription().c_str() << "\n";
+ std::cerr << "Exception:\n";
+ std::cerr << e.getFullDescription().c_str() << "\n";
#endif
- return 1;
- }
+ return 1;
+ }
- return 0;
- }
+ return 0;
+ }
#ifdef __cplusplus