PDA

View Full Version : Graphics in Turbo delphi



John_Spartan_117
01-02-2007, 05:50 PM
does anyone know how i can get delphiX in turbodelphi? I Don't really know how to work with packages w/o 3rd party packages available. I heard it was possible tho

any help would be great, thanks
-chris

AthenaOfDelphi
13-02-2007, 09:59 PM
I can't help you I'm afraid hon, but maybe if the thread is bumped someone who can may see it.

cairnswm
14-02-2007, 05:36 AM
Hadn't seen this :(

The Turbo products are designed to stop people adding in components - however there are workarounds if you search the web enough.

S2DL is designed not to required VCL components. This makes the programs smaller and makes it a perfect set of libraries to use with the Turbo Products.

NecroDOME
14-02-2007, 08:34 AM
you could try to create to components runtime. Worked form me for some other components...

pstudio
14-02-2007, 09:34 AM
you could try to create to components runtime. Worked form me for some other components...
Yep, that's how I'm doing it with any third-party components. I haven't tried it with DelphiX but it works with no problems at all with Asphyre 3.
However there where an article that described how to add the components to the palette. I've done it with the spin-edit. I believe I found the link on this site. I'll try and see if I can find it.

Evil_Toaster
11-03-2007, 02:28 PM
Hey,

I investigated this a while ago, and it's fairly easy to get many of the component based graphics libraries to work within Turbo Delphi. Since you're provided with the full source code, you can simply link to the library (Tools > Options > Delphi Options > Library Win32). Add all unDelphiX source paths under 'Library Path'.

The catch is that you can't just drag and drop the unDelphiX components onto the form anymore, and would need to create them dynamically. Here's some code from one of my projects where I create the DXDraw dynamically:




Uses
DirectX, DXClass, DXDraws;

// CREATE

// Create the DXDraw Component
FDXDraw := TDXDraw.Create(TDXForm(oOwner));
FDXDraw.Parent := TDXForm(FOwner);

// Link DXDraw Keyboard and Mouse Input to Parent Form
FDXDraw.OnKeyDown := TDXForm(FOwner).OnKeyDown;
FDXDraw.OnKeyUp := TDXForm(FOwner).OnKeyUp;
FDXDraw.OnMouseDown := TDXForm(FOwner).OnMouseDown;
FDXDraw.OnMouseUp := TDXForm(FOwner).OnMouseUp;
FDXDraw.OnMouseMove := TDXForm(FOwner).OnMouseMove;

// Center the Form and set it's size
TDXForm(FOwner).Left := (Screen.Width - GD_SCREEN_RES_X) DIV 2;
TDXForm(FOwner).Top := (Screen.Height - GD_SCREEN_RES_Y) DIV 2;
TDXForm(FOwner).ClientWidth := GD_SCREEN_RES_X;
TDXForm(FOwner).ClientHeight := GD_SCREEN_RES_Y;

// Set up the DXDraw Display
FDXDraw.Left := 0;
FDXDraw.Top := 0;
FDXDraw.Width := GD_SCREEN_RES_X;
FDXDraw.Height := GD_SCREEN_RES_Y;
FDXDraw.Display.Width := GD_SCREEN_RES_X;
FDXDraw.Display.Height := GD_SCREEN_RES_Y;
FDXDraw.Display.BitCount := GD_COLOR_DEPTH;
FDXDraw.Display.FixedBitCount := True;
FDXDraw.Cursor := crNone;
FDXDraw.SendToBack;

// Set the render options
If not (doDirectX7Mode in FDXDraw.Options) Then FDXDraw.Options := FDXDraw.Options + [doDirectX7Mode];
If not (doHardware in FDXDraw.Options) Then FDXDraw.Options := FDXDraw.Options + [doHardware];
If not (do3D in FDXDraw.Options) Then FDXDraw.Options := FDXDraw.Options + [do3D];
If not (doWaitVBlank in FDXDraw.Options) Then FDXDraw.Options := FDXDraw.Options + [doWaitVBlank];

If (GD_FULLSCREEN) Then Begin
If not (doFullScreen in FDXDraw.Options) Then FDXDraw.Options := FDXDraw.Options + [doFullScreen];
TDXForm(FOwner).BorderStyle := bsNone;
End Else Begin
If (doFullScreen in FDXDraw.Options) Then FDXDraw.Options := FDXDraw.Options - [doFullScreen];
End;

// Initialize DXDraw
FDXDraw.Initialize;


// DESTROY

// Finalise the DXDraw Control
FDXDraw.Finalize;
// Free the DXDraw Control
FDXDraw.Free;


That code certainly won't run if you just cut and paste, since there's a whole lot of custom variables, but you should be able to adapt it for your uses.

Anoter thing to keep in mind (which has caught me out in the past) is that you need to change your form to type TDXForm.



Uses
DXClass;

TFormMain = class(TForm)
change to:
TFormMain = class(TDXForm)
[/code]

3_of_8
11-03-2007, 02:32 PM
You could also add the DelphiX-units to dclusr.dpk.

GuyWithDogs
14-03-2007, 05:41 PM
You could also add the DelphiX-units to dclusr.dpk.

I think they crippled that little trick in the latest versions and the update they made available after the initial release.

However, as someone said, if you search around enough, I think there are a set of tools and tricks that will let you get around the limitation.

WILL
14-03-2007, 10:00 PM
You know, you're probably better off without the components anyhow.

You'll learn more that way. ;) And if you want to really grab people graphics card by the you-know-whats you'll need to go with a non-visual component based library anyhow. Even Asphyre is going the way of non-VCL based.