home *** CD-ROM | disk | FTP | other *** search
/ Beginning Direct3D Game Programming / Direct3D.iso / directx / dxf / include / ddrawex.h < prev    next >
C/C++ Source or Header  |  2000-09-21  |  10KB  |  219 lines

  1. //*********************************************************************
  2. //*                  Microsoft Windows                               **
  3. //*            Copyright(c) Microsoft Corp., 1995-1997               **
  4. //*********************************************************************
  5. //
  6. //    DDRAWEX.H 
  7. //
  8. //    Header file for DirectDrawEx functionality
  9.  
  10. #ifndef __DDRAWEXH__
  11. #define __DDRAWEXH__
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17. #include <ddraw.h>
  18.  
  19. // {4FD2A832-86C8-11d0-8FCA-00C04FD9189D}
  20. DEFINE_GUID(CLSID_DirectDrawFactory, 
  21. 0x4fd2a832, 0x86c8, 0x11d0, 0x8f, 0xca, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);
  22.  
  23. DEFINE_GUID(IID_IDirectDrawFactory, 
  24. 0x4fd2a833, 0x86c8, 0x11d0, 0x8f, 0xca, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);
  25.  
  26. #ifndef DIRECTDRAW_VERSION
  27.  
  28. //Functionality supported by DDrawex but not DX3
  29. #define DDSD_LPSURFACE        0x00000800l
  30.  
  31. DEFINE_GUID( IID_IDirectDrawSurface3,
  32. 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB );
  33.  
  34. typedef struct IDirectDrawSurface3        FAR *LPDIRECTDRAWSURFACE3;
  35.  
  36. #undef INTERFACE
  37. #define INTERFACE IDirectDrawSurface3
  38. DECLARE_INTERFACE_( IDirectDrawSurface3, IUnknown )
  39. {
  40.     /*** IUnknown methods ***/
  41.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
  42.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  43.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  44.     /*** IDirectDrawSurface methods ***/
  45.     STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE3) PURE;
  46.     STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE;
  47.     STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE3, LPRECT,DWORD, LPDDBLTFX) PURE;
  48.     STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE;
  49.     STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE3, LPRECT,DWORD) PURE;
  50.     STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE3) PURE;
  51.     STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE;
  52.     STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE;
  53.     STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE3, DWORD) PURE;
  54.     STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE3 FAR *) PURE;
  55.     STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE;
  56.     STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE;
  57.     STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE;
  58.     STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE;
  59.     STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE;
  60.     STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE;
  61.     STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE;
  62.     STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE;
  63.     STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE;
  64.     STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE;
  65.     STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE;
  66.     STDMETHOD(IsLost)(THIS) PURE;
  67.     STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE;
  68.     STDMETHOD(ReleaseDC)(THIS_ HDC) PURE;
  69.     STDMETHOD(Restore)(THIS) PURE;
  70.     STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE;
  71.     STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE;
  72.     STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE;
  73.     STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE;
  74.     STDMETHOD(Unlock)(THIS_ LPVOID) PURE;
  75.     STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX) PURE;
  76.     STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE;
  77.     STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE3) PURE;
  78.     /*** Added in the v2 interface ***/
  79.     STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE;
  80.     STDMETHOD(PageLock)(THIS_ DWORD) PURE;
  81.     STDMETHOD(PageUnlock)(THIS_ DWORD) PURE;
  82.     /*** Added in the v3 interface ***/
  83.     STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC, DWORD ) PURE;
  84. };
  85. #endif
  86.  
  87.  
  88.  
  89.  
  90. #define    DDSCAPS_DATAEXCHANGE    (DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY)
  91.  
  92. #undef    INTERFACE
  93. #define INTERFACE IDirectDrawFactory
  94.  
  95. DECLARE_INTERFACE_(IDirectDrawFactory, IUnknown)
  96. {
  97.     /*** IUnknown methods ***/
  98.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
  99.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  100.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  101.     /*** IDirectDrawFactory methods ***/
  102.     STDMETHOD(CreateDirectDraw) (THIS_ GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter, IDirectDraw **ppDirectDraw) PURE;
  103.     STDMETHOD(DirectDrawEnumerate) (THIS_ LPDDENUMCALLBACK lpCallback, LPVOID lpContext) PURE;
  104. };
  105.  
  106.  
  107.  
  108. // {618F8AD4-8B7A-11d0-8FCC-00C04FD9189D}
  109. DEFINE_GUID(IID_IDirectDraw3, 
  110. 0x618f8ad4, 0x8b7a, 0x11d0, 0x8f, 0xcc, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);
  111.  
  112. typedef struct IDirectDraw3        FAR *LPDIRECTDRAW3;
  113.  
  114. #undef    INTERFACE
  115. #define INTERFACE IDirectDraw3
  116.  
  117. DECLARE_INTERFACE_(IDirectDraw3, IUnknown)
  118. {
  119.     /*** IUnknown methods ***/
  120.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
  121.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  122.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  123.     /*** IDirectDraw methods ***/
  124.     STDMETHOD(Compact)(THIS) PURE;
  125.     STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
  126.     STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
  127.     STDMETHOD(CreateSurface)(THIS_  LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
  128.     STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE;
  129.     STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE;
  130.     STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE;
  131.     STDMETHOD(FlipToGDISurface)(THIS) PURE;
  132.     STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE;
  133.     STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE;
  134.     STDMETHOD(GetFourCCCodes)(THIS_  LPDWORD, LPDWORD ) PURE;
  135.     STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE;
  136.     STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE;
  137.     STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE;
  138.     STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE;
  139.     STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE;
  140.     STDMETHOD(RestoreDisplayMode)(THIS) PURE;
  141.     STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE;
  142.     STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE;
  143.     STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE;
  144.     /*** Added in the v2 interface ***/
  145.     STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE;
  146.     /*** IDirectDraw3 methods ***/
  147.     STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, IDirectDrawSurface **) PURE;
  148. };
  149.  
  150. #if !defined(__cplusplus) || defined(CINTERFACE)
  151. #define IDirectDraw3_QueryInterface(p, a, b)         (p)->lpVtbl->QueryInterface(p, a, b)
  152. #define IDirectDraw3_AddRef(p)                       (p)->lpVtbl->AddRef(p)
  153. #define IDirectDraw3_Release(p)                      (p)->lpVtbl->Release(p)
  154. #define IDirectDraw3_Compact(p)                      (p)->lpVtbl->Compact(p)
  155. #define IDirectDraw3_CreateClipper(p, a, b, c)       (p)->lpVtbl->CreateClipper(p, a, b, c)
  156. #define IDirectDraw3_CreatePalette(p, a, b, c, d)    (p)->lpVtbl->CreatePalette(p, a, b, c, d)
  157. #define IDirectDraw3_CreateSurface(p, a, b, c)       (p)->lpVtbl->CreateSurface(p, a, b, c)
  158. #define IDirectDraw3_DuplicateSurface(p, a, b)       (p)->lpVtbl->DuplicateSurface(p, a, b)
  159. #define IDirectDraw3_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d)
  160. #define IDirectDraw3_EnumSurfaces(p, a, b, c, d)     (p)->lpVtbl->EnumSurfaces(p, a, b, c, d)
  161. #define IDirectDraw3_FlipToGDISurface(p)             (p)->lpVtbl->FlipToGDISurface(p)
  162. #define IDirectDraw3_GetCaps(p, a, b)                (p)->lpVtbl->GetCaps(p, a, b)
  163. #define IDirectDraw3_GetDisplayMode(p, a)            (p)->lpVtbl->GetDisplayMode(p, a)
  164. #define IDirectDraw3_GetFourCCCodes(p, a, b)         (p)->lpVtbl->GetFourCCCodes(p, a, b)
  165. #define IDirectDraw3_GetGDISurface(p, a)             (p)->lpVtbl->GetGDISurface(p, a)
  166. #define IDirectDraw3_GetMonitorFrequency(p, a)       (p)->lpVtbl->GetMonitorFrequency(p, a)
  167. #define IDirectDraw3_GetScanLine(p, a)               (p)->lpVtbl->GetScanLine(p, a)
  168. #define IDirectDraw3_GetVerticalBlankStatus(p, a)    (p)->lpVtbl->GetVerticalBlankStatus(p, a)
  169. #define IDirectDraw3_Initialize(p, a)                (p)->lpVtbl->Initialize(p, a)
  170. #define IDirectDraw3_RestoreDisplayMode(p)           (p)->lpVtbl->RestoreDisplayMode(p)
  171. #define IDirectDraw3_SetCooperativeLevel(p, a, b)    (p)->lpVtbl->SetCooperativeLevel(p, a, b)
  172. #define IDirectDraw3_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e)
  173. #define IDirectDraw3_WaitForVerticalBlank(p, a, b)   (p)->lpVtbl->WaitForVerticalBlank(p, a, b)
  174. #define IDirectDraw3_GetAvailableVidMem(p, a, b, c)  (p)->lpVtbl->GetAvailableVidMem(p, a, b, c)
  175. #define IDirectDraw3_GetSurfaceFromDC(p, a, b)       (p)->lpVtbl->GetSurfaceFromDC(p, a, b)
  176. #endif
  177.  
  178.  
  179.  
  180. /*===========================================================================
  181.  *
  182.  *
  183.  * DIRECTDRAWEX RETURN CODES
  184.  *
  185.  * The return values from DirectDrawEx Commands and Surface that return an
  186.  * HRESULT are codes from DirectDrawEx concerning the results of the action
  187.  * requested by DirectDrawEx.
  188.  *
  189.  *==========================================================================*/
  190.  
  191. /*
  192.  * An attempt was made to load ddraw.dll
  193.  */
  194. #define DDERR_LOADFAILED                        MAKE_DDHRESULT( 901 )
  195.  
  196. /*
  197.  * Unable to determine module/os version number
  198.  */
  199. #define DDERR_BADVERSIONINFO                    MAKE_DDHRESULT( 902 )
  200.  
  201. /*
  202.  * Unable to determine address of ddraw.dll exported symbol (DirectDrawCreate or
  203.  * DirectDrawEnumerate).
  204.  */
  205. #define DDERR_BADPROCADDRESS                    MAKE_DDHRESULT( 903 )
  206.  
  207. /*
  208.  * Legacy usage: do not use QI() to create D3D device objects from surface objects.  
  209.  * Use IDirect3D2::CreateDevice()
  210.  */
  211. #define DDERR_LEGACYUSAGE                       MAKE_DDHRESULT( 904 )
  212.  
  213. #ifdef __cplusplus
  214. }
  215. #endif
  216.  
  217.  
  218. #endif // __DDRAWEXH__
  219.