unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, direct3d9, dxhelp, ExtCtrls;
type
TForm2 =
class(TForm)
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
procedure OnIdle(Sender: TObject;
var done: boolean);
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
Direct3D9: IDirect3D9;
D3DDev9: IDirect3DDevice9;
implementation
{$R *.dfm}
type
TD3DLVertex =
record
position: TD3DXVector3;
diffuse: TD3DColor;
end;
const
D3DFVF_TD3DLVertex = D3DFVF_XYZ
or D3DFVF_DIFFUSE;
function InitGeometry: HResult;
var
Vertices:
Array[0..2]
of TD3DLVertex;
begin
D3DDev9.CreateVertexBuffer(sizeof( TD3DLVertex ) * 3, D3DUSAGE_WRITEONLY,
D3DFVF_TD3DLVERTEX, D3DPOOL_DEFAULT,
Vertexbuffer,
nil);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
DHInitDGFX(
Handle, False, 1280,1024,32, True, Direct3D9, D3DDev9 );
Application.OnIdle := OnIdle;
end;
procedure TForm2.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DHCloseDGFX( Direct3D9, D3DDev9);
end;
procedure Render;
begin
D3DDev9.BeginScene;
D3DDev9.Clear( 0,
nil, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 1.0, 0);
D3DDev9.EndScene;
D3DDev9.Present(
nil,
nil, 0,
nil );
end;
procedure TForm2.OnIdle(Sender: TObject;
var done: boolean);
begin
done := false;
Render;
end;
end.