/*
	다이렉트 드로우를 이용하여 디스플레이를 추상화 한다.
*/
#ifndef cDisplay_H
#define cDisplay_H

#include "cPicture.h"

class cDisplay{
private:
protected:
	LPDIRECTDRAW pDD;

	LPDIRECTDRAWCLIPPER pDDClipper;
	LPDIRECTDRAWPALETTE pDDPalette;
	PALETTEENTRY PaletteEntry[256];
	
	HWND hWnd;

	DWORD CooperativeLevel;

	cPicture FrontPic;
	cPicture BackPic;


	bool CreateClipper();
	void DestroyClipper();

	bool CreatePalette();
	void DestroyPalette();

public:
	cDisplay();
	virtual ~cDisplay();

	bool Create(HWND _hWnd);
	void Destroy();

	bool SetCooperativeLevel(DWORD Mode);

	bool CreateDoubleBuffer();
	void DestroyDoubleBuffer();

	bool SetDisplayMode(DWORD Width, DWORD Height, DWORD BPP);
	bool RestoreDisplayMode();

	cPicture *GetFrontPic(){ return &FrontPic; }
	cPicture *GetBackPic(){ return &BackPic; }

	LPDIRECTDRAWCLIPPER GetClipper(){ return pDDClipper; }

	// 다이렉트 드로우의 포인터를 직접 제공한다.
	operator LPDIRECTDRAW(){ return pDD; }
		

};

#endif
