#include "RuScaleform.h"

#include "RuScaleformDriver_D3D9.h"
#include "RuScaleformEngine_Core.h"

#pragma managed(push, off)

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

ruRTTI_DEFINE_SUBCLASS(CRuScaleform, IRuObject)
ruHEAP_DEFINE_SUBCLASS(CRuScaleform, "CRuScaleform", "IRuObject")
ruCLASSGUID_DEFINE(CRuScaleform, 0x69288BFA, 0x2EBB42cf, 0xAF71FB90, 0xB8DA06B2)

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

CRuScaleform::CRuScaleform()
:	m_driver(NULL)
{
}

CRuScaleform::~CRuScaleform()
{
	ruSAFE_RELEASE(m_driver);
}

BOOL CRuScaleform::Initialize(RuScaleformRendererType rendererType)
{
	BOOL driverAvailable = FALSE;

	switch(rendererType)
	{
		case CRuScaleform::ruRENDERERTYPE_D3D9:
			{
				m_driver = ruNEW CRuScaleformDriver_D3D9();
				driverAvailable = TRUE;
			}

			break;
	}

	if(driverAvailable)
	{
		m_engine = ruNEW CRuScaleformEngine();
		m_engine->Initialize(m_driver);
	}

	return driverAvailable;
}

IRuScaleformDriver *CRuScaleform::GetDriver()
{
	return m_driver;
}

IRuScaleformEngine *CRuScaleform::GetEngine()
{
	return m_engine;
}

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

#pragma managed(pop)
