/** 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/layer_engine.hpp

*/

#ifndef SGX_GAMECODE_LAYER_ENGINE_HPP
#define SGX_GAMECODE_LAYER_ENGINE_HPP	1

class sgxLayer;

class CSGXLayerEngine : public CSGXBaseEngine {
public:
	typedef tINT32 tDepth;

	const static tINT32	eBackground = -32768;
	const static tINT32	eDefault = -32768;
	const static tINT32	eForeground = -32768;

	CSGXLayerEngine();

	void		draw() const;

	sgxLayer *	getLayer(tDepth depth);
	sgxLayer *	createLayer(tDepth depth);
	void		removeLayer(sgxLayer *pLayer);

	tBOOL		addObject(const CGameHandler *pObj, tDepth depth);
	void		removeObject(const CGameHandler *pObj);

	void		reorderObject(const CGameHandler *pObject, tDepth depth);
	void		reorderLayer(sgxLayer *pLayer, tDepth depth);

protected:
	sgxVector<sgxLayer *>		m_LayerList;
	tBOOL						m_bReverseRender;
	
};


class sgxLayer {
public:
	tBOOL							addObject(const CGameHandler *pObj);
	void							removeObject(const CGameHandler *pObj);
	
	void							draw() const;

protected:
	sgxLayer(CSGXLayerEngine::tDepth = CSGXLayerEngine::eDefault);

	sgxVector<const CGameHandler *>	m_ObjectList;
	CSGXLayerEngine::tDepth			m_Depth;

	friend class CSGXLayerEngine;
};

#endif /* #define SGX_GAMECODE_LAYER_ENGINE_HPP */

