#ifndef cGameApp_H
#define cGameApp_H

#include <windows.h>
#include <ddraw.h>

const int SPRITE_COUNT = 2;

class cGameApp{
protected:
	HINSTANCE hInstance; // 인스턴스 핸들
	HWND hWnd; // 애플리케이션 윈도우 핸들

	LPDIRECTDRAW pDD;
	LPDIRECTDRAWSURFACE pDDSFront;
	LPDIRECTDRAWSURFACE pDDSBack;
	LPDIRECTDRAWCLIPPER pDDClipper;

	LPDIRECTDRAWSURFACE pDDSSprites[SPRITE_COUNT]; // 스프라이트의 이미지를 저장
	int SpriteAdjust[SPRITE_COUNT][2];
	
	int xPos; //  그림의 위치를 저장할 변수
	int SpriteNo;

	bool OpenApp();
	void CloseApp();
	int MessageLoop();

	bool LoadSprites();
	void ReleaseSprites();

	// 윈도우 메시지 핸들러
	static LRESULT CALLBACK StaticWndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
	LRESULT WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
	bool OnCreate(WPARAM wParam, LPARAM lParam);
	void OnDestroy(WPARAM wParam, LPARAM lParam);
	void OnPaint(WPARAM wParam, LPARAM lParam);
	void OnTimer(WPARAM wParam, LPARAM lParam);

public:

	cGameApp();
	virtual ~cGameApp();

	int Main(HINSTANCE _hInstance, LPSTR lpCmdLine, int nShowCmd);

	HWND GetWindow(){ return hWnd; }
	HINSTANCE GetInstance(){ return hInstance; }


};

#endif
