#pragma once

// Base driver interface
#include "RuScaleformDriver_Base.h"

// Scaleform GFx Headers
#include "GTimer.h"
#include "GFxEvent.h"
#include "GFxPlayer.h"
#include "GFxFontLib.h"
#include "GFxDrawText.h"
#include "GFxFontProviderWin32.h"
#include "GRendererD3D9.h"

#pragma managed(push, off)

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

class CRuScaleformDriver_D3D9 : public IRuScaleformDriver
{
	ruRTTI_DECLARE
	ruHEAP_DECLARE
	ruCLASSGUID_DECLARE

protected:
	GFxSystem									m_gfxSystem;				//!< NOTE: This must be declared and in-scope before ANYTHING from GFx runs
	GFxLoader									m_loader;
	GPtr<GRendererD3D9>							m_renderer;
	GPtr<GFxRenderConfig>						m_renderConfig;

	IRuEngine*									m_engine;

public:
												CRuScaleformDriver_D3D9();
	virtual										~CRuScaleformDriver_D3D9();

	virtual BOOL								AttachToEngine(IRuEngine *engine);
	
	virtual BOOL								ClearEngineStates();

	virtual GFxLoader*							GetLoader();
	virtual GRenderer*							GetRenderer();
	virtual CRuRectangle						GetViewportRect();

protected:
	BOOL										DeviceResetHandler(RuEventArgs *eventArgs);
	BOOL										DeviceRestoreHandler(RuEventArgs *eventArgs);
};

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

#pragma managed(pop)
