#pragma once

#define _WIN32_WINNT 0x0500
#define _WIN32_WINDOWS 0x0400

#include <windows.h>
#include <mmsystem.h>

#include "Rune Engine/Rune/Rune.h"						// 3D引擎
#include "Rune Engine/Rune/Rune Engine Audio.h"
#include "Rune Engine/Rune/Rune Engine D3D.h"
#include "Rune Engine/Rune/Script/RuScript_LuaIntegration.h"
#include "Rune Engine/DirectInput/directinput.h"		// 輸入裝置
#include "Rune Engine/texture/textureimage.h"

#include "sprite/sprite.h"							// 角色,特效
#include <dxtlib/dxtlib.h> 

class CGraphic;
extern CGraphic*					g_pGraphic;

#define SAFE_DELETE(p)			if (p) { delete p; p=NULL; }

class CGraphic
{
public:
	CGraphic();
	virtual ~CGraphic();

	virtual	bool				RuneDevInitialize(HWND hWnd, bool isWindowed , const char* ResourcePathStr );
	virtual	void				SetScreenSize(int width, int height, bool isWindowed);
	virtual	void				SetResourcePath(const char* pathStr);
	virtual	const char*			GetFullFilePath(const char* fileStr);
	virtual	void				SetTextureImageFile(const char* filename);
	virtual	void				Update();

	virtual	CRuCamera*			GetCamera()								{ return m_pCamera; }
	virtual void				IsShowGrid( bool Value )				{ m_IsShowGrid = Value; };

protected:
	virtual	CRuFrame*			CreateLightingProp();

protected:	
	HWND						m_hWnd;
	int							m_width;
	int							m_height;
	float						m_fps;
	float						m_frameTime;
	float						m_elapsedTime;
	char						m_resourcePath[MAX_PATH];
	bool						m_IsShowGrid;

	IRuSwapChain*				m_pRuSwapChain;
	CRuPerformanceTimer*		m_pRuTimer;
	CRuFrame*					m_pRuLightingTree;
	CRuCamera*					m_pCamera;
	CRuEntity_Widget_Grid*		m_pRuWidgetGrid;
	CRuFontType*				m_pSystemFont;
	CTextureImage*				m_pTexture;
};