Delphix (1) of Delphi and DirectX: installation and testing

Source: Internet
Author: User
Test demo download: http://files.cnblogs.com/del/DelphiX_1.rar
(Compiled in Delphi 2007 and 2009)

In fact, according to the introduction here, it is faster than downloading and does not need to be downloaded.

DirectX: Microsoft's technology has been around for a long time. Since Windows Vista, DirectX has become the interface basis of Microsoft's operating system.

There are four popular methods to use DirectX in Delphi:
Delphix
Dspack
Asphyre (?)
Delphi DirectX

Delphix is the first (ten years), the simplest, and the most closely integrated with Delphi;
But for the sake of simplicity, we are going to start with delphix. We will first have a macro concept and learn about the delphix constructor;
However, I think it should be: Delphi DirectX.

Delphix has not been updated since 2000.07.17, but some enthusiastic supporters have maintained it and even supported Delphi 2009.
The version I am using is downloaded from: http://www.micrel.cz/Dx/
Automatic Installation File with it: http://www.micrel.cz/Dx/download/install.exe

Although I introduced the support for Delphi 2009, I still found many problems. After modification, I finally used it in 2009.
However, many examples do not support 2009, because it is much more stable under 2007, so we chose to learn delphix under Delphi 2007.Code2009 compatible.

To ensure that all the examples are run, you also need to change the last row of delphixcfg. Inc's {. $ define d3drm} to {$ define d3drm}
In addition, some Japanese comments are garbled and some examples cannot be run. You can modify the garbled content.
At present, I have tested some samples and it's okay.

I always feel that I am late and want to surpass it as soon as possible!

I first learned an example from the Internet and used it as an opening test:

In this example:


Code file:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, dxdraws, stdctrls, dxclass; Type tform1 = Class (tdxform) dxdraw1: tdxdraw; dxtimer1: tdxtimer; dximagelist1: tdximagelist; Procedure formcreate (Sender: tobject); Procedure formkeydown (Sender: tobject; var key: word; shift: cursor); Procedure alert: tobject); procedure merge (Sender: tobject); Procedure dxtimer1timer (Sender: tobject; lagcount: integer); Private Procedure calculatetables; Procedure plotpoint (xcenter, ycenter, radius, angle: word); end; var form1: tform1; implementation {$ R *. DFM} var sinemove: array [0 .. 255] of integer; cosinemove: array [0 .. 255] of integer; sinetable: array [0 .. 449] of integer; centerx, centery: integer; X: Word = 0; Y: Word = 0; Procedure tform1.calculatetables; var wcount: word; begin for wcount: = 0 to 255 do begin sinemove [wcount]: = round (sin (pI * wcount/128) * 45); cosinemove [wcount]: = round (COS (pI * wcount/128) * 60); end; For wcount: = 0 to 449 do begin sinetable [wcount]: = round (sin (pI * wcount/180) * 128); end; Procedure tform1.plotpoint (xcenter, ycenter, radius, angle: Word); var A, B: word; begin a: = (radius * sinetable [90 + angle]); asm sar a, 7 end; A: = centerx + xcenter + A; B: = (radius * sinetable [angle]); asm sar B, 7 end; B: = centery + ycenter + B; if (a = 360; Inc (countlong, inclong ); if (countlong mod 3) = 0 then begin Inc (inclong); end; until countlong> = 270; X: = xmove + x mod 255; Y: = ymove + y MOD 255; with dxdraw1.surface. canvas do begin brush. style: = bsclear; font. color: = clwhite; font. size: = 12; textout (0, 0, 'fps: '+ inttostr (dxtimer1.framerate); {This sentence is lost in the recording animation} release; end; dxdraw1.flip; end; procedure tform1.formkeydown (Sender: tobject; var key: word; shift: tshiftstate); begin if key = vk_escape then close; end.
 
   
 

Form file:

Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 206 clientwidth = 339 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate onkeydown = formkeydown pixelsperinch = 96 textheight = 13 object dxdraw1: tdxdraw left = 8 Top = 8 width = 249 Height = 177 autoinitialize = true autosize = true color = clblack display. fixedbitcount = false display. fixedratio = true display. fixedsize = true Options = [doallowreboot, dowaitvblank, docenter, do3d, dodirectx7mode, dohardware, doselectdriver] surfaceheight = 177 surfacewidth = 249 onfinalize = dxdraw1finalize oninitialize = dxdraw1initialize taborder = 0 traces = end object dxtimer1: tdxtimer activeonly = true enabled = false interval = 10 ontimer = dxtimer1timer left = 160 Top = 104 end object dximagelist1: tdximagelist dxdraw = dxdraw1 items. colortable = {0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000} items = left = 192 Top = 96 endend
 
  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.