|
EXAMPLE SOURCE CODE
|
|
On this page, you can find a couple of simple-to-understand examples of how to code
next-generation applications using the combination of C++ Builder, DirectX and the TDx_Library...
- Here's an example of using the TDx_Sound_Library... scroll down for more examples and info...
How about This?
-: play 2 sounds at the same time... um... easy... TDx_Sound_Library :-
- Go:
Write a complete (simple) TDx_Library application mixing C++ Builder & DirectX and
play (2) .wav files simultaneously, writing just (6) lines of >simple< code... no bugs...
And your application works perfectly on all computers running the Windows OS and DirectX 7 or better...
first time, every time...
Complete with realtime mixing, realtime format conversion, standard file formats, and so on...
Example:
1.. BCBx->File->New Application
2.. Drop a TButton and a TDx_Sound and (2) TDx_SoundBuffer components onto the form
3.. Double-Click on the TButton, type the following code :-
#pragma link "TDx_Sound_Library_Install"
void __fastcall TForm1::Button1Click(TObject* Sender)
{
// create an interface to the default sound hardware
if (Dx_Sound1->Create(NULL))
{
// create sound buffer # 1 from a file
if (Dx_SoundBuffer1->CreateFromFile(Dx_Sound1,"Example1.wav"))
Dx_SoundBuffer1->Play(0,0); // playback buffer1
// create sound buffer # 2 from a different file
if (Dx_SoundBuffer2->CreateFromFile(Dx_Sound1,"Example2.wav"))
Dx_SoundBuffer2->Play(0,0); // playback buffer2
}
}
4.. Finally... that was too hard... Press [F9] to compile and run the application...
- Stop:
Total time: 30-60 seconds. start to finish... including compile time...
for a fully functioning DirectX application playing (2) .wav files simultaneously
A huge thumbs-up for RAD DirectX programming...
- How can i play 2 sounds at the same time...? Easy... Done, so, show off your application...
- How can i play 3 sounds at the same time...? Easy... Add an extra line or 2 of additional code...
...
Now think about this :-
- Write a "normal" Visual C++ or C++ Builder & DirectX and COM application where you would have to type
(200) to (300) or (more) lines of >complex< code to do exactly the same thing... if you can...
and don't forget to add debugging time and effort too... and then, don't forget to add extra code to
make sure it's compatible with all the various Windows OS hardware and software configurations, etc...
Total time: days and days (weeks) of very hard work... if it works...
For example, can you personally patch the actual DirectX SDK to make it work properly?
A colossal thumbs-down for "normal" DirectX programming...
YUK... so painful... what a very serious waste of time and effort and money...
- Here's another example, this time showing off the TDx_Draw_Library...
How about This?
-: display an image on the full-screen... um... easy... TDx_Draw_Library :-
- Go:
Write a complete (simple) TDx_Library application mixing C++ Builder & DirectX and
display a .bmp file on the screen, full-screen, writing just (6) lines of >simple< code... no bugs...
And your application works perfectly on all computers running the Windows OS and DirectX 7 or better...
first time, every time...
Complete with realtime stretching, pixel format conversion, standard file formats, and so on...
Example:
1.. BCBx->File->New Application
2.. Drop a TButton and a TDx_Draw and (2) TDx_DrawSurface components onto the form
3.. Drop a TDDSurfaceDesc and a TDDSCaps component onto the form
4.. Open the Object Inspector [F11] and link the DDSurfaceDesc1::SCaps property to the DDSCaps1 component
5.. Using the Object Inspector, setup DDSCaps1::Caps to be DDSCAPS_PRIMARYSURFACE
6.. Double-Click on the TButton, type the following code :-
#pragma link "TDx_Draw_Library_Install"
void __fastcall TForm1::Button1Click(TObject* Sender)
{
// create interface to video hardware, primary display device
if (Dx_Draw1->Create(NULL))
{
// make sure we have exclusive access to this device
Dx_Draw1->SetCooperativeLevel( Application->Handle, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE );
// create a primary surface
if (Dx_DrawSurface1->Create( DDSurfaceDesc1, Dx_Draw1))
// create an offscreen surface from a file
if (Dx_DrawSurface2->CreateFromFile( Dx_Draw1, "TEST.BMP" ))
// display the test image while stretching it to fit the entire screen
Dx_DrawSurface1->Blt( NULL, Dx_DrawSurface2, NULL, 0, NULL );
}
}
7.. Finally... that was too hard... Press [F9] to compile and run the application...
- Stop:
Total time: 30-60 seconds. start to finish... including compile time...
for a fully functioning DirectX application displaying a .bmp image full-screen
Another huge thumbs-up for RAD DirectX programming...
- How can i draw an image on the full-screen...? Easy... Done, so, show off your application...
...
Now think about this :-
- Write a "normal" Visual C++ or C++ Builder & DirectX and COM application where you would have to type
however many lines of >complex< code to do exactly the same thing... if you can...
and don't forget to add debugging time and effort too... and then, don't forget to add extra code to
make sure it's compatible with all the various Windows OS hardware and software configurations, etc...
Total time: days and days (weeks) of very hard work... if it works...
For example, can you personally patch the actual DirectX SDK to make it work properly?
Another colossal thumbs-down for "normal" DirectX programming...
YUK... so painful... what a very serious waste of time and effort and money...
- Don't know what a bit of TDx_Library code does?
Visit our Demos Page and download a whole bunch of working applications, with many
all-new Demos and Application Templates with fully documented Source Code currently under development
for use with the upcoming TDx_Library v1.90++...
Online TDx_Library Demos + Source Code and
Online TDx_Draw_Library Demos + Source Code and
Online TDx_Sound_Library Demos + Source Code and
Online TDx_Input_Library Demos + Source Code and
Online TDx_Play_Library Demos + Source Code and
Online TDx_3DI_Library Demos + Source Code
and
Ask us and we may be able to write a customized demo for you...
- Don't know what something in the code does?
Press [F1], there's all relevant information at your fingertips, instantly, just like in the...
Online TDx_Draw_Library Component Knowledgebase and
Online TDx_Sound_Library Component Knowledgebase and
Online TDx_Input_Library Component Knowledgebase and
Online TDx_Play_Library Component Knowledgebase and
Online TDx_3DI_Library Component Knowledgebase
and
Online Component Reference...
- Now try C# or Visual Basic with something like Managed DirectX(tm)...
The idea is similar to the TDx_Library, but without the comprehensive knowledgebase at your every [F1] keypress...
Nothing compares to having all help immediately available, in straightforward english, saving many hours of searching
and navigating hard-to-use and hard-to-understand SDK knowledgebases, saving countless thousands of hours of
valuable programming time, making you ultra-productive as a programmer... everything is at your fingertips...
And the TDx_Library is superior... if you use Managed DirectX, your application will only run at
60% of the speed of the TDx_Library at best...
There are too many benefits to list when comparing the use of the TDx_Library and Borland C++ Builder and DirectX
to all other programming environments... other environments simply do not stack up...
It's all about RAD enabled productivity... imagine saving 90%++ of your programming time, immediately, without having to
spend weeks learning a complex SDK first... if your boss isn't happy with the results, we'll be hogwashed...
Take a good, long, hard look around this website and see for yourself just how simple and powerful the TDx_Library is...
Then register, start using the TDx_Library, and make brilliant results in minutes...
Note:
If you have ever used Visual Basic or C# or Visual C/C++ or C++ Builder or DirectX or Delphi, or even if you are just thinking
of using them... take a good look around this website... you will be surprised at the advanced programming tools available here...
We will save you thousands of man-hours and hundreds of thousands of dollars... the wheel has been re-invented...
and you can now get your hands on the most advanced programming toolset ever created... for very little money...
"An incredibly cost-effective off-the-shelf software solution..."
Or,
If you have ever struggled for months & years on end to develop your technology, only to see it outdated
or outmoded by other fast-changing industry developments, for example, when everyone went from DOS to Windows a lot
of people lost BIG on their software investments... same for each upgrade of DirectX...
Well, this time you are in for a nice surprise...
"your dreams have become reality..."
Source code developed using different versions of the TDx_Library is backwards-compatible for the most part.
Your v1.6x source code will work with v1.7x and v1.8x++ without any changes...
- Want More Information? Click Below...
|
|