Index: code/branches/main_reto_vs05/src/CMakeLists.txt
===================================================================
--- code/branches/main_reto_vs05/src/CMakeLists.txt	(revision 156)
+++ 	(revision )
@@ -1,11 +1,0 @@
-PROJECT(Orxonox)
-
-# create a few variables to simplify life
-SET(SRC_FILES orxonox.cc)
-#SET(INC_FILES ExampleApplication.h  ExampleFrameListener.h)
-
-#Creates an executable
-ADD_EXECUTABLE(../bin/main ${SRC_FILES} ${INC_FILES})
-#Links the executable against OGRE and OIS
-TARGET_LINK_LIBRARIES(../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${CEGUI_LIBRARIES} ${CEGUI_OGRE_LIBRARIES})
-
Index: code/branches/main_reto_vs05/src/bullet.cc
===================================================================
--- code/branches/main_reto_vs05/src/bullet.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/bullet.cc	(revision 157)
@@ -0,0 +1,40 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "bullet.h"
+
+
+Bullet::Bullet(SceneNode *mNode, Entity *mEntity, Vector3 mSpeed)
+      : mNode(mNode), mEntity(mEntity), mSpeed(mSpeed)
+{
+	mNode->attachObject(mEntity);
+}
+
+
+Bullet::~Bullet()
+{
+}
Index: code/branches/main_reto_vs05/src/camera_manager.cc
===================================================================
--- code/branches/main_reto_vs05/src/camera_manager.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/camera_manager.cc	(revision 157)
@@ -0,0 +1,44 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "camera_manager.h"
+
+
+CameraManager::CameraManager(SceneManager *mScene) : mSceneMgr(mSceneMgr)
+{
+}
+
+
+CameraManager::~CameraManager()
+{
+}
+
+
+bool CameraManager::setCameraPosition(int n)
+{
+	return true;
+}
Index: code/branches/main_reto_vs05/src/main.cc
===================================================================
--- code/branches/main_reto_vs05/src/main.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/main.cc	(revision 157)
@@ -0,0 +1,66 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+
+#include "orxonox.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
+#define WIN32_LEAN_AND_MEAN 
+#include "windows.h" 
+  INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else 
+  int main(int argc, char **argv) 
+#endif 
+  {
+    try {
+      // create an orxonox aplication and run it
+      Orxonox myApp;
+
+      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);
+#else
+      std::cerr << "Exception:\n";
+      std::cerr << e.getFullDescription().c_str() << "\n";
+#endif
+      return 1;
+    }
+
+    return 0;
+  }
+
+#ifdef __cplusplus
+}
+#endif
Index: code/branches/main_reto_vs05/src/ogre_control.cc
===================================================================
--- code/branches/main_reto_vs05/src/ogre_control.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/ogre_control.cc	(revision 157)
@@ -0,0 +1,171 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ogre_control.h"
+
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+// This function will locate the path to our application on OS X,
+// unlike windows you can not rely on the curent working directory
+// for locating your configuration files and resources.
+std::string macBundlePath()
+{
+	char path[1024];
+	CFBundleRef mainBundle = CFBundleGetMainBundle();
+	assert(mainBundle);
+
+	CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
+	assert(mainBundleURL);
+
+	CFStringRef cfStringRef =
+        CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
+	assert(cfStringRef);
+
+	CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
+
+	CFRelease(mainBundleURL);
+	CFRelease(cfStringRef);
+
+	return std::string(path);
+}
+#endif
+
+
+OgreControl::OgreControl()
+{
+	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.
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+	mResourcePath = macBundlePath() + "/Contents/Resources/";
+#else
+	mResourcePath = "";
+#endif
+}
+
+
+// standard destructor
+OgreControl::~OgreControl()
+{
+	if (mRoot)
+		delete mRoot;
+}
+
+
+/**------------- SETTING UP OGRE --------------**/
+
+bool OgreControl::initialise(void)
+{
+	String pluginsPath;
+	// only use plugins.cfg if not static
+#ifndef OGRE_STATIC_LIB
+	pluginsPath = mResourcePath + "plugins.cfg";
+#endif
+
+	mRoot = new Root(pluginsPath, 
+		mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");
+
+	setupResources();
+
+	if (!configure())
+		return false;
+
+	return true;
+}
+
+
+// Method which will define the source of resources
+// (other than current folder)
+void OgreControl::setupResources(void)
+{
+	// Load resource paths from config file
+	ConfigFile cf;
+	cf.load(mResourcePath + "resources.cfg");
+
+	// Go through all sections & settings in the file
+	ConfigFile::SectionIterator seci = cf.getSectionIterator();
+
+	String secName, typeName, archName;
+	while (seci.hasMoreElements())
+	{
+		secName = seci.peekNextKey();
+		ConfigFile::SettingsMultiMap *settings = seci.getNext();
+		ConfigFile::SettingsMultiMap::iterator i;
+		for (i = settings->begin(); i != settings->end(); ++i)
+		{
+			typeName = i->first;
+			archName = i->second;
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+			// OS X does not set the working directory relative to the app,
+			// In order to make things portable on OS X we need to provide
+			// the loading with it's own bundle path location
+			ResourceGroupManager::getSingleton().addResourceLocation(
+				String(macBundlePath() + "/" + archName), typeName, secName);
+#else
+			ResourceGroupManager::getSingleton().addResourceLocation(
+				archName, typeName, secName);
+#endif
+		}
+	}
+}
+
+
+bool OgreControl::configure(void)
+{
+	// Show the configuration dialog and initialise the system
+	// You can skip this and use root.restoreConfig() to load configuration
+	// settings if you were sure there are valid ones saved in ogre.cfg
+	if(!mRoot->restoreConfig() && !mRoot->showConfigDialog())
+		return false;
+
+	// user clicked OK so initialise
+	// Here we choose to let the system create a default
+  // rendering window by passing 'true'
+	mWindow = mRoot->initialise(true);
+	mRoot->saveConfig();
+	return true;
+}
+
+
+Root* OgreControl::getRoot(void)
+{
+	return mRoot;
+}
+
+
+RenderWindow* OgreControl::getRenderWindow(void)
+{
+	return mWindow;
+}
+
+
+Ogre::String OgreControl::getResourcePath(void)
+{
+	return mResourcePath;
+}
Index: code/branches/main_reto_vs05/src/orxonox.cc
===================================================================
--- code/branches/main_reto_vs05/src/orxonox.cc	(revision 156)
+++ code/branches/main_reto_vs05/src/orxonox.cc	(revision 157)
@@ -20,5 +20,5 @@
  *
  *   Author:
- *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *      Reto Grieder
  *   Co-authors:
  *      ...
@@ -26,237 +26,54 @@
  */
 
-/**
- @file  orxonox.cc
- @brief Orxonox Main File
- */
 
-#include <Ogre.h>
-#include <OIS/OIS.h>
-#include <CEGUI/CEGUI.h>
-#include <OgreCEGUIRenderer.h>
+#include "orxonox.h"
 
-// some tests to see if enet works without includsion
-//#include <enet/enet.h>
-//#include <enet/protocol.h>
 
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-#include <CoreFoundation/CoreFoundation.h>
+void Orxonox::go(void)
+{
+	if (!setup())
+		return;
 
-// This function will locate the path to our application on OS X,
-// unlike windows you can not rely on the curent working directory
-// for locating your configuration files and resources.
-std::string macBundlePath()
-{
-  char path[1024];
-  CFBundleRef mainBundle = CFBundleGetMainBundle();
-  assert(mainBundle);
+	mTimer = new Timer();
 
-  CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
-  assert(mainBundleURL);
+	unsigned long lastTime = mTimer->getMilliseconds();
 
-  CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
-  assert(cfStringRef);
+	while (true)
+	{
+		//Pump messages in all registered RenderWindow windows
+		WindowEventUtilities::messagePump();
 
-  CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
+		mOgre->getRoot()->renderOneFrame();
 
-  CFRelease(mainBundleURL);
-  CFRelease(cfStringRef);
+		if (!mRunMgr->tick(mTimer->getMilliseconds(),
+            (mTimer->getMilliseconds() - lastTime) / 1000.0))
+			break;
+		lastTime = mTimer->getMilliseconds();
+	}
 
-  return std::string(path);
-}
-#endif
-
-using namespace Ogre;
-
-class OrxExitListener : public FrameListener
-{
-  public:
-    OrxExitListener(OIS::Keyboard *keyboard)
-  : mKeyboard(keyboard)
-    {
-    }
-
-    bool frameStarted(const FrameEvent& evt)
-    {
-      mKeyboard->capture();
-      return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
-    }
-
-  private:
-    OIS::Keyboard *mKeyboard;
-};
-
-class OrxApplication
-{
-  public:
-    void go()
-    {
-      createRoot();
-      defineResources();
-      setupRenderSystem();
-      createRenderWindow();
-      initializeResourceGroups();
-      setupScene();
-      setupInputSystem();
-      setupCEGUI();
-      createFrameListener();
-      startRenderLoop();
-    }
-
-    ~OrxApplication()
-    {
-      mInputManager->destroyInputObject(mKeyboard);
-      OIS::InputManager::destroyInputSystem(mInputManager);
-
-//       delete mRenderer;
-//       delete mSystem;
-
-      delete mListener;
-      delete mRoot;
-    }
-
-  private:
-    Root *mRoot;
-    OIS::Keyboard *mKeyboard;
-    OIS::Mouse *mMouse;
-    OIS::InputManager *mInputManager;
-    CEGUI::OgreCEGUIRenderer *mRenderer;
-    CEGUI::System *mSystem;
-    OrxExitListener *mListener;
-
-    void createRoot()
-    {
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-      mRoot = new Root(macBundlePath() + "/Contents/Resources/plugins.cfg");
-#else
-      mRoot = new Root();
-#endif
-    }
-
-    void defineResources()
-    {
-      String secName, typeName, archName;
-      ConfigFile cf;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-      cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
-#else
-      cf.load("resources.cfg");
-#endif
-
-      ConfigFile::SectionIterator seci = cf.getSectionIterator();
-      while (seci.hasMoreElements())
-      {
-        secName = seci.peekNextKey();
-        ConfigFile::SettingsMultiMap *settings = seci.getNext();
-        ConfigFile::SettingsMultiMap::iterator i;
-        for (i = settings->begin(); i != settings->end(); ++i)
-        {
-          typeName = i->first;
-          archName = i->second;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-          ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName);
-#else
-          ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName);
-#endif
-        }
-      }
-    }
-
-    void setupRenderSystem()
-    {
-      if (!mRoot->restoreConfig() && !mRoot->showConfigDialog())
-        throw Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()");
-    }
-
-    void createRenderWindow()
-    {
-      mRoot->initialise(true, "Ogre Render Window");
-    }
-
-    void initializeResourceGroups()
-    {
-      TextureManager::getSingleton().setDefaultNumMipmaps(5);
-      ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-    }
-
-    void setupScene()
-    {
-      SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
-      Camera *cam = mgr->createCamera("Camera");
-      Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
-    }
-
-    void setupInputSystem()
-    {
-      size_t windowHnd = 0;
-      std::ostringstream windowHndStr;
-      OIS::ParamList pl;
-      RenderWindow *win = mRoot->getAutoCreatedWindow();
-
-      win->getCustomAttribute("WINDOW", &windowHnd);
-      windowHndStr << windowHnd;
-      pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
-      mInputManager = OIS::InputManager::createInputSystem(pl);
-
-      try
-      {
-        mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false));
-        mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, false));
-      }
-      catch (const OIS::Exception &e)
-      {
-        throw new Exception(42, e.eText, "OrxApplication::setupInputSystem");
-      }
-    }
-
-    void setupCEGUI()
-    {
-      SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
-      RenderWindow *win = mRoot->getAutoCreatedWindow();
-
-      // CEGUI setup
-//       mRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mgr);
-//       mSystem = new CEGUI::System(mRenderer);
-
-      // Other CEGUI setup here.
-    }
-
-    void createFrameListener()
-    {
-      mListener = new OrxExitListener(mKeyboard);
-      mRoot->addFrameListener(mListener);
-    }
-
-    void startRenderLoop()
-    {
-      mRoot->startRendering();
-    }
-};
-
-#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-#define WIN32_LEAN_AND_MEAN
-#include "windows.h"
-
-             INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
-#else
-             int main(int argc, char **argv)
-#endif
-{
-  try
-  {
-    OrxApplication orxonox;
-    orxonox.go();
-  }
-  catch(Exception& e)
-  {
-#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-    MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
-#else
-    fprintf(stderr, "An exception has occurred: %s\n",
-            e.getFullDescription().c_str());
-#endif
-  }
-
-  return 0;
+	// clean up
+	destroy();
 }
 
+
+bool Orxonox::setup(void)
+{
+	// create new 3D ogre render engine
+	mOgre = new OgreControl();
+	mOgre->initialise();
+
+	mRunMgr = new RunManager(mOgre);
+
+	return true;
+}
+
+
+void Orxonox::destroy()
+{
+	if (mTimer)
+		delete mTimer;
+	if (mRunMgr)
+		delete mRunMgr;
+	if (mOgre)
+		delete mOgre;
+}
Index: code/branches/main_reto_vs05/src/orxonox_scene.cc
===================================================================
--- code/branches/main_reto_vs05/src/orxonox_scene.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/orxonox_scene.cc	(revision 157)
@@ -0,0 +1,114 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "orxonox_scene.h"
+
+
+OrxonoxScene::OrxonoxScene(SceneManager *mSceneMgr) : mSceneMgr(mSceneMgr)
+{
+}
+
+
+OrxonoxScene::~OrxonoxScene()
+{
+}
+
+
+bool OrxonoxScene::initialise()
+{
+	// Load resources
+	loadResources();
+
+	distance = 0;
+	radius = 100;
+
+	createScene();
+
+	return true;
+}
+
+
+// method where you can perform resource group loading
+// Must at least do
+// ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+void OrxonoxScene::loadResources(void)
+{
+	// Initialise, parse scripts etc
+	ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+}
+
+
+// Currently just a test scene with an ogre head an a surrounding light
+void OrxonoxScene::createScene(void)
+{
+	mSceneMgr->setAmbientLight(ColourValue(0.3,0.3,0.3));
+
+	//create first entity
+	Entity *head = mSceneMgr->createEntity("head", "ogrehead.mesh");
+
+	//create a scene node to attach the head to
+	SceneNode *node = mSceneMgr->getRootSceneNode()
+        ->createChildSceneNode("OgreHeadNode", Vector3(0,0,0));
+	//attach the ogre head
+	node->attachObject(head);
+
+	// set up skybox
+	mSceneMgr->setSkyBox(true, "Examples/SceneSkyBox2");
+
+	// set up one mLight source
+	mLight = mSceneMgr->createLight("Light1");
+	mLight->setType(Light::LT_POINT);
+	mLight->setPosition(Vector3(0, 0, 0));
+	mLight->setDiffuseColour(1.0, 1.0, 1.0);
+	mLight->setSpecularColour(1.0, 1.0, 1.0);
+
+	//create billboard
+	bbs = mSceneMgr->createBillboardSet("bb", 1);
+	bbs->createBillboard(Vector3::ZERO, ColourValue(1.0, 1.0, 1.0));
+	bbs->setMaterialName("Examples/Flare");
+
+	lightNode = mSceneMgr->getRootSceneNode()
+        ->createChildSceneNode("LightNode", Vector3(0, 100, 0));
+
+	lightNode->attachObject(bbs);
+	lightNode->attachObject(mLight);
+}
+
+
+// compute something between frames if neccessary
+void OrxonoxScene::tick(unsigned long time, float deltaTime)
+{
+	float t = time/1000.0;
+
+	lightNode->setPosition(radius*sin(5*t), radius*cos(5*t), sin(1*t)*distance);
+	
+	mLight->setDiffuseColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
+	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)));
+}
Index: code/branches/main_reto_vs05/src/orxonox_ship.cc
===================================================================
--- code/branches/main_reto_vs05/src/orxonox_ship.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/orxonox_ship.cc	(revision 157)
@@ -0,0 +1,172 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+* Base class for any kind of flyable ship in Orxonox.
+* 
+* The ship offers steering methods (like left, right, etc.) and translates
+* them into movement. A ship can also hold more than one weapons (where each
+* of these can be replaced during the game). This means that a ship can have
+* many WeaponManagers but only one MunitionManager (independant object that
+* is referenced in each WeaponManager).
+* Furthermore a ship in Orxonox is responsible for its visualization, which is
+* why it receives a pointer to the SceneManager.
+*/
+
+
+#include "orxonox_ship.h"
+
+
+/**
+* Standard constructor, that only initalizes a few variables. Some of them
+* could be made static, since any new ship would be derived from the BaseShip.
+* Or even better: write config files for each ship so that manipulating
+* its properties would be even easier.
+* @param mSceneMgr The current main SceneManager
+* @param mNode The scene node which the ship will be attached to later.
+*/
+OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode)
+	    : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)),
+      baseThrust(1000), thrust(0), sideThrust(0), n(0),
+	bulletSpeed(400)
+{
+}
+
+
+/**
+* Standard destructor.
+* Doesn't have any work to do yet.
+*/
+OrxonoxShip::~OrxonoxShip()
+{
+}
+
+
+/**
+* Initialises everything.
+* Once that ResourceGroups are organised, this method loads them.
+* It might be an idea to make this function static in order for the
+* SceneManger to call the initialise method of every needed class (macros..)
+*/
+bool OrxonoxShip::initialise()
+{
+	// 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..)
+	// TODO: names must be unique! use static variables..
+	mShip = mSceneMgr->createEntity("Ship", "fish.mesh");
+	SceneNode *fishNode = mRootNode->createChildSceneNode("fishNode");
+	fishNode->yaw(Degree(-90));
+	fishNode->attachObject(mShip);
+	fishNode->setScale(Vector3(10, 10, 10));
+
+	return true;
+}
+
+
+/**
+* Gets the ship to accelerate in the current direction.
+* The value should be between 0 and 1, with one beeing full thrust and 0 none.
+* @param value Acceleration between 0 and 1
+*/
+void OrxonoxShip::setThrust(const Real value)
+{
+	thrust = value * baseThrust;
+}
+
+
+/**
+* Gets the ship to accelerate sideways regarding the current direction.
+* The value should be between 0 and 1, with one beeing full thrust and 0 none.
+* @param value Acceleration between 0 and 1
+*/
+void OrxonoxShip::setSideThrust(const Real value)
+{
+	sideThrust = value * baseThrust;
+}
+
+
+/**
+* Rotate the ship along with the camera up and down.
+* @param angle Pitch value.
+*/
+void OrxonoxShip::turnUpAndDown(const Radian &angle)
+{
+  RootNode_->pitch(angle, Ogre::Node::TransformSpace::TS_LOCAL);
+}
+
+
+/**
+* Rotate the ship along with the camera left and right.
+* @param angle Yaw value.
+*/
+void OrxonoxShip::turnLeftAndRight(const Radian &angle)
+{
+  RootNode_->yaw(angle, Ogre::Node::TransformSpace::TS_PARENT);
+}
+
+
+/**
+* Fire a bullet (Entity with SceneNode).
+* This method creates a new Entity plus a SceneNode. But be sure not make
+* the new Node a child of RootNode_!
+*/
+Bullet* OrxonoxShip::fire()
+{
+	// TODO: Names must be unique!
+	SceneNode *temp = RootNode_->getParentSceneNode()->createChildSceneNode(
+        "BulletNode" + StringConverter::toString(objectCounter_));
+	temp->setOrientation(RootNode_->getOrientation());
+	temp->setPosition(RootNode_->getPosition());
+	temp->setScale(Vector3(1, 1, 1) * 10);
+	temp->yaw(Degree(-90));
+	return new Bullet(temp, mSceneMgr->createEntity("bullet"
+        + StringConverter::toString(objectCounter_++), "Barrel.mesh"), speed
+        + (RootNode_->getOrientation() * Vector3(0, 0, -1)).normalisedCopy()
+        * bulletSpeed_);
+}
+
+
+/**
+* Standard tick() function.
+* Currently, only the speed is applied according to the thrust values.
+* @param time Absolute time.
+* @param deltaTime Relative time.
+*/
+bool OrxonoxShip::tick(unsigned long time, Real deltaTime)
+{
+  Quaternion quad = mRootNode->getOrientation();
+  quad.normalise();
+  speed += quad * Vector3(0, 0, -1) * currentThrust_ * deltaTime;
+	speed += quad * Vector3(-1, 0,  0) * current_SideThrust_ * deltaTime;
+
+	RootNode_->translate(currentSpeed_ * deltaTime);
+
+	return true;
+}
Index: code/branches/main_reto_vs05/src/run_manager.cc
===================================================================
--- code/branches/main_reto_vs05/src/run_manager.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/run_manager.cc	(revision 157)
@@ -0,0 +1,540 @@
+/*
+*   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 <http://www.gnu.org/licenses/>.
+*
+*
+*   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 "run_manager.h"
+
+
+/**
+* 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 ogre_ The OgreControl object holding the render window and the Root
+*/
+RunManager::RunManager(OgreControl * ogre)
+      : ogre_(ogre), window_(ogre->getRenderWindow()), leftButtonDown_(false),
+      statsOn_(true), screenShotCounter_(0), timeUntilNextToggle_(0),
+      filtering_(TFO_BILINEAR), aniso_(1), sceneDetailIndex_(0),
+      debugOverlay_(0), inputManager_(0), mouse_(0), keyboard_(0), joystick_(0)
+{
+
+  // SETTING UP THE SCENE
+
+  // create one new SceneManger
+  sceneMgr_ = ogre_->getRoot()->createSceneManager(ST_GENERIC, "backgroundScene_");
+
+  // background scene (world objects, skybox, lights, etc.)
+  backgroundScene_ = new OrxonoxScene(sceneMgr_);
+
+  // PLAYER SPACESHIP
+
+  // Create a space ship object and its SceneNode.
+  // Some ideas about the steering: The ship should only receive events like
+  // up, down, left, right, roll left, roll right, move down, move up, etc).
+  // Multiple interpretations of these commands would make the game more
+  // but it also makes AI steering more difficult, since for every type of
+  // steering, new methods have to be written.
+  // --> clearly define how a space ship can fly (rolling?, conservation of
+  // impuls?, direct mouse sight steeering?, etc.)
+  // It should also be considered, that the ship 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).
+
+  // Construct a new spaceship and give it the node
+  playerShip_ = new OrxonoxShip(sceneMgr_, getRootSceneNode()
+    ->createChildSceneNode("ShipNode", Vector3(20, 20, 20)));
+
+
+  // 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!).
+  backgroundScene_->initialise();
+  playerShip_->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..
+  bullets_ = new Bullet*[10];
+  bulletsIndex_ = 0;
+  bulletsSize_ = 10;
+
+
+  // HUMAN INTERFACE
+
+  using namespace OIS;
+
+  debugOverlay_ = OverlayManager::getSingleton()
+    .getByName("Core/DebugOverlay");
+
+  LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
+  ParamList pl;
+  size_t windowHnd = 0;
+  std::ostringstream windowHndStr;
+
+  window_->getCustomAttribute("WINDOW", &windowHnd);
+  windowHndStr << windowHnd;
+  pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+
+  inputManager_ = InputManager::createInputSystem( pl );
+
+  // Create all devices (We only catch joystick exceptions here,
+  // as, most people have Key/Mouse)
+  keyboard_ = static_cast<Keyboard*>(inputManager_
+    ->createInputObject( OISKeyboard, false ));
+  mouse_ = static_cast<Mouse*>(inputManager_
+    ->createInputObject( OISMouse, false ));
+  try {
+    joystick_ = static_cast<JoyStick*>(inputManager_
+      ->createInputObject( OISJoyStick, false ));
+  }
+  catch(...) {
+    joystick_ = 0;
+  }
+
+  //Set initial mouse clipping size
+  windowResized(window_);
+
+  showDebugOverlay(true);
+
+  // REGISTER THIS OBJECT AS A WINDOW EVENT LISTENER IN OGRE
+  // It will then receive events liek windowClosed, windowResized, etc.
+  WindowEventUtilities::addWindowEventListener(window_, 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(window_, this);
+  windowClosed(window_);
+
+  if (backgroundScene_)
+    delete backgroundScene_;
+  if (playerShip_)
+    delete playerShip_;
+
+  // clean up the bullet list
+  for (int i = 0; i < bulletsIndex_; i++)
+    delete bullets_[i];
+  delete bullets_;
+}
+
+
+/**
+* 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)
+{
+  // synchronize with internal class timer
+  totalTime_ = time;
+
+  // Call tick() for every object
+  // This could be done by registering (needs a factory..)
+  backgroundScene_->tick(time, deltaTime);
+  playerShip_->tick(time, deltaTime);
+
+
+  // Update the 'HUD'
+  updateStats();
+
+  // update the bullet positions
+  for (int i = 0; i < bulletsIndex_; i++)
+  {
+    bullets_[i]->mNode->translate(bullets_[i]->mSpeed*deltaTime);
+    bullets_[i]->mNode->yaw(Degree(deltaTime*100));
+    bullets_[i]->mNode->roll(Degree(deltaTime*300));
+  }
+
+  // HUMAN INTERFACE
+
+  using namespace OIS;
+
+  if(window_->isClosed())	return false;
+
+  //Need to capture/update each device
+  keyboard_->capture();
+  mouse_->capture();
+  if( joystick_ ) joystick_->capture();
+
+  bool buffJ = (joystick_) ? joystick_->buffered() : true;
+
+  //Check if one of the devices is not buffered
+  if( !mouse_->buffered() || !keyboard_->buffered() || !buffJ )
+  {
+    // one of the input modes is immediate, so setup what
+    // is needed for immediate movement
+    if (timeUntilNextToggle_ >= 0)
+      timeUntilNextToggle_ -= deltaTime;
+  }
+
+  // handle HID devices
+  if( processUnbufferedKeyInput() == false )
+      return false;
+  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 = mouse_->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 == window_ )
+  {
+    if( inputManager_ )
+    {
+      inputManager_->destroyInputObject( mouse_ );
+      inputManager_->destroyInputObject( keyboard_ );
+      inputManager_->destroyInputObject( joystick_ );
+
+      OIS::InputManager::destroyInputSystem(inputManager_);
+      inputManager_ = 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(keyboard_->isKeyDown(KC_A) || keyboard_->isKeyDown(KC_LEFT))
+    playerShip_->setSideThrust(1);
+  else if(keyboard_->isKeyDown(KC_D) || keyboard_->isKeyDown(KC_RIGHT))
+    playerShip_->setSideThrust(-1);
+  else
+    playerShip_->setSideThrust(0);
+
+  if(keyboard_->isKeyDown(KC_UP) || keyboard_->isKeyDown(KC_W) )
+    playerShip_->setThrust(1);
+  else if(keyboard_->isKeyDown(KC_DOWN) || keyboard_->isKeyDown(KC_S) )
+    playerShip_->setThrust(-1);
+  else
+    playerShip_->setThrust(0);
+
+  if( keyboard_->isKeyDown(KC_ESCAPE) || keyboard_->isKeyDown(KC_Q) )
+    return false;
+
+  if( keyboard_->isKeyDown(KC_F) && timeUntilNextToggle_ <= 0 )
+  {
+    statsOn_ = !statsOn_;
+    showDebugOverlay(statsOn_);
+    timeUntilNextToggle_ = 1;
+  }
+
+  if( keyboard_->isKeyDown(KC_T) && timeUntilNextToggle_ <= 0 )
+  {
+    switch(filtering_)
+    {
+    case TFO_BILINEAR:
+      filtering_ = TFO_TRILINEAR;
+      aniso_ = 1;
+      break;
+    case TFO_TRILINEAR:
+      filtering_ = TFO_ANISOTROPIC;
+      aniso_ = 8;
+      break;
+    case TFO_ANISOTROPIC:
+      filtering_ = TFO_BILINEAR;
+      aniso_ = 1;
+      break;
+    default: break;
+    }
+    MaterialManager::getSingleton().setDefaultTextureFiltering(filtering_);
+    MaterialManager::getSingleton().setDefaultAnisotropy(aniso_);
+
+    showDebugOverlay(statsOn_);
+    timeUntilNextToggle_ = 1;
+  }
+
+  if(keyboard_->isKeyDown(KC_SYSRQ) && timeUntilNextToggle_ <= 0)
+  {
+    std::ostringstream ss;
+    ss << "screenshot_" << ++screenShotCounter_ << ".png";
+    window_->writeContentsToFile(ss.str());
+    timeUntilNextToggle_ = 0.5;
+    mDebugText = "Saved: " + ss.str();
+  }
+
+  if(keyboard_->isKeyDown(KC_R) && timeUntilNextToggle_ <=0)
+  {
+    sceneDetailIndex_ = (sceneDetailIndex_+1)%3 ;
+    switch(sceneDetailIndex_) {
+        case 0 : camera_->setPolygonMode(PM_SOLID); break;
+        case 1 : camera_->setPolygonMode(PM_WIREFRAME); break;
+        case 2 : camera_->setPolygonMode(PM_POINTS); break;
+    }
+    timeUntilNextToggle_ = 0.5;
+  }
+
+  static bool displayCameraDetails = false;
+  if(keyboard_->isKeyDown(KC_P) && timeUntilNextToggle_ <= 0)
+  {
+    displayCameraDetails = !displayCameraDetails;
+    timeUntilNextToggle_ = 0.5;
+    if (!displayCameraDetails)
+      mDebugText = "";
+  }
+
+  // Print camera details
+  if(displayCameraDetails)
+    mDebugText = StringConverter::toString(playerShip_->getThrust())
+    + " | Speed = " + StringConverter::toString(playerShip_->speed);
+  // mDebugText = "P: " + StringConverter::toString(camera_
+  //      ->getDerivedPosition()) + " " + "O: "
+  //      + StringConverter::toString(camera_->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;
+
+  const MouseState &ms = mouse_->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 *tempBullet = playerShip_->fire();
+
+    // resize array if neccessary (double the size then)
+    if (bulletsIndex_ >= bulletsSize_)
+    {
+      // redimension the array
+      Bullet **tempArray = new Bullet*[2*bulletsSize_];
+      for (int i = 0; i < bulletsSize_; i++)
+        tempArray[i] = bullets_[i];
+      bulletsSize_ *= 2;
+      delete bullets_;
+      bullets_ = tempArray;
+    }
+
+    // add the bullet to the list
+    bullets_[bulletsIndex_++] = tempBullet;
+
+  }
+  else if (!ms.buttons)
+    leftButtonDown_ = false;
+
+  // space ship steering. This should definitely be done in the steering object
+  // Simply give it the mouse movements.
+  playerShip_->turnUpAndDown(Radian(ms.Y.rel * mouseSensitivity_));
+  playerShip_->turnLeftAndRight(Radian(ms.X.rel * mousSensitivity_));
+  //playerShip_->mRootNode->pitch(Degree(-ms.Y.rel * 0.13), Ogre::Node::TransformSpace::TS_LOCAL);
+  //playerShip_->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 (debugOverlay_)
+  {
+    if (show)
+      debugOverlay_->show();
+    else
+      debugOverlay_->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");
+
+    const RenderTarget::FrameStats& stats = window_->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.
+* playerShip_Node->attachObject(camera_) 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)
+{
+  camera_ = sceneMgr_->createCamera("PlayerCam");
+  playerShip_Node->attachObject(camera_);
+  camera_->setNearClipDistance(5);
+  camera_->setPosition(Vector3(0,10,500));
+  camera_->lookAtVector3(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 = window_->addViewport(camera_);
+  vp->setBackgroundColour(ColourValue(0,0,0));
+
+  // Alter the camera aspect ratio to match the viewport
+  camera_->setAspectRatio(
+    Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
+}
Index: code/branches/main_reto_vs05/src/weapon_manager.cc
===================================================================
--- code/branches/main_reto_vs05/src/weapon_manager.cc	(revision 157)
+++ code/branches/main_reto_vs05/src/weapon_manager.cc	(revision 157)
@@ -0,0 +1,38 @@
+/*
+ *   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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "weapon_manager.h"
+
+WeaponManager::WeaponManager(SceneManager *mSceneMgr)
+{
+	
+}
+
+
+WeaponManager::~WeaponManager()
+{
+}
