⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oasisroot.h

📁 使用stl技术,(还没看,是听说的)
💻 H
字号:
/******************************************************************************

 * This source file is part of Bad Camel Gaming

 * Copyright (C) 2003  Zephie Greyvenstein

 * See Readme.html for acknowledgements

 *

 * This library is free software; you can redistribute it and/or

 * modify it under the terms of the GNU Lesser General Public

 * License as published by the Free Software Foundation; either

 * version 2.1 of the License, or (at your option) any later version.

 *

 * This library 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

 * Lesser General Public License for more details.

 *

 * You should have received a copy of the GNU Lesser General Public

 * License along with this library; if not, write to the Free Software

 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 *****************************************************************************/



/******************************************************************************

 * FILENAME    : oasisRoot.h

 * DESCRIPTION : Class for initialising the systems

 * AUTHOR      : Zephie Greyvenstein

 *****************************************************************************/



/// Avoid double inclusion

#ifndef __ROOT_H__

#define __ROOT_H__



/// Include the common headers

#include "oasisCommon.h"

/// Include the rest of the needed oasis stuff

#include "oasisSingleton.h"



/// Forward declare ogre stuff

namespace Ogre {

  class Root;

};



namespace Oasis {  

  /** Root class for oasis, which controls all sub systems

      @remarks

      You use this class to init and deinit all subsystems. It also gives you

      update/reset calls for multi system changes. You also add resources

      to the system through this class

  */

  class _oasisExport root : public singleton< root > {

  public:

    /// The systems to initialise

    enum SubSystem {

      /// Enable the graphics system

      SS_GRAPHICS      = 0x0000001,       

      /// Enable the in-game console system

      SS_CONSOLE       = 0x0000002,   

      /// Enable the input system

      SS_INPUT         = 0x0000004,    

      /// Enable the scripting system

      SS_SCRIPT        = 0x0000008,

      /// Enable the listener system

      SS_FRAMELISTENER = 0x0000010,

      /// Enable the object syste,

      SS_OBJECT        = 0x0000020,

      /// Enable the sound system

      SS_SOUND         = 0x0000040,     

      /// Enable the camera system

      SS_CAMERA        = 0x0000080,

      /// Enable the physics system

      SS_PHYSICS       = 0x0000100

    };



    /// The system states

    enum SystemState {

      /// System has been deinitialised

      SS_DEINITIALISED     = 0,

      /// System has been initialised

      SS_INITIALISED       = 1

    };

    

    /// Constructor

    root( const string &configFile, uint32 flags = 0 );

    /// Deconstructor

    virtual ~root( );

    

    /// Get singleton

    static root &get( void );

    /// Get singleton pointer

    static root *getPtr( void );

  

    /// Starts the systems specified by the flags

    void startSystems( uint32 flags );

    /// Reset all systems that are running

    void resetAll( void );

    /// Update all systems that are running

    void updateAll( real time );



    /// Start the renderin loop

    void doAutoLoop( void );

    

    /// Loads resources from directory

    void loadDirectoryResources( const string &resourcePath );

    /// Loads resources from a zip

    void loadZipResources( const string &zipFile );

    

  public:

    /// The directories to search in - mainly for loading scripts PENDING: hack?

    std::vector< string > directories;    

  

  private:

    /// Handle to ogre root

    Ogre::Root *ogreRoot;

    /// Multi purpose system handle

    system *tempSystem;

    

    /// Systems that are initialised

    uint32 initedSystems;



    /// Vector of systems

    typedef std::vector< system* > systemVector;



    /// All the systems that are running

    systemVector runningSystems;

    

    /// Start a single system

    void _startSystem( SubSystem systemToStart );

    /// Resolve inter-system dependancies

    void _resolveDependencies( uint32 &flags );  

    /// Logs init and deinit activities of systems  

    void _logState( const string &name, SystemState state );   

  };  

};



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -