Archived

This topic is now archived and is closed to further replies.

Trajar

Help w/Builder 3.0 and DX7

Recommended Posts

Trajar    122
I know that Borland''s Builder series has had a few incompatibilities with DX, and my case is no different. Could someone please tell me what needs to be changed, other than the obviouse imported lib''s for Borland''s compiler. The goal is to spit a looping animation into a small window (possibly canvas? image control?) for use in a tool for my game. Most of the code will be GUI based, but I need to see the DX grahpics engine in action. I tried drudging through MFC but I hate using MFC and like Borland''s drag/drop MUCH better. So if anyone could show me the code I need to change, I would be much abliged. Thanks, Trajar

Share this post


Link to post
Share on other sites
Hway    122
I use BCB4professional and there are basically no problems. There are some things you should know, however.

You want to use GUI, so create windowed app. DON''T create new window, use Application->HInstance (only DInput required that if I remember correctly), and MainForm::Handle. (or GfxForm::Handle, if you prefer it that way)

As usual in windowed mode, create frontbuffer and backbuffer separately (no complex surfaces there). Just make sure that your backbuffer has same pixelformat than your frontbuffer, so use fronbuff->GetPixelFormat(...).

In windowed mode, you can''t use Flip, so you have to use Blt instead;
front->Blt ( &screenrect, back, NULL, DDBLT_WAIT, NULL );
(note: this is using dd2 interface, I''m using NT at work... I can''t remember whether Blt has changed or not since then)

You don''t want to use NULL as target rect (first parameter), instead get Left and Top-properties of form, and backbuffer''s dimensions to figure out screen coordinates of your window (and set them to "screenrect") You don''t need to have images or anything on your form, just empty space large enough for the ddraw''s data.

If you want to move your window, you have to figure out which event you can capture form moving (OnResize might do the trick, I can''t confirm it right now), and update screenrect as you move the window.

There might be some other tricks, too, but I can''t remember them right now. This should be enough to get you going.

Share this post


Link to post
Share on other sites