(*******************************************************************************
EXTEND UNIT DXDRAWS FROM DELPHIX PACK
* Copyright (c) 2004-2008 Jaro Benes
* All Rights Reserved
* Version 1.08.x
* D2D Hardware module
* web site: www.micrel.cz/Dx
* e-mail: delphix_d2d@micrel.cz
* DISCLAIMER:
This software is provided "as is" and is without warranty of any kind.
The author of this software does not warrant, guarantee or make any
representations regarding the use or results of use of this software
in terms of reliability, accuracy or fitness for purpose. You assume
the entire risk of direct or indirect, consequential or inconsequential
results from the correct or incorrect usage of this software even if the
author has been informed of the possibilities of such damage. Neither
the author nor anybody connected to this software in any way can assume
any responsibility.
First work started at 13.9.2004.
All units in this pack contain last changes and was added very interesting
units (for study or inspiration)
Tested in Delphi 4, 5, 6, 7 and Delphi 2005/2006/Turbo/2007
* FEATURES:
a) Implement Hardware acceleration for critical function like DrawAlpha {Blend},
DrawSub and DrawAdd for both way DXIMAGELIST and DIRECTDRAWSURFACE with rotation too.
b) Automatic adjustement for texture size different 2^n.
c) Minimum current source code change, all accelerated code added into:
DXDraw.BeginScene;
//code here
DXDraw.EndScene;
d) DelphiX facade continues using still.
* HOW TO USE
a) Design code like as DelphiX and drawing routine put into
DXDraw.BeginScene;
//code here
DXDraw.EndScene;
b) setup options in code or property for turn-on acceleration like:
DXDraw.Finalize; {done DXDraw}
If HardwareSwitch Then
{hardware}
Begin
if NOT (doDirectX7Mode in DXDraw.Options) then
DXDraw.Options := DXDraw.Options + [doDirectX7Mode];
if NOT (doHardware in DXDraw.Options) then
DXDraw.Options := DXDraw.Options + [doHardware];
if NOT (do3D in DXDraw.Options) then
DXDraw.Options := DXDraw.Options + [do3D];
if doSystemMemory in DXDraw.Options then
DXDraw.Options := DXDraw.Options - [doSystemMemory];
End
Else
{software}
Begin
if doDirectX7Mode in DXDraw.Options then
DXDraw.Options := DXDraw.Options - [doDirectX7Mode];
if do3D in DXDraw.Options then
DXDraw.Options := DXDraw.Options - [do3D];
if doHardware in DXDraw.Options then
DXDraw.Options := DXDraw.Options - [doHardware];
if NOT (doSystemMemory in DXDraw.Options) then
DXDraw.Options := DXDraw.Options + [doSystemMemory];
End;
{to fullscreen}
if doFullScreen in DXDraw.Options then
begin
RestoreWindow;
DXDraw.Cursor := crDefault;
BorderStyle := bsSingle;
DXDraw.Options := DXDraw.Options - [doFullScreen];
DXDraw.Options := DXDraw.Options + [doFlip];
end else
begin
StoreWindow;
DXDraw.Cursor := crNone;
BorderStyle := bsNone;
DXDraw.Options := DXDraw.Options + [doFullScreen];
DXDraw.Options := DXDraw.Options - [doFlip];
end;
DXDraw1.Initialize; {up DXDraw now}
* NOTE Main form has to declare like:
TForm1 = class(TDXForm)
* KNOWN BUGS OR RESTRICTION:
1/ Cannot be use DirectDrawSurface other from DXDraw.Surface in HW mode.
2/ New functions was not tested for two and more DXDraws on form. Sorry.
* HISTORY
**** please see into history.rtf document ****
******************************************************************************
* PACK NOTE for (un)DelphiX pack recompilation with hardware acceleration
For simple application start can be use the prototype application in this pack
* PACK HISTORY
28.02.2009
* Pack recompiled under Delphi 3,4,5,6,7,2005,2006,2007,2009 for conditionals change and Delphi 2009 bug fix.
07.04.2008 JB.
+ Main enhacement relelased, overwritten in the history document
09.06.2005 JB.
+ Better compatibility with Delphi 4.
+ Some .dpk files revised, installation for all the same.
+ added the DXMisc.pas file contain some useful functions.
+ DXSprite.pas file revised for support under Delphi 3;
Under Delphi 3 cannot be use colli3DX.pas, isn't adapt still, sorry.
12.06.2005 JB.
+ Improvement of hardware acceleration and fix-bug.
19.06.2005 JB.
+ Fix-bug in Draw() function.
23.10.2005 JB.
+ DXSpriteEngine improvement
Isn't necessary derive classes sprite, it is possible use DrawAdd, DrawAlpha and DrawSub also for BackgroundSprite.
New proposal sprite from editor, sorting into the collection (likewise as with DXImageList or DXWaveList), generation Events.