home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / VMRXcl / DDrawSupport.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  1.8 KB  |  69 lines

  1. //----------------------------------------------------------------------------
  2. //  File:   DDrawSupport.h
  3. //
  4. //  Desc:   DirectShow sample code
  5. //          Prototype of DDrawObject that provides basic DDraw functionality
  6. //
  7. //  Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
  8. //----------------------------------------------------------------------------
  9.  
  10. #ifndef DDRAWSUPPORT_HEADER
  11. #define DDRAWSUPPORT_HEADER
  12.  
  13. #ifndef __RELEASE_DEFINED
  14. #define __RELEASE_DEFINED
  15.  
  16. template<typename T>
  17. __inline void RELEASE( T* &p )
  18. {
  19.     if( p ) {
  20.         p->Release();
  21.         p = NULL;
  22.     }
  23. }
  24. #endif
  25.  
  26. #ifndef CHECK_HR
  27.     #define CHECK_HR(expr) if (FAILED(expr)) {\
  28.         DbgLog((LOG_ERROR, 0, \
  29.                 TEXT("FAILED: %s\nat Line:%d of %s"), \
  30.                 TEXT(#expr), __LINE__, TEXT(__FILE__) ));__leave; } else
  31. #endif
  32.  
  33.  
  34. #define SCRN_WIDTH      640
  35. #define SCRN_HEIGHT     480
  36. #define SCRN_BITDEPTH   32
  37.  
  38. //----------------------------------------------------------------------------
  39. //  CDDrawObject
  40. //
  41. //  Class provides basic DDraw functionality
  42. //----------------------------------------------------------------------------
  43. class CDDrawObject {
  44.  
  45. public:
  46.     CDDrawObject() :
  47.         m_hwndApp(NULL),
  48.         m_pDDObject(NULL),
  49.         m_pPrimary(NULL),
  50.         m_pBackBuff(NULL)
  51.     {
  52.         ZeroMemory(&m_RectScrn, sizeof(m_RectScrn));
  53.     }
  54.  
  55.     HRESULT Initialize(HWND hwndApp);
  56.     HRESULT Terminate();
  57.     LPDIRECTDRAW7 GetDDObj() {return m_pDDObject;};
  58.     LPDIRECTDRAWSURFACE7 GetFB() {return m_pPrimary;};
  59.     LPDIRECTDRAWSURFACE7 GetBB() {return m_pBackBuff;};
  60.  
  61. private:
  62.     HWND                    m_hwndApp;
  63.     RECT                    m_RectScrn;
  64.     LPDIRECTDRAW7           m_pDDObject;
  65.     LPDIRECTDRAWSURFACE7    m_pPrimary;
  66.     LPDIRECTDRAWSURFACE7    m_pBackBuff;
  67. };
  68.  
  69. #endif