..c w ogóle nie jarze co napisałeś :P
W przykładach do directx sdk pod delphi jest wyładowanie tekstur podczas zamykania formy
tworza forme
var
{$ENDIF}
wc: TWndClassEx = (
cbSize: SizeOf(TWndClassEx);
style: CS_CLASSDC;
{$IFDEF FPC}
lpfnWndProc: MsgProc;
{$ELSE}
lpfnWndProc: @MsgProc;
{$ENDIF}
cbClsExtra: 0;
cbWndExtra: 0;
hInstance: 0; // - filled later
hIcon: 0;
hCursor: 0;
hbrBackground: 0;
lpszMenuName: nil;
lpszClassName: 'D3D Tutorial';
hIconSm: 0);
var
hWindow: HWND;
msg: TMsg;
begin
// Register the window class
wc.hInstance:= GetModuleHandle(nil);
RegisterClassEx(wc);
// Create the application's window
hWindow := CreateWindow('D3D Tutorial', 'D3D Tutorial 05: Textures',
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
0, 0, wc.hInstance, nil);
// Initialize Direct3D
if SUCCEEDED(InitD3D(hWindow)) then
begin
// Create the scene geometry
if SUCCEEDED(InitGeometry) then
begin
// Show the window
ShowWindow(hWindow, SW_SHOWDEFAULT);
UpdateWindow(hWindow);
// Enter the message loop
FillChar(msg, SizeOf(msg), 0);
while (msg.message <> WM_QUIT) do
begin
if PeekMessage(msg, 0, 0, 0, PM_REMOVE) then
begin
TranslateMessage(msg);
DispatchMessage(msg);
end else
Render;
end;
end;
end;
UnregisterClass('D3D Tutorial', wc.hInstance);
end.
procedurka przechwytujaca zamkniecie okna
function MsgProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
case uMsg of
WM_DESTROY:
begin
if (g_pTexture <> nil) then
{$IFDEF TMT}
g_pTexture.Release;
{$ELSE}
g_pTexture:= nil;
{$ENDIF}
if (g_pVB <> nil) then
{$IFDEF TMT}
g_pVB.Release;
{$ELSE}
g_pVB:= nil;
{$ENDIF}
if (g_pd3dDevice <> nil) then
{$IFDEF TMT}
g_pd3dDevice.Release;
{$ELSE}
g_pd3dDevice:= nil;
{$ENDIF}
if (g_pD3D <> nil) then
{$IFDEF TMT}
g_pD3D.Release;
{$ELSE}
g_pD3D:= nil;
{$ENDIF}
end;
PostQuitMessage(0);
Result:= 0;
Exit;
end;
end;
Result:= DefWindowProc(hWnd, uMsg, wParam, lParam);
end;
Problem tylko ze moja dllka nie ma miec zadnej formy, jak w takiej dllce wykryc zdarzenie wyladowania tekstur z device?
dziwne bo funkcja do tworzenia da sie przechwycic
function Direct3DCreate9(SDKVersion: cardinal): Pointer; stdcall;
a przydalo by sie cos w stylu
function Direct3DDestroy9(SDKVersion: cardinal): Pointer; stdcall;
:)
Jakies pomysly?