📄 directx.pas
字号:
(*==========================================================================;
*
* Copyright (C) 1994-1999 Microsoft Corporation. All Rights Reserved.
*
* DirectX header version 98.11.20
*
* Present by Hiroyuki Hori.
*
* E-Mail: hori@ingjapan.ne.jp
* Homepage: http://www.ingjapan.ne.jp/hori/index.html
* Homepage: http://www.ingjapan.ne.jp/hori/index-e.html
*
* Present unit:
* DirectX.pas DirectX 7 (DirectX 7 SDK)
* DShow.pas DirectShow (DirectX Media SDK 5.1)
* DAnim.pas DirectAnimation (DirectX Media SDK 5.1)
*
*--------------------------------------------------------------------------
*
* DirectMusic header version 1.0
*
* Present by Kazuya Yamane
*
* e-mail : kazuya-y@infosakyu.ne.jp
* URL : http://www.infosakyu.ne.jp/~kazuya-y/index.html
*
***************************************************************************)
{
(c)2004 Jaro Benes Recompilation with Erik Unger's headers
Join in order:
1) DirectDraw
2) Direct3D
3) Direct3DRM
4) DirectInput
5) DirectPlay
6) DirectSetup
7) DirectSound
8) DirectMusic
}
Unit DirectX;
Interface
{Delphi version marks}
{$I DelphiXcfg.inc}
{$MINENUMSIZE 4}
{$ALIGN ON}
uses
Windows, DXCommon, MMSystem;
//DirectDraw file
(*==========================================================================;
*
* Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved.
*
* Files: ddraw.h dvp.h
* Content: DirectDraw and DirectDrawVideoPort include files
*
* DirectX 7.0 Delphi adaptation by Erik Unger
*
* Modified: 10-Sep-2000
*
* Download: http://www.delphi-jedi.org/DelphiGraphics/
* E-Mail: DelphiDirectX@next-reality.com
*
*
***************************************************************************)
var
DDrawDLL : HMODULE = 0;
function DDErrorString(Value: HResult) : string;
function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
(*
* FOURCC codes for DX compressed-texture pixel formats
*)
const
FOURCC_DXT1 = 'DXT1';
FOURCC_DXT2 = 'DXT2';
FOURCC_DXT3 = 'DXT3';
FOURCC_DXT4 = 'DXT4';
FOURCC_DXT5 = 'DXT5';
(*
* GUIDS used by DirectDraw objects
*)
const
CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
const
DD_ROP_SPACE = (256 div 32); // space required to store ROP array
MAX_DDDEVICEID_STRING = 512;
(*
* Flags for the IDirectDraw4::GetDeviceIdentifier method
*)
(*
* This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
* with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
* host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
* returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
* of the DirectDraw object involved.
*)
DDGDI_GETHOSTIDENTIFIER = $00000001;
(*============================================================================
*
* DirectDraw Structures
*
* Various structures used to invoke DirectDraw.
*
*==========================================================================*)
var
NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
type
TRefGUID = packed record
case integer of
1: (guid : PGUID);
2: (dwFlags : DWORD);
end;
IDirectDraw = interface;
IDirectDraw2 = interface;
IDirectDraw4 = interface;
IDirectDraw7 = interface;
IDirectDrawSurface = interface;
IDirectDrawSurface2 = interface;
IDirectDrawSurface3 = interface;
IDirectDrawSurface4 = interface;
IDirectDrawSurface7 = interface;
IDirectDrawPalette = interface;
IDirectDrawClipper = interface;
IDirectDrawColorControl = interface;
IDirectDrawGammaControl = interface;
(*
* Generic pixel format with 8-bit RGB and alpha components
*)
PDDARGB = ^TDDARGB;
TDDARGB = packed record
blue: BYTE;
green: BYTE;
red: BYTE;
alpha: BYTE;
end;
(*
* This version of the structure remains for backwards source compatibility.
* The DDARGB structure is the one that should be used for all DirectDraw APIs.
*)
PDDRGBA = ^TDDRGBA;
TDDRGBA = packed record
red : BYTE;
green : BYTE;
blue : BYTE;
alpha : BYTE;
end;
(*
* TDDColorKey
*)
PDDColorKey = ^TDDColorKey;
TDDColorKey = packed record
dwColorSpaceLowValue: DWORD; // low boundary of color space that is to
// be treated as Color Key, inclusive
dwColorSpaceHighValue: DWORD; // high boundary of color space that is
// to be treated as Color Key, inclusive
end;
// Delphi 5 can't handle interface in variant records
// so we have to use pointers instead (which can be type-casted into interfaces):
{$IFDEF VER5UP}
PDirectDrawSurface = Pointer;
{$ELSE}
PDirectDrawSurface = IDirectDrawSurface;
{$ENDIF}
(*
* TDDBltFX
* Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
*)
PDDBltFX = ^TDDBltFX;
TDDBltFX = packed record
dwSize : DWORD; // size of structure
dwDDFX : DWORD; // FX operations
dwROP : DWORD; // Win32 raster operations
dwDDROP : DWORD; // Raster operations new for DirectDraw
dwRotationAngle : DWORD; // Rotation angle for blt
dwZBufferOpCode : DWORD; // ZBuffer compares
dwZBufferLow : DWORD; // Low limit of Z buffer
dwZBufferHigh : DWORD; // High limit of Z buffer
dwZBufferBaseDest : DWORD; // Destination base value
dwZDestConstBitDepth : DWORD; // Bit depth used to specify Z constant for destination
case integer of
0: (
dwZDestConst : DWORD // Constant to use as Z buffer for dest
);
1: (
lpDDSZBufferDest : PDirectDrawSurface; // Surface to use as Z buffer for dest
dwZSrcConstBitDepth : DWORD; // Bit depth used to specify Z constant for source
case integer of
0: (
dwZSrcConst : DWORD; // Constant to use as Z buffer for src
);
1: (
lpDDSZBufferSrc : PDirectDrawSurface; // Surface to use as Z buffer for src
dwAlphaEdgeBlendBitDepth : DWORD; // Bit depth used to specify constant for alpha edge blend
dwAlphaEdgeBlend : DWORD; // Alpha for edge blending
dwReserved : DWORD;
dwAlphaDestConstBitDepth : DWORD; // Bit depth used to specify alpha constant for destination
case integer of
0: (
dwAlphaDestConst : DWORD; // Constant to use as Alpha Channel
);
1: (
lpDDSAlphaDest : PDirectDrawSurface; // Surface to use as Alpha Channel
dwAlphaSrcConstBitDepth : DWORD; // Bit depth used to specify alpha constant for source
case integer of
0: (
dwAlphaSrcConst : DWORD; // Constant to use as Alpha Channel
);
1: (
lpDDSAlphaSrc : PDirectDrawSurface; // Surface to use as Alpha Channel
case integer of
0: (
dwFillColor : DWORD; // color in RGB or Palettized
);
1: (
dwFillDepth : DWORD; // depth value for z-buffer
);
2: (
dwFillPixel : DWORD; // pixel value
);
3: (
lpDDSPattern : PDirectDrawSurface; // Surface to use as pattern
ddckDestColorkey : TDDColorKey; // DestColorkey override
ddckSrcColorkey : TDDColorKey; // SrcColorkey override
)
)
)
)
)
end;
(*
* TDDSCaps
*)
PDDSCaps = ^TDDSCaps;
TDDSCaps = packed record
dwCaps: DWORD; // capabilities of surface wanted
end;
(*
* TDDOSCaps
*)
PDDOSCaps = ^TDDOSCaps;
TDDOSCaps = packed record
dwCaps: DWORD; // capabilities of surface wanted
end;
(*
* This structure is used internally by DirectDraw.
*)
PDDSCapsEx = ^TDDSCapsEx;
TDDSCapsEx = packed record
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -