Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2008, 5:35:49 PM (16 years ago)
Author:
rgrieder
Message:

merged input back into trunk
note: I have created an asylum with obsolete code, please check the files

Location:
code/trunk/src/orxonox
Files:
23 deleted
24 edited
7 copied

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/CMakeLists.txt

    r1021 r1024  
    11SET( ORXONOX_SRC_FILES
    22  GraphicsEngine.cc
    3   InputEventListener.cc
    4   InputHandler.cc
    53  Main.cc
    64  Orxonox.cc
  • code/trunk/src/orxonox/GraphicsEngine.cc

    r1021 r1024  
    3535#include <OgreException.h>
    3636#include <OgreConfigFile.h>
     37#include <OgreLogManager.h>
    3738#include <OgreTextureManager.h>
    3839#include <OgreRenderWindow.h>
     
    6263  GraphicsEngine::~GraphicsEngine()
    6364  {
    64     if (!this->root_)
     65    if (this->root_)
    6566      delete this->root_;
     67    // delete the ogre log and the logManager (sine we have created it).
     68    if (LogManager::getSingletonPtr() != 0)
     69    {
     70      LogManager::getSingleton().getDefaultLog()->removeListener(this);
     71      LogManager::getSingleton().destroyLog(LogManager::getSingleton().getDefaultLog());
     72      delete LogManager::getSingletonPtr();
     73    }
    6674  }
    6775
    6876  void GraphicsEngine::setConfigValues()
    6977  {
    70     SetConfigValue(dataPath_, dataPath_).description("relative path to media data");
    71 
    72   }
    73 
     78    SetConfigValue(dataPath_, "../../media/").description("relative path to media data");
     79    SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
     80    SetConfigValue(ogreLogLevelTrivial_ , 5).description("relative path to media data");
     81    SetConfigValue(ogreLogLevelNormal_  , 4).description("relative path to media data");
     82    SetConfigValue(ogreLogLevelCritical_, 2).description("relative path to media data");
     83  }
     84
     85  /**
     86    @brief Creates the Ogre Root object and sets up the ogre log.
     87  */
    7488  void GraphicsEngine::setup()
    7589  {
     
    86100    std::string plugin_filename = "plugins.cfg";
    87101#endif
     102
     103    // create a logManager
     104    LogManager *logger;
     105                if(LogManager::getSingletonPtr() == 0)
     106                        logger = new LogManager();
     107    else
     108      logger = LogManager::getSingletonPtr();
     109
     110    // create our own log that we can listen to
     111    Log *myLog;
     112    if (this->ogreLogfile_ == "")
     113      myLog = logger->createLog("ogre.log", true, false, true);
     114    else
     115      myLog = logger->createLog(this->ogreLogfile_, true, false, false);
     116
     117    myLog->setLogDetail(LL_BOREME);
     118    myLog->addListener(this);
     119
     120    // Root will detect that we've already created a Log
    88121    root_ = new Root(plugin_filename);
    89122  }
     
    106139    // temporary overwrite of dataPath, change ini file for permanent change
    107140    if( dataPath != "" )
    108       dataPath_ = dataPath;
     141      dataPath_ = dataPath + "/";
    109142    loadRessourceLocations(this->dataPath_);
    110143    if (!root_->restoreConfig() && !root_->showConfigDialog())
     
    196229  }
    197230
     231  /**
     232    @brief Method called by the LogListener interface from Ogre.
     233    We use it to capture Ogre log messages and handle it ourselves.
     234    @param message The message to be logged
     235    @param lml The message level the log is using
     236    @param maskDebug If we are printing to the console or not
     237    @param logName the name of this log (so you can have several listeners
     238                   for different logs, and identify them)
     239  */
     240  void GraphicsEngine::messageLogged(const std::string& message,
     241    LogMessageLevel lml, bool maskDebug, const std::string &logName)
     242  {
     243    int orxonoxLevel;
     244    switch (lml)
     245    {
     246      case LML_TRIVIAL:
     247        orxonoxLevel = this->ogreLogLevelTrivial_;
     248        break;
     249      case LML_NORMAL:
     250        orxonoxLevel = this->ogreLogLevelNormal_;
     251        break;
     252      case LML_CRITICAL:
     253        orxonoxLevel = this->ogreLogLevelCritical_;
     254        break;
     255      default:
     256        orxonoxLevel = 0;
     257    }
     258    OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
     259        << "*** Ogre: " << message << std::endl;
     260  }
    198261}
  • code/trunk/src/orxonox/GraphicsEngine.h

    r1021 r1024  
    1111
    1212#include <OgrePrerequisites.h>
     13#include <OgreLog.h>
    1314#include <OgreRoot.h>
    1415#include <OgreSceneManager.h>
     
    2324   * graphics engine manager class
    2425 */
    25   class _OrxonoxExport GraphicsEngine : public OrxonoxClass
     26  class _OrxonoxExport GraphicsEngine : public OrxonoxClass, public Ogre::LogListener
    2627  {
    2728    public:
    2829      GraphicsEngine();
    29       inline void setConfigPath(std::string path) { this->configPath_ = path; };
     30      void setConfigPath(std::string path) { this->configPath_ = path; };
    3031      // find a better way for this
    3132      //inline Ogre::Root* getRoot() { return root_; };
     
    5455
    5556    private:
     57      //! Method called by the LogListener from Ogre
     58      void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
     59                         bool maskDebug, const std::string &logName);
     60
    5661      Ogre::Root*         root_;        //!< Ogre's root
    5762      std::string         configPath_;  //!< path to config file
     
    6065      Ogre::RenderWindow* renderWindow_;//!< the current render window
    6166      //bool               bOverwritePath_; //!< overwrites path
     67      std::string         ogreLogfile_; //!< log file name for Ogre log messages
     68      int ogreLogLevelTrivial_;         //!< Corresponding Orxonx debug level for LL_TRIVIAL
     69      int ogreLogLevelNormal_;          //!< Corresponding Orxonx debug level for LL_NORMAL
     70      int ogreLogLevelCritical_;        //!< Corresponding Orxonx debug level for LL_CRITICAL
    6271
    6372  };
  • code/trunk/src/orxonox/Main.cc

    r1021 r1024  
    8484
    8585    orx->start();
    86     orx->destroy();
     86    orx->destroySingleton();
    8787  }
    8888  catch (std::exception &ex)
  • code/trunk/src/orxonox/Orxonox.cc

    r1021 r1024  
    5050//misc
    5151//#include "util/Sleep.h"
     52#include "util/ArgReader.h"
    5253
    5354// audio
     
    6162
    6263// objects
    63 #include "core/ArgReader.h"
    6464#include "core/Debug.h"
    6565#include "core/Factory.h"
     
    7070#include "objects/weapon/BulletManager.h"
    7171
    72 #include "InputHandler.h"
     72#include "core/InputManager.h"
    7373
    7474#include "Orxonox.h"
     
    108108      delete this->orxonoxHUD_;
    109109    Loader::close();
    110     InputHandler::destroy();
     110    InputManager::destroySingleton();
    111111    if (this->auMan_)
    112112      delete this->auMan_;
     
    147147      singletonRef_s = new Orxonox();
    148148    return singletonRef_s;
    149     //static Orxonox theOnlyInstance;
    150     //return &theOnlyInstance;
    151149  }
    152150
     
    154152    @brief Destroys the Orxonox singleton.
    155153  */
    156   void Orxonox::destroy()
     154  void Orxonox::destroySingleton()
    157155  {
    158156    if (singletonRef_s)
     
    174172    std::string mode;
    175173
    176     ArgReader ar = ArgReader(argc, argv);
     174    ArgReader ar(argc, argv);
    177175    ar.checkArgument("mode", mode, false);
    178176    ar.checkArgument("data", this->dataPath_, false);
     
    327325  void Orxonox::setupInputSystem()
    328326  {
    329     inputHandler_ = InputHandler::getSingleton();
     327    inputHandler_ = InputManager::getSingleton();
    330328    if (!inputHandler_->initialise(ogre_->getWindowHandle(),
    331329          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
    332330      abortImmediate();
     331    inputHandler_->setInputMode(IM_INGAME);
    333332  }
    334333
  • code/trunk/src/orxonox/Orxonox.h

    r1021 r1024  
    1717
    1818#include "GraphicsEngine.h"
    19 #include "InputEventListener.h"
     19#include "core/InputEventListener.h"
    2020
    2121
     
    4444
    4545      static Orxonox* getSingleton();
    46       static void destroy();
     46      static void destroySingleton();
    4747
    4848   private:
     
    7575      audio::AudioManager*  auMan_;         //!< audio manager
    7676      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
    77       InputHandler*         inputHandler_;  //!< Handles input with key bindings
     77      InputManager*         inputHandler_;  //!< Handles input with key bindings
    7878      Ogre::Root*           root_;          //!< Holy grail of Ogre
    7979      Ogre::Timer*          timer_;         //!< Main loop timer
  • code/trunk/src/orxonox/OrxonoxPlatform.h

    r1021 r1024  
    190190
    191191// Integer formats of fixed bit width
    192 typedef unsigned int uint32;
     192// FIXME: consider 64 bit platforms!
     193/*typedef unsigned int uint32;
    193194typedef unsigned short uint16;
    194 typedef unsigned char uint8;
     195typedef unsigned char uint8;*/
    195196
    196197#ifdef ORXONOX_DOUBLE_PRECISION
     
    232233// disable: 'MultiTypeString' : multiple assignment operators specified
    233234// Used in MultiType and works fine so far
    234 #   pragma warning (disable : 4522)
     235//#   pragma warning (disable : 4522)
    235236
    236237// disable: "non dll-interface class used as base for dll-interface class"
     
    270271} /* namespace orxonox */
    271272
     273// include visual leak detector to search for memory links
     274//#include <vld.h>
     275
    272276#endif /* _OrxonoxPlatform_H__ */
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r1021 r1024  
    2727
    2828/**
    29  @file  OrxonoxPrereqs.h
    30  @brief Contains all the necessary forward declarations for all classes and structs.
    31  */
     29  @file
     30  @brief Contains all the necessary forward declarations for all classes and structs.
     31*/
    3232
    3333#ifndef _OrxonoxPrereqs_H__
     
    5959//-----------------------------------------------------------------------
    6060
    61 // classes that have not yet been put into a namespace
    62 class InputManager;
    63 class SpaceShipSteering;
     61namespace orxonox {
     62  class GraphicsEngine;
     63  class Orxonox;
    6464
    65 namespace orxonox {
     65  // objects
    6666  class Ambient;
    67   class BaseObject;
    6867  class Camera;
    69   class GraphicsEngine;
    70   struct InputEvent;
    71   class InputEventListener;
    72   class InputHandler;
    73   class Mesh;
     68  class Explosion;
     69  class Fighter;
    7470  class Model;
    7571  class NPC;
    76   class OrxListener;
    77   class Orxonox;
     72  class Projectile;
    7873  class Skybox;
    7974  class SpaceShip;
    80   class Tickable;
    81   class TickFrameListener;
    82   template <class T>
    83   class Timer;
    84   class TimerBase;
    85   class TimerFrameListener;
    8675  class WorldEntity;
    8776
     
    9382  class WeaponStation;
    9483
     84  // tools
     85  class BillboardSet;
     86  class Light;
     87  class Mesh;
     88  template <class T>
     89  class Timer;
     90  class TimerBase;
     91
     92  // particle
    9593  class ParticleInterface;
     94
     95  // hud
    9696  class HUD;
    9797}
  • code/trunk/src/orxonox/OrxonoxStableHeaders.h

    r1021 r1024  
    4040// including std headers here is useless since they're already precompiled
    4141
    42 // not including the entire Ogre.h doesn't exceed the default heap size for pch
    4342#ifndef WIN32_LEAN_AND_MEAN
    4443// prevent Ogre from including winsock.h that messes with winsock2.h from enet
    4544#  define WIN32_LEAN_AND_MEAN
    4645#endif
     46// not including the entire Ogre.h doesn't exceed the default heap size for pch
    4747//#include <Ogre.h>
    4848#include <OgreBillboardSet.h>
  • code/trunk/src/orxonox/core/CMakeLists.txt

    r1021 r1024  
    55  Identifier.cc
    66  IdentifierDistributor.cc
     7  InputHandler.cc
     8  InputManager.cc
    79  MetaObjectList.cc
    810  ConfigValueContainer.cc
    911  Error.cc
    1012  SignalHandler.cc
    11   ArgReader.cc
    1213  DebugLevel.cc
    1314  OutputHandler.cc
  • code/trunk/src/orxonox/core/CorePrereqs.h

    r871 r1024  
    2727
    2828/**
    29     @file  CorePrereq.h
    30     @brief Contains all the necessary forward declarations for all classes, structs and enums.
     29  @file
     30  @brief Contains all the necessary forward declarations for all classes and structs.
    3131*/
    3232
     
    3636#include <string>
    3737
    38 #include "orxonox/OrxonoxPlatform.h"
     38#include "OrxonoxPlatform.h"
    3939
    4040//-----------------------------------------------------------------------
     
    6767  typedef std::string LanguageEntryLabel;
    6868
    69   class ArgReader;
    7069  class BaseFactory;
    7170  class BaseMetaObjectListElement;
     71  class BaseObject;
    7272  template <class T>
    7373  class ClassFactory;
     
    8686  class Identifier;
    8787  class IdentifierDistributor;
     88  class InputHandlerGame;
     89  class InputHandlerGUI;
     90  class InputManager;
    8891  template <class T>
    8992  class Iterator;
     
    103106  template <class T>
    104107  class SubclassIdentifier;
     108  class Tickable;
    105109  template <class T, class O>
    106110  class XMLPortClassObjectContainer;
  • code/trunk/src/orxonox/core/Factory.h

    r871 r1024  
    5151namespace orxonox
    5252{
    53     class BaseObject; // Forward declaration
    54 
    5553    // ###############################
    5654    // ###         Factory         ###
  • code/trunk/src/orxonox/core/Identifier.h

    r890 r1024  
    3333     - the name
    3434     - a list with all objects
    35      - parents and childs
     35     - parents and children
    3636     - the factory (if available)
    3737     - the networkID that can be synchronised with the server
     
    6565namespace orxonox
    6666{
    67     class BaseFactory; // Forward declaration
    68     class BaseObject;  // Forward declaration
    69 
    7067    // ###############################
    7168    // ###       Identifier        ###
  • code/trunk/src/orxonox/core/MetaObjectList.h

    r871 r1024  
    113113        This allows much faster deletion of objects because no iteration is needed.
    114114    */
    115     class MetaObjectList
     115    class _CoreExport MetaObjectList
    116116    {
    117117        public:
  • code/trunk/src/orxonox/core/Script.cc

    r1021 r1024  
    3838}
    3939
    40 #include "tolua++.h"
    41 #include "../../util/tolua/tolua_bind.h"
     40#include "util/tolua/tolua++.h"
     41#include "util/tolua/tolua_bind.h"
    4242
    4343namespace orxonox
     
    5757  {
    5858    output_ += str;
    59     COUT(0) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl;
     59    COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl;
    6060  }
    6161
     
    8989
    9090    if (luaTags) luaSource_ = replaceLuaTags(levelString);
    91     COUT(0) << "ParsedSourceCode: " << luaSource_ << std::endl;
     91    COUT(4) << "ParsedSourceCode: " << luaSource_ << std::endl;
    9292  }
    9393
     
    100100    if (error == 0)
    101101      error = lua_pcall(luaState_, 0, 0, 0);
    102     if (error != 0) COUT(0) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;
     102    if (error != 0) COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;
    103103  }
    104104
  • code/trunk/src/orxonox/core/Tickable.h

    r1021 r1024  
    4646namespace orxonox
    4747{
    48     //class TickFrameListener; // Forward declaration
    49 
    5048    //! The Tickable interface provides a tick(dt) function, that gets called every frame.
    5149    class _CoreExport Tickable : virtual public OrxonoxClass
  • code/trunk/src/orxonox/objects/Fighter.cc

    r1021 r1024  
    3939#include "core/CoreIncludes.h"
    4040#include "Orxonox.h"
    41 #include "InputHandler.h"
     41#include "core/InputManager.h"
    4242#include "particle/ParticleInterface.h"
    4343#include "weapon/AmmunitionDump.h"
     
    255255        if (!this->setMouseEventCallback_)
    256256        {
    257             if (InputHandler::getSingleton()->getMouse())
     257            if (InputManager::getSingleton()->getMouse())
    258258            {
    259                 InputHandler::getSingleton()->getMouse()->setEventCallback(this);
     259                InputManager::getSingleton()->getMouse()->setEventCallback(this);
    260260                this->setMouseEventCallback_ = true;
    261261            }
     
    264264        WorldEntity::tick(dt);
    265265
    266         OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard();
    267         OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse();
    268 
    269         mKeyboard->capture();
    270         mMouse->capture();
     266        OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard();
     267        OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse();
     268
     269        //mKeyboard->capture();
     270        //mMouse->capture();
    271271
    272272        if (leftButtonPressed_)
  • code/trunk/src/orxonox/objects/Fighter.h

    r871 r1024  
    77
    88#include "Model.h"
    9 
    10 class TiXmlElement; // Forward declaration
    119
    1210namespace orxonox
  • code/trunk/src/orxonox/objects/Model.h

    r1021 r1024  
    66#include "WorldEntity.h"
    77#include "../tools/Mesh.h"
    8 
    9 class TiXmlElement; // Forward declaration
    108
    119namespace orxonox
  • code/trunk/src/orxonox/objects/NPC.h

    r871 r1024  
    1111
    1212#include "Model.h"
    13 
    14 class TiXmlElement; // Forward declaration
    1513
    1614namespace orxonox {
  • code/trunk/src/orxonox/objects/Projectile.h

    r871 r1024  
    1010namespace orxonox
    1111{
    12     class SpaceShip; // Forward declaration
    13 
    1412    class _OrxonoxExport Projectile : public WorldEntity
    1513    {
  • code/trunk/src/orxonox/objects/Skybox.h

    r871 r1024  
    55
    66#include "core/BaseObject.h"
    7 
    8 class TiXmlElement; // Forward declaration
    97
    108namespace orxonox
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1021 r1024  
    4242#include "core/Debug.h"
    4343#include "Orxonox.h"
    44 #include "InputHandler.h"
     44#include "core/InputManager.h"
    4545#include "particle/ParticleInterface.h"
    4646#include "Projectile.h"
     
    417417    void SpaceShip::tick(float dt)
    418418    {
    419         if (!this->setMouseEventCallback_)
    420         {
    421             if (InputHandler::getSingleton()->getMouse())
     419      if (InputManager::getSingleton()->getMouse()->getEventCallback() != this)
     420        {
     421            if (InputManager::getSingleton()->getMouse())
    422422            {
    423                 InputHandler::getSingleton()->getMouse()->setEventCallback(this);
     423                InputManager::getSingleton()->getMouse()->setEventCallback(this);
    424424                this->setMouseEventCallback_ = true;
    425425            }
     
    446446        }
    447447
    448         OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard();
    449         OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse();
    450 
    451         mKeyboard->capture();
    452         mMouse->capture();
     448        OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard();
     449        OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse();
    453450
    454451
  • code/trunk/src/orxonox/objects/SpaceShip.h

    r1021 r1024  
    1010#include "../tools/BillboardSet.h"
    1111
    12 class TiXmlElement;          // Forward declaration
    13 
    1412namespace orxonox
    1513{
    16     class ParticleInterface; // Forward declaration
    17 
    1814    class _OrxonoxExport SpaceShip : public Model, public OIS::MouseListener
    1915    {
Note: See TracChangeset for help on using the changeset viewer.