#pragma once
#include <d3d9.h>
#include <d3dx9.h>
#include <dinput.h>

#include "Direct3D.h"
#include "3DObject.h"
#include "Fighter.h"
#include "Explosion.h"
#include "Ground.h"
#include "Cube.h"
#include "Camera.h"
#include "GameEngine.h"

#define  SAMPLE_BUFFER_SIZE  16
#define  IDT_KeyboardTimer WM_APP + 1

//Game States
#define GS_FLIGHT 1
#define GS_EXPLODING 2
#define GS_STOP 3
#define GS_SPLASH 4

class CGameDemoEngine : CGameEngine
{
	CFighter   *Fighter;
	CGround    *Ground;
	CCamera    *Camera;
	CExplosion *Explosion;
	CDirect3D  *d3d;

	int GameState;

	LPDIRECTINPUT8          g_pDI;
	LPDIRECTINPUTDEVICE8    g_pKeyboard;

	LPD3DXSPRITE	   g_Cursor;
	LPDIRECT3DTEXTURE9 g_CursorTexture;
	LPDIRECT3DTEXTURE9 g_pSplashTexture;
    LPDIRECT3DVERTEXBUFFER9 m_pViewportVB;
	int			       xPos, yPos;
private:
	void loadTexture( CDirect3D *d3d );

public:
	CGameDemoEngine(CDirect3D *d3d);

	virtual int ProcessMessage( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
	virtual void RenderScene(CDirect3D *d3d);
	void RenderSplash(CDirect3D *d3d);
	void StartGame();
	virtual ~CGameDemoEngine( void );

	HRESULT ReadKeyboardInput();
};
