⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 directdraw.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    guidDeviceIdentifier : TGUID;

    (*
     * This element is used to determine the Windows Hardware Quality Lab (WHQL)
     * certification level for this driver/device pair.
     *)
    dwWHQLLevel : LongWord;
  end;

(*
 * callbacks
 *)
  TClipperCallback = function(lpDDClipper : IDirectDrawClipper; hWnd : HWND; Code : LongWord; lpContext : Pointer) : HResult; stdcall;
  TSurfacesStreamingCallback = function(Arg : LongWord) : HResult; stdcall;

(*
 * TDDSurfaceDesc
 *)
  PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
  TDDSurfaceDesc_DX5 = packed record
    dwSize   : LongWord;                  // size of the TDDSurfaceDesc structure
    dwFlags  : LongWord;                  // determines what fields are valid
    dwHeight : LongWord;                  // height of surface to be created
    dwWidth  : LongWord;                  // width of input surface
    case Integer of
    0: (
      dwLinearSize : LongWord;            // unused at the moment
     );
    1: (
      lPitch            : LongInt;        // distance to start of next line (return value only)
      dwBackBufferCount : LongWord;       // number of back buffers requested
      case Integer of
      0: (
        dwMipMapCount     : LongWord;     // number of mip-map levels requested
        dwAlphaBitDepth   : LongWord;     // depth of alpha buffer requested
        dwReserved        : LongWord;     // reserved
        lpSurface         : Pointer;      // pointer to the associated surface memory
        ddckCKDestOverlay : TDDColorKey;  // color key for destination overlay use
        ddckCKDestBlt     : TDDColorKey;  // color key for destination blt use
        ddckCKSrcOverlay  : TDDColorKey;  // color key for source overlay use
        ddckCKSrcBlt      : TDDColorKey;  // color key for source blt use
        ddpfPixelFormat   : TDDPixelFormat_DX5; // pixel format description of the surface
        ddsCaps           : TDDSCaps;     // direct draw surface capabilities
       );
      1: (
        dwZBufferBitDepth : LongWord;     // depth of Z buffer requested
       );
      2: (
        dwRefreshRate : LongWord;         // refresh rate (used when display mode is described)
       );
     );
  end;

  PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
  TDDSurfaceDesc_DX6 = packed record
    dwSize   : LongWord;                   // size of the TDDSurfaceDesc structure
    dwFlags  : LongWord;                   // determines what fields are valid
    dwHeight : LongWord;                   // height of surface to be created
    dwWidth  : LongWord;                   // width of input surface
    case Integer of
    0: (
      dwLinearSize : LongWord;             // unused at the moment
     );
    1: (
      lPitch            : LongInt;         // distance to start of next line (return value only)
      dwBackBufferCount : LongWord;        // number of back buffers requested
      case Integer of
      0: (
        dwMipMapCount     : LongWord;      // number of mip-map levels requested
        dwAlphaBitDepth   : LongWord;      // depth of alpha buffer requested
        dwReserved        : LongWord;      // reserved
        lpSurface         : Pointer;       // pointer to the associated surface memory
        ddckCKDestOverlay : TDDColorKey;   // color key for destination overlay use
        ddckCKDestBlt     : TDDColorKey;   // color key for destination blt use
        ddckCKSrcOverlay  : TDDColorKey;   // color key for source overlay use
        ddckCKSrcBlt      : TDDColorKey;   // color key for source blt use
        ddpfPixelFormat   : TDDPixelFormat_DX6; // pixel format description of the surface
        ddsCaps           : TDDSCaps;      // direct draw surface capabilities
       );
      1: (
        dwZBufferBitDepth : LongWord;      // depth of Z buffer requested
       );
      2: (
        dwRefreshRate : LongWord;          // refresh rate (used when display mode is described)
       );
     );
  end;

  PDDSurfaceDesc = ^TDDSurfaceDesc;
{$IFDEF DIRECTX5}
  TDDSurfaceDesc = TDDSurfaceDesc_DX5;
{$ELSE}
  TDDSurfaceDesc = TDDSurfaceDesc_DX6;
{$ENDIF}


(*
 * TDDSurfaceDesc2
 *)
  PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  TDDSurfaceDesc2 = packed record            
    dwSize   : LongWord;                     // size of the TDDSurfaceDesc structure
    dwFlags  : LongWord;                     // determines what fields are valid
    dwHeight : LongWord;                     // height of surface to be created
    dwWidth  : LongWord;                     // width of input surface
    case Integer of
    0: (
      lPitch : LongInt;                      // distance to start of next line (return value only)
     );
    1: (
      dwLinearSize      : LongWord;          // Formless late-allocated optimized surface size
      dwBackBufferCount : LongWord;          // number of back buffers requested
      case Integer of
      0: (
        dwMipMapCount     : LongWord;        // number of mip-map levels requested
        dwAlphaBitDepth   : LongWord;        // depth of alpha buffer requested
        dwReserved        : LongWord;        // reserved
        lpSurface         : Pointer;         // pointer to the associated surface memory
        ddckCKDestOverlay : TDDColorKey;     // color key for destination overlay use
        ddckCKDestBlt     : TDDColorKey;     // color key for destination blt use
        ddckCKSrcOverlay  : TDDColorKey;     // color key for source overlay use
        ddckCKSrcBlt      : TDDColorKey;     // color key for source blt use
        ddpfPixelFormat   : TDDPixelFormat;  // pixel format description of the surface
        ddsCaps           : TDDSCaps2;       // direct draw surface capabilities
        dwTextureStage    : LongWord;        // stage in multitexture cascade
       );
      1: (
        dwRefreshRate : LongWord;            // refresh rate (used when display mode is described)
       );
     );
  end;

(*
 * TDDOptSurfaceDesc
 *)

  PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  TDDOptSurfaceDesc = packed record
    dwSize             : LongWord;   // size of the DDOPTSURFACEDESC structure
    dwFlags            : LongWord;   // determines what fields are valid
    ddSCaps            : TDDSCaps2;  // Common caps like: Memory type
    ddOSCaps           : TDDOSCaps;  // Common caps like: Memory type
    guid               : TGUID;      // Compression technique GUID
    dwCompressionRatio : LongWord;   // Compression ratio
  end;

(*
 * DDCOLORCONTROL
 *)
  PDDColorControl = ^TDDColorControl;
  TDDColorControl = packed record
    dwSize       : LongWord;
    dwFlags      : LongWord;
    lBrightness  : LongInt;
    lContrast    : LongInt;
    lHue         : LongInt;
    lSaturation  : LongInt;
    lSharpness   : LongInt;
    lGamma       : LongInt;
    lColorEnable : LongInt;
    dwReserved1  : LongWord;
  end;

(*
 * callbacks
 *)

{$IFNDEF WINNT}
  TDDEnumModesCallback = function (const lpDDSurfaceDesc : TDDSurfaceDesc; lpContext : Pointer) : HResult; stdcall;
  TDDEnumModesCallback2 = function (const lpDDSurfaceDesc : TDDSurfaceDesc2; lpContext : Pointer) : HResult; stdcall;
  TDDEnumSurfacesCallback = function (lpDDSurface : IDirectDrawSurface; const lpDDSurfaceDesc : TDDSurfaceDesc; lpContext : Pointer) : HResult; stdcall;
  TDDEnumSurfacesCallback2 = function (lpDDSurface : IDirectDrawSurface4; const lpDDSurfaceDesc : TDDSurfaceDesc2; lpContext : Pointer) : HResult; stdcall;
  TDDEnumSurfacesCallback7 = function (lpDDSurface : IDirectDrawSurface7; const lpDDSurfaceDesc : TDDSurfaceDesc2; lpContext : Pointer) : HResult; stdcall;
{$ENDIF}

(*
 * INTERACES FOLLOW:
 *      IDirectDraw
 *      IDirectDrawClipper
 *      IDirectDrawPalette
 *      IDirectDrawSurface
 *)

(*
 * IDirectDraw
 *)

  IDirectDraw = interface (IUnknown)
    ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
   (*** IDirectDraw methods ***)
    function Compact : HResult; stdcall;
    function CreateClipper(dwFlags : LongWord; out lplpDDClipper : IDirectDrawClipper; pUnkOuter : IUnknown) : HResult; stdcall;
    function CreatePalette(dwFlags : LongWord; lpColorTable : Pointer; out lplpDDPalette : IDirectDrawPalette; pUnkOuter : IUnknown) : HResult; stdcall;
    function CreateSurface(var lpDDSurfaceDesc : TDDSurfaceDesc; out lplpDDSurface : IDirectDrawSurface; pUnkOuter : IUnknown) : HResult; stdcall;
    function DuplicateSurface(lpDDSurface : IDirectDrawSurface; out lplpDupDDSurface : IDirectDrawSurface) : HResult; stdcall;
    function EnumDisplayModes(dwFlags : LongWord; lpDDSurfaceDesc : PDDSurfaceDesc; lpContext : Pointer; lpEnumModesCallback : TDDEnumModesCallback) : HResult; stdcall;
    function EnumSurfaces(dwFlags : LongWord; const lpDDSD : TDDSurfaceDesc; lpContext : Pointer; lpEnumCallback : TDDEnumSurfacesCallback) : HResult; stdcall;
    function FlipToGDISurface : HResult; stdcall;
    function GetCaps(lpDDDriverCaps : PDDCaps; lpDDHELCaps : PDDCaps) : HResult; stdcall;
    function GetDisplayMode(out lpDDSurfaceDesc : TDDSurfaceDesc) : HResult; stdcall;
    function GetFourCCCodes(var lpNumCodes : LongWord; lpCodes : PDWORD) : HResult; stdcall;
    function GetGDISurface(out lplpGDIDDSSurface : IDirectDrawSurface) : HResult; stdcall;
    function GetMonitorFrequency(out lpdwFrequency : LongWord) : HResult; stdcall;
    function GetScanLine(out lpdwScanLine : LongWord) : HResult; stdcall;
    function GetVerticalBlankStatus(out lpbIsInVB : BOOL) : HResult; stdcall;
    function Initialize(lpGUID : PGUID) : HResult; stdcall;
    function RestoreDisplayMode : HResult; stdcall;
    function SetCooperativeLevel(hWnd : HWND; dwFlags : LongWord) : HResult; stdcall;
   (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
    function SetDisplayMode(dwWidth : LongWord; dwHeight : LongWord; dwBpp : LongWord) : HResult; stdcall;
    function WaitForVerticalBlank(dwFlags : LongWord; hEvent : THandle) : HResult; stdcall;
  end;

  IDirectDraw2 = interface(IUnknown)
    ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
   (*** IDirectDraw methods ***)
    function Compact : HResult; stdcall;
    function CreateClipper(dwFlags : LongWord; out lplpDDClipper : IDirectDrawClipper; pUnkOuter : IUnknown) : HResult; stdcall;
    function CreatePalette(dwFlags : LongWord; lpColorTable : Pointer; out lplpDDPalette : IDirectDrawPalette; pUnkOuter : IUnknown) : HResult; stdcall;
    function CreateSurface(var lpDDSurfaceDesc : TDDSurfaceDesc; out lplpDDSurface : IDirectDrawSurface; pUnkOuter : IUnknown) : HResult; stdcall;
    function DuplicateSurface(lpDDSurface : IDirectDrawSurface; out lplpDupDDSurface : IDirectDrawSurface) : HResult; stdcall;
    function EnumDisplayModes(dwFlags : LongWord; lpDDSurfaceDesc : PDDSurfaceDesc; lpContext : Pointer; lpEnumModesCallback : TDDEnumModesCallback) : HResult; stdcall;
    function EnumSurfaces(dwFlags : LongWord; var lpDDSD : TDDSurfaceDesc; lpContext : Pointer; lpEnumCallback : TDDEnumSurfacesCallback) : HResult; stdcall;
    function FlipToGDISurface : HResult; stdcall;
    function GetCaps(lpDDDriverCaps : PDDCaps; lpDDHELCaps : PDDCaps) : HResult; stdcall;
    function GetDisplayMode(out lpDDSurfaceDesc : TDDSurfaceDesc) : HResult; stdcall;
    function GetFourCCCodes(var lpNumCodes : LongWord; lpCodes : PDWORD) : HResult; stdcall;
    function GetGDISurface(out lplpGDIDDSSurface : IDirectDrawSurface) : HResult; stdcall;
    function GetMonitorFrequency(out lpdwFrequency : LongWord) : HResult; stdcall;
    function GetScanLine(out lpdwScanLine : LongWord) : HResult; stdcall;
    function GetVerticalBlankStatus(out lpbIsInVB : BOOL) : HResult; stdcall;
    function Initialize(lpGUID : PGUID) : HResult; stdcall;
    function RestoreDisplayMode : HResult; stdcall;
    function SetCooperativeLevel(hWnd : HWND; dwFlags : LongWord) : HResult; stdcall;
(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
    function SetDisplayMode(dwWidth : LongWord; dwHeight : LongWord; dwBPP : LongWord; dwRefreshRate : LongWord; dwFlags : LongWord) : HResult; stdcall;
    function WaitForVerticalBlank(dwFlags : LongWord; hEvent : THandle) : HResult; stdcall;
   (*** Added in the v2 interface ***)
    function GetAvailableVidMem(var lpDDSCaps : TDDSCaps; out lpdwTotal, lpdwFree : LongWord) : HResult; stdcall;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -