PDA

View Full Version : Problems with Delphi 7 & DelphiX



WiZz
07-04-2004, 06:57 PM
when i want to use DelphiX component DXInput, and try to compile project, i get an error in DXInput.pas file, in lines 33, 35, 36... the error is: "Undeclared indentifier: TDIEffect", "Undeclared identifier: TDIEnvelope"....

WiZz
10-04-2004, 05:16 PM
Come on, can someone help me?

TheLion
10-04-2004, 06:42 PM
Would love to help you, however I don't have Delphi 7... I'm not sure but I vaguely remember someone making a DelphiX version for D7.

WiZz
10-04-2004, 07:43 PM
well i solve this problem by instaling delphi 5 :), but here is another i tried to do simple program displaying two images and FPS. For showing FPS i use DXTimer, but then i see nothing but black screen :(, here is my code.

procedure TForm1.GameLoop(sender: TObject; var done: boolean);
begin
done := false;

DXDraw1.Surface.Canvas.Brush.Color := clWhite;
DXDraw1.Surface.Canvas.TextOut(10, 10, 'FPS: '+ IntToStr(DXTimer1.FrameRate));

DrawGameGraphics(0, 0, GameGraphics[2], False);
DrawGameGraphics(10, 15, GameGraphics[1], true);

DXDraw1.Flip;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnIdle := Form1.GameLoop;
VideoModeX := GetSystemMetrics(SM_CXSCREEN);
VideoModeY := GetSystemMetrics(SM_CYSCREEN);

ShowCursor(False);

ChangeResolution(1024, 768, 16);

form1.BorderStyle := bsNone;
form1.WindowState := wsMaximized;

DXDraw1.Initialize;
LoadGameGraphics;

end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then
begin
SendMessage(Handle, WM_CLOSE, 0, 0);
end;
end;

procedure TForm1.LoadGameGraphics;
var i: integer;
begin
for i := 1 to 100 do
GameGraphics[i] := TDirectDrawSurface.Create(DXDraw1.DDraw);

GameGraphics[1].LoadFromFile(ExtractFilePath(Param Str(0))+'forsas.bmp');
GameGraphics[1].TransparentColor := clWhite;

GameGraphics[2].LoadFromFile(ExtractFilePath(Param Str(0))+'map.bmp');

end;

procedure TForm1.DrawGameGraphics(x, y: integer; DDS: TDirectDrawSurface;
transparent: boolean);
var
SourceRect: TRect;
begin
SourceRect := rect(0, 0, DDS.Width, DDS.Height );
DXDraw1.Surface.Draw(x, y, SourceRect, DDS, Transparent);
end;


procedure TForm1.ChangeResolution(ModeX, ModeY, Bits: integer);
var
DeviceMode: TDevMode;
begin
with DeviceMode do
begin
dmSize := SizeOf(DeviceMode);
dmBitsPerPel := Bits;
dmPelsWidth := ModeX;
dmPelsHeight := ModeY;
dmFields := DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT;
ChangeDisplaySettings(DeviceMode, CDS_FULLSCREEN);
end;
end;

end.

i think i cann't use Application.OnIdle := GameLoop with timer, or maybe can? well what you think? Where is my problem :)

Paulius
10-04-2004, 09:11 PM
As far as I know DXTimer uses the onIdle event and probably reassigns it from your procedure to its own, just stick everything from you're GameLoop to timers OnTimer event and everything should be fine.

WiZz
11-04-2004, 07:14 AM
nop, the same :(

Traveler
11-04-2004, 10:37 AM
DelphiX is nolonger updated I'm afraid, however, there is an unDelphiX version available over at Turbo (http://turbo.gamedev.net/undelphix.asp) which can be used with D7.

And to answer the other problem, you need to add DXDraw1.Surface.Canvas.release directly after DXDraw1.Surface.Canvas.TextOut(..)

WiZz
11-04-2004, 12:37 PM
je, now everything is ok :)