home *** CD-ROM | disk | FTP | other *** search
- /*
- Company: Sensaura
- Copyright: (C) 1998
-
- File Name: directx.h
- File Description: Header file for declaration of DirectX macros and error handling functions
- Author: Adam Philp
- File Version: 1.01.000
- Last Update: 27-OCT-98
-
- Target Compiler: Microsoft Visual C++ Version 5.0
- */
-
- #ifndef __directx_h // Sentry, use file only if it's not already included
- #define __directx_h
-
- /////////////////////// Included files ////////////////////////////////////////////////////////////
-
- #include <d3dtypes.h>
- #include <dsound.h>
-
- /////////////////////// Macro definitions /////////////////////////////////////////////////////////
-
- #define TRY_DD(exp) { g_hrDD = exp; if (g_hrDD != DD_OK) { DX_ERROR(g_hrDD) goto DD_ERROR; }}
- #define TRY_D3D(exp) { g_hrD3D = exp; if (g_hrD3D != D3D_OK) { DX_ERROR(g_hrD3D) goto D3D_ERROR; }}
- #define TRY_D3DRM(exp) { g_hrD3DRM = exp; if (g_hrD3DRM != D3DRM_OK) { DX_ERROR(g_hrD3DRM) goto D3DRM_ERROR; }}
- #define TRY_DS(exp) { g_hrDS = exp; if (g_hrDS != DS_OK) { DX_ERROR(g_hrDS) goto DS_ERROR; }}
- #define TRY_DI(exp) { g_hrDI = exp; if (g_hrDI != DI_OK) { DX_ERROR(g_hrDI) goto DI_ERROR; }}
-
- #define DX_ERROR(exp) { DirectXErrorMessageBox(exp); }
- #define RELEASE(lpUnk) { if (lpUnk != NULL) { lpUnk->Release(); lpUnk = NULL; }}
-
- /////////////////////// Global variable declarations //////////////////////////////////////////////
-
- extern HRESULT g_hrDD; // DirectDraw errors
- extern HRESULT g_hrD3DRM; // Direct3DRM errors
- extern HRESULT g_hrD3D; // Direct3D errors
- extern HRESULT g_hrDS; // DirectSound errors
- extern HRESULT g_hrDI; // DirectInput errors
-
- /////////////////////// Global Function declarations //////////////////////////////////////////////
-
- void DirectXErrorMessageBox(HRESULT);
- bool DirectXOK();
- D3DVALUE RandomD3DVALUE(double, double);
- LPDIRECTSOUNDBUFFER CreateDSBufferFromResource(LPDIRECTSOUND, DWORD, LPCTSTR);
-
- #endif // End of sentry __directx_h
-