/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2009.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: sgx/include/sgx/core/gamecode/base_engine.hpp

*/

#ifndef SGX_GAMECODE_BASE_ENGINE_HPP
#define SGX_GAMECODE_BASE_ENGINE_HPP	1

/**
Note: We derive engine from CGameHandler to ensure it includes all the
standard method calls that could be made from the registerObjected objects.
*/
class CSGXBaseEngine : public CGameObject {
public:
	CSGXBaseEngine();

	virtual tBOOL	registerObject(CGameHandler *ptr) { sgxTrace("Please use 'registerScenarioObject' versions"); return registerScenarioObject(ptr); }
	virtual tBOOL	unregisterObject(CGameHandler *ptr) { sgxTrace("Please use 'unregisterScenarioObject' versions"); return unregisterScenarioObject(ptr); }

	virtual tBOOL	registerGlobalObject(CGameHandler *ptr);
	virtual tBOOL	unregisterGlobalObject(CGameHandler *ptr);
	virtual void	unregisterGlobalObjects();

	virtual tBOOL	registerScenarioObject(CGameHandler *ptr);
	virtual tBOOL	unregisterScenarioObject(CGameHandler *ptr);
	virtual void	unregisterScenarioObjects();

	virtual void	unregisterAllObjects();

	virtual void	initialize();
	virtual void	suspend(const tUINT32 frames=2);
	virtual void	resume();
	virtual void	release();

	virtual tBOOL	isSuspended();

	virtual void	releaseScenarioObjects();
	virtual void	releaseGlobalObjects();

	virtual void	preUpdate(const tREAL32 t);
	virtual void	update(const tREAL32 t);
	virtual void	postUpdate(const tREAL32 t);

	virtual void	preDraw() const;
	virtual void	draw() const;
	virtual void	postDraw() const;

protected:
	sgxVector<CGameHandler *>	m_ScenarioObjects;
	sgxVector<CGameHandler *>	m_GlobalObjects;

	tUINT32						m_SuspendCount;
};


#endif /* #define SGX_GAMECODE_BASE_ENGINE_HPP */
