Skip to main content
gamedev.net
🔒 Locked

Please Help

Started by BobBaker92 2 replies 500+ views
Original Post
BobBaker92
BobBaker92
...I''m getting quite frusterated with DelphiX. I have read through lots of tutorials on it, and I have tried to make a stupid little graphic appear on the screen and I can''t get it to work, and its really ticking me off. I follow the directions in the tutorials, but when I run my program, all I get is a black screen... I''ve tried many different tutorials, and this is all I can get, a stupid black screen. I can run all the tutorials fine, they work like they are suppose to, but when I try to make my own.. Nothing. Here is what I''m using, and I check my components and they are all pointing to right DXDraw1 under the choices of the DXDraw surfaces. Someone Please HELP me. unit game2; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DXDraws, DXSprite; type TForm1 = class(TForm) DXDraw1: TDXDraw; DXImageList1: TDXImageList; procedure FormKeyPress(Sender: TObject; var Key: Char); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if key = #27 then close; end; procedure TForm1.FormCreate(Sender: TObject); begin DXImageList1.Items[0].Draw(DXDraw1.Surface,10,10,0); //DXImageList1.Items[1].Draw(DXDraw1.Surface,300,300,0); DXDraw1.Flip; end; end.
Bobby BakerOmega Componentshttp://66.139.78.148/ds/
ggs
ggs
First of you need to make sure every thing is plugged in
Make sure all the DXImageLists have their DXdraw property assigned, and that they have some images loaded.
The second step is to move your drawing code out of the formcreate event, that occurs BEFORE you even have a form.
Thus to fix this, drop 1 TDXtimer component on the form,
set it''s enabled property to false and the interval to 0.
and add the following code

procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin
DXtimer1.enabled := true;
end;

procedure TForm1.DXDraw1Finalize(Sender: TObject);
begin
DXtimer1.enabled := false;
end;

procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw1.candraw then
exit;

// drawing code here, draw to DXDraw1.surface(secondary surface)

// this actually transfers the secondary surface to the
// primary surface
DXDraw1.Flip;
end;
BobBaker92
BobBaker92
Thanks, I appreciate it. It works now
Bobby BakerOmega Componentshttp://66.139.78.148/ds/
marco
marco
I used to have the very same problem, but the examples as you can find on very places around the net, gets you to how it works, just do exactly as they do and cut the code by hand and you se how it works.

So when you do collisions don''t forget to include
Dollision at the end of DxTimer or on the objects you like to be checked. You can imagine that I felt the very same whay you did when it didn''t work. Now it works...

Good Luck!

Cheerz,
Marco Eberhardt.
ME

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.