////////////////////////////////////////////////////////////////////////////////
// Graphics.h
//
//  DirectX Graphics handling code

#ifndef __GRAPHICS_H__
#define __GRAPHICS_H__

// Application-specific
extern  HWND    hWndMain;

BOOL InitDirectXGraphics();
void ExitDirectXGraphics();
void BeginScene();
void EndScene();
void Flip();

//Create the initial object buffers
BOOL SetObjectBufferSize(UINT nBufferSize);
//Release the object buffers
void ReleaseObjectBuffer();
//Initialise an object in the buffer
int CreateRectangularObject(int x, int y, int cx, int cy,
                            IDirect3DTexture8 *pTexture, int xSrc, int ySrc);
//Move a previously created object
BOOL MoveObject(int nIndex, int x, int y);
//Set the texture of an object
BOOL SetObjectTexture(int nIndex, IDirect3DTexture8 *pTexture);
//Create the vertex buffer which holds the sprite co-ordinates
BOOL CreateVertexBuffer();
//Refresh the vertex buffer co-ordinates
BOOL RefreshVertexBuffer();
//Release the vertex buffer
void ReleaseVertexBuffer();
void BeginDrawingObjects();
void DrawObject(int nIndex);
IDirect3DTexture8 *LoadTexture(LPCTSTR lpFilename);
BOOL InitDevice(BOOL bFullScreen);
void CloseDevice();

extern  IDirect3D8          *g_pD3D;
extern  IDirect3DDevice8    *g_pd3dDevice;

#endif