view LightClone/Source/GraphicsDevice.h @ 63:44dcff5abf12

Work on ServiceProvider
author koryspansel
date Tue, 04 Oct 2011 12:04:09 -0700
parents 06b151afc8d0
children
line wrap: on
line source

/*
 * GraphicsDevice
 */

#ifndef __GRAPHICSDEVICE_H__
#define __GRAPHICSDEVICE_H__

#include "Core.h"

/*
 * GraphicsDevice
 */
class GraphicsDevice
{
	/*
	 * pDirect3D
	 */
	IDirect3D9* pDirect3D;

	/*
	 * pDevice
	 */
	IDirect3DDevice9* pDevice;

	/*
	 * kParameters
	 */
	D3DPRESENT_PARAMETERS kParameters;

	/*
	 * GraphicsDevice
	 */
	GraphicsDevice(IDirect3D9* pContext, IDirect3DDevice9* pInstance, const D3DPRESENT_PARAMETERS& kPresentParameters);

public:

	/*
	 * ~GraphicsDevice
	 */
	~GraphicsDevice();

	/*
	 * Create
	 */
	static ErrorCode Create(HWND kWindow, uint32 nWidth, uint32 nHeight, GraphicsDevice** pDevice);

	/*
	 * Destroy
	 */
	static void Destroy(GraphicsDevice*& pDevice);

	/*
	 * SetViewport
	 */
	ErrorCode SetViewport(const D3DVIEWPORT9& kViewport);

	/*
	 * GetViewport
	 */
	ErrorCode GetViewport(D3DVIEWPORT9* pViewport);

	/*
	 * Begin
	 */
	void Begin(uint32 nColor = 0, float fDepth = 1.0f, uint32 nStencil = 0);

	/*
	 * End
	 */
	void End();

	/*
	 * DrawTriangles
	 */
	void DrawTriangles(IDirect3DVertexDeclaration9* pDeclaration, IDirect3DVertexBuffer9* pBuffer, uint32 nSize, uint32 nCount);

	/*
	 * operator IDirect3DDevice9*
	 */
	operator IDirect3DDevice9*()
	{
		return pDevice;
	}
};

#endif //__GRAPHICSDEVICE_H__