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

📄 oasisobjectsystem.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    : oasisObjectSystem.h

 * DESCRIPTION : The object system

 * AUTHOR      : Zephie Greyvenstein

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



/// Avoid double inclusion

#ifndef __OBJECTSYSTEM_H__

#define __OBJECTSYSTEM_H__



/// Include the common headers

#include "oasisCommon.h"

/// Include the rest of the needed oasis stuff

#include "oasisSystem.h"

#include "oasisSingleton.h"

#include "oasisPool.h"

#include "oasisResourceManager.h"



namespace Oasis {

  /** The object system, the heart and soul of the framework

      @remarks

      The object system loads in and keeps handles on all object templates

      defined in scripts. Object instances are then create from these

      templates using the helper functions found in this class.

  */

  class _oasisExport objectSystem : public system,

                       public pool,

                       public resourceManager,

                       public singleton< objectSystem > {

  public:

    /// Constructor

    objectSystem( );  

    /// Deconstructor

    virtual ~objectSystem( );

  

    /// Get singleton

    static objectSystem &get( void );

    /// Get singleton pointer

    static objectSystem *getPtr( void );



    /// Reset this system

    void reset( void );

    /// Update this system

    void update( real time );



    /// Get an object template for further editing

    objectResource *getObjectTemplate( const string &name );

    /// Create a new object template and add it to the system

    objectResource *createObjectTemplate( const string &name ); 

    /** Create a new object

	@remarks

	This gives you a free object in the pool to use and abuse.

    */

    object *createObject( const string &objectName,

			  const string &templateName );

    /// Release object and put it back in the pool

    void removeObject( object *oldObject );

    /// Release object and put it back in the pool

    void removeObject( const string &objectName );

    /// Get an object by name

    object *getObject( const string &objectName );

  

  private: 

    /// Creates a new object template as a resource

    resource *createResource( const string &name );



    /// Creates a new object as a poolable

    poolable *_createPoolable( void );



    /// Parse a object  file

    void _parseFile( Ogre::DataChunk &chunk );

    /// Parse attributes for the object file

    void _parseAttribute( const Ogre::String &line, objectResource *file ); 



  };  

  static objectSystem &getObjectSystem( void ) {

    return objectSystem::get( );

  }

};



#endif

⌨️ 快捷键说明

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