home *** CD-ROM | disk | FTP | other *** search
/ Game Audio Programming / GameAudioProgramming.iso / Extras / Sensaura / SDK1.0 / data1.cab / Example_Files / DS3DDemo / Source / directx.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-13  |  2.0 KB  |  49 lines

  1. /*
  2.     Company:            Sensaura
  3.     Copyright:          (C) 1998
  4.  
  5.     File Name:            directx.h
  6.     File Description:    Header file for declaration of DirectX macros and error handling functions
  7.     Author:                Adam Philp
  8.     File Version:        1.01.000
  9.     Last Update:        27-OCT-98
  10.  
  11.     Target Compiler:    Microsoft Visual C++ Version 5.0
  12. */
  13.  
  14. #ifndef __directx_h                        // Sentry, use file only if it's not already included
  15. #define __directx_h
  16.  
  17. /////////////////////// Included files ////////////////////////////////////////////////////////////
  18.  
  19. #include <d3dtypes.h>
  20. #include <dsound.h>
  21.  
  22. /////////////////////// Macro definitions /////////////////////////////////////////////////////////
  23.  
  24. #define TRY_DD(exp)        { g_hrDD = exp; if (g_hrDD != DD_OK) { DX_ERROR(g_hrDD) goto DD_ERROR; }}
  25. #define TRY_D3D(exp)    { g_hrD3D = exp; if (g_hrD3D != D3D_OK) { DX_ERROR(g_hrD3D) goto D3D_ERROR; }}
  26. #define TRY_D3DRM(exp)    { g_hrD3DRM = exp; if (g_hrD3DRM != D3DRM_OK) { DX_ERROR(g_hrD3DRM) goto D3DRM_ERROR; }}
  27. #define TRY_DS(exp)        { g_hrDS = exp; if (g_hrDS != DS_OK) { DX_ERROR(g_hrDS) goto DS_ERROR; }}
  28. #define TRY_DI(exp)        { g_hrDI = exp; if (g_hrDI != DI_OK) { DX_ERROR(g_hrDI) goto DI_ERROR; }}
  29.  
  30. #define DX_ERROR(exp)    { DirectXErrorMessageBox(exp); }
  31. #define RELEASE(lpUnk)    { if (lpUnk != NULL) { lpUnk->Release(); lpUnk = NULL; }}
  32.  
  33. /////////////////////// Global variable declarations //////////////////////////////////////////////
  34.  
  35. extern HRESULT g_hrDD;                    // DirectDraw errors
  36. extern HRESULT g_hrD3DRM;                // Direct3DRM errors    
  37. extern HRESULT g_hrD3D;                    // Direct3D errors    
  38. extern HRESULT g_hrDS;                    // DirectSound errors
  39. extern HRESULT g_hrDI;                    // DirectInput errors
  40.  
  41. ///////////////////////    Global Function declarations //////////////////////////////////////////////
  42.  
  43. void DirectXErrorMessageBox(HRESULT);
  44. bool DirectXOK();
  45. D3DVALUE RandomD3DVALUE(double, double);
  46. LPDIRECTSOUNDBUFFER CreateDSBufferFromResource(LPDIRECTSOUND, DWORD, LPCTSTR);
  47.  
  48. #endif                                    // End of sentry __directx_h
  49.