|
TUTORIAL -
USING
THE
TDx_LIBRARY
|
|
This tutorial is best viewed in 1024 x 768 screen resolution or better.
BACKGROUND INFORMATION
Top
Next
The TDx_Library translates DirectX programming elements into the equivalent Borland C++ Builder components,
with each of the various sections of DirectX converted into BCB component libraries.
For example, DirectX consists of the following elements, which correspond 1:1 with it's relevant TDx_Library :-
DIRECTX SUBSECTION |
RESULTING TDX_LIBRARY |
WHAT IT DOES |
STATUS |
DirectDraw(tm) |
TDx_Draw_Library |
Advanced 2D Graphics, Bit-Blitting Effects, Multi-Monitor Support, Videoports, etc. |
ONLINE |
DirectSound(tm) |
TDx_Sound_Library |
Advanced 2D & 3D Sound Effects, Sound Recording, etc. |
ONLINE |
DirectInput(tm) |
TDx_Input_Library |
Advanced Input Device Control, Force Feedback Devices, etc. |
ONLINE |
DirectPlay(tm) |
TDx_Play_Library |
Advanced MultiPlayer, Peer-To-Peer, Client-Server, TCP & IPX, etc. |
ONLINE |
Direct3D Immediate Mode (tm) |
TDx_3DI_Library |
Advanced 3D Graphics, Objects, Patterns, Lighting, Texturing, etc. |
ONLINE |
Each of the available libraries consists of a number of different components, for example, the TDx_Draw_Library
contains 24 individual components made up of 3 different component types currently used in the TDx_Library :-
These components supply all the functionality originally in the DirectX SDK as well as adding some more
functionality designed to make DirectX work easier than usual.
Depending on the type of component, the "wrapping" processes differ significantly.
You can read more information about the different wrapping processes on the separate "How It Works" tutorial.
THE "WRAPPING" PROCESSES EXPLAINED
Top
Next
Prev
The various "wrapping" processes used by the TDx_Library are different for each type of component.
For "Wrapper" components, it's a matter of translating a single DirectX structure into a single BCB component.
For "MultiWrapper" components, it's a matter of translating multiple DirectX structures into a single BCB component.
For "Interface" components, it's a matter of translating various DirectX methods into a single BCB component.
The details of particular "Wrapper and MultiWrapper translations" are listed below :-
DIRECTX STRUCTURE MEMBER TYPE |
BCB COMPONENT PROPERTY TYPE |
TRANSLATION DETAILS |
CONST GUID* |
CONST GUID* |
Not Translated |
D3DVALUE |
D3DVALUE |
Not Translated |
D3DVECTOR |
D3DVECTOR |
Not Translated |
D3DLIGHTTYPE |
D3DLIGHTTYPE |
Not Translated |
D3DCOLOR |
D3DCOLOR |
Not Translated |
HANDLE |
HANDLE |
Not Translated |
LPWAVEFORMATEX |
LPWAVEFORMATEX |
Not Translated |
BOOL |
bool |
Simple Translation |
BYTE |
byte |
Simple Translation |
BYTE[] (array) |
byte[] (array) |
Simple Translation |
WORD[] (array) |
word[] (array) |
Simple Translation |
DWORD |
dword |
Simple Translation |
dwSize structure element |
Size property |
== sizeof(ObjectStructureName) |
LONG |
long |
Simple Translation |
FLOAT |
float |
Simple Translation |
LPDWORD |
dword* |
Simple Translation |
LPLONG |
long* |
Simple Translation |
LPVOID |
void* |
Simple Translation |
LARGE_INTEGER |
large_int |
Simple Translation |
GUID |
GUID |
Not Translated |
CHAR |
char |
Simple Translation |
CHAR[] |
AnsiString |
Complex Translation |
WCHAR |
wchar |
Simple Translation |
WCHAR[] |
AnsiString |
Complex Translation |
TCHAR[] |
AnsiString |
Complex Translation |
LPSTR |
AnsiString |
Complex Translation |
LPWSTR |
AnsiString |
Complex Translation |
RECT |
TRect |
Complex Translation |
Structure In Structure |
TComponent* |
Complex Translation
Includes cross-component syncronization.
|
Pointer To Structure |
TComponent* |
Complex Translation
Includes cross-component syncronization.
|
Pointer To Interface |
TComponent* |
Complex Translation
Includes cross-component syncronization.
|
DirectX function Return Values for various "Interface translations" depend on various
conditions and those that have been used are listed below :-
DIRECTX FUNCTION RETURN TYPE |
BCB COMPONENT METHOD RETURN TYPE |
TRANSLATION DETAILS |
HRESULT |
bool |
Simple Translation |
HRESULT |
HRESULT |
Not Translated |
BOOL |
bool |
Simple Translation |
bool |
bool |
Not Translated |
void |
void |
Not Translated |
VOID |
void |
Simple Translation |
ulong |
ulong |
Not Translated |
ULONG |
ULONG |
Not Translated |
Function modifiers that have been converted for various "Interface translations" are listed below :-
DIRECTX FUNCTION MODIFIERS |
BCB COMPONENT METHOD MODIFIERS |
TRANSLATION DETAILS |
FAR PASCAL |
static __stdcall |
Simple Translation |
WINAPI |
static __stdcall |
Simple Translation |
WINAPI (CALLBACK) |
virtual __fastcall |
Complex Callback Translation |
(CALLBACK) |
static __stdcall |
Complex Callback Translation |
all others |
virtual __fastcall |
Simple Translation |
Method parameter values for various "Interface translations" are listed below, and depending
on the settings of the BCB_Code_Generator, are handled differently.
For example, some methods "must be" a given value, are not actually required and have been excluded during translation.
Other methods "cannot be" certain values.
DIRECTX FUNCTION PARAMETER TYPE |
BCB COMPONENT METHOD PARAMETER TYPE |
TRANSLATION DETAILS |
GUID* |
GUID* |
Not Translated |
D3DVALUE |
D3DVALUE |
Not Translated |
D3DVALUE* |
D3DVALUE* |
Not Translated |
D3DSTATEBLOCKTYPE |
D3DSTATEBLOCKTYPE |
Not Translated |
D3DPRIMITIVETYPE |
D3DPRIMITIVETYPE |
Not Translated |
D3DRENDERSTATETYPE |
D3DRENDERSTATETYPE |
Not Translated |
D3DTEXTURESTAGESTATETYPE |
D3DTEXTURESTAGESTATETYPE |
Not Translated |
D3DTRANSFORMSTATETYPE |
D3DTRANSFORMSTATETYPE |
Not Translated |
HDC |
HDC |
Not Translated |
HDC* |
HDC* |
Not Translated |
HANDLE |
HANDLE |
Not Translated |
HMONITOR |
HMONITOR |
Not Translated |
HWND |
HWND |
Not Translated |
HWND* |
HWND* |
Not Translated |
DPID |
DPID |
Not Translated |
REFGUID |
REFGUID |
Not Translated |
REFIID |
REFIID |
Not Translated |
REFCLSID |
REFCLSID |
Not Translated |
BOOL* |
bool* |
Simple Translation |
WORD |
word |
Simple Translation |
DWORD |
dword |
Simple Translation |
DWORD* |
dword* |
Simple Translation |
LONG |
long |
Simple Translation |
ULONG |
ulong |
Simple Translation |
ULONG* |
ulong* |
Simple Translation |
LPDWORD |
dword* |
Simple Translation |
LPLONG |
long* |
Simple Translation |
LPWORD |
word* |
Simple Translation |
LPGUID |
GUID* |
Simple Translation |
LPVOID |
void* |
Simple Translation |
LPVOID* |
void** |
Simple Translation |
LPDPID |
DPID* |
Simple Translation |
LPCGUID |
const GUID* |
Simple Translation |
LPCVOID |
const void* |
Simple Translation |
LPSIZE |
SIZE* |
Simple Translation |
LPPOINT |
POINT* |
Simple Translation |
LPPALETTEENTRY |
PALETTEENTRY* |
Simple Translation |
LPRGNDATA |
RGNDATA* |
Simple Translation |
LPWAVEFORMATEX |
WAVEFORMATEX* |
Simple Translation |
LPD3DVALUE |
D3DVALUE* |
Simple Translation |
LPD3DVECTOR |
D3DVECTOR* |
Simple Translation |
LPCWAVEFORMATEX |
const WAVEFORMATEX* |
Simple Translation |
BOOL |
bool |
Simple Translation |
LPBOOL |
bool* |
Simple Translation |
LPRECT |
TRect* |
Complex Translation |
LPCSTR |
AnsiString |
Complex Translation |
LPCTSTR |
AnsiString |
Complex Translation |
(CALLBACKS) |
-none- |
Not Required. Callbacks are now On###() events |
LPCTSTR |
AnsiString |
Complex Translation |
Copy Of Structure |
TComponent* |
Complex Translation Includes cross-component synchronization |
Pointer to Structure |
TComponent* |
Complex Translation Includes cross-component synchronization |
Pointer to Array of Structures |
TComponent* |
Complex Translation Includes cross-component synchronization |
Pointer to Interface |
TComponent* |
Complex Translation Includes cross-component synchronization |
Pointer to Pointer to Interface |
TComponent* |
Complex Translation Includes cross-component synchronization |
"BITS" ADDED TO THE TDX_LIBRARY TO MAKE IT EASIER TO USE
Top
Next
Prev
Each individual library has had to be coded to take into account all the various
"quirkiness" of any given DirectX subsection, such as callbacks, hidden threads and multiwrappers.
The added "bits" available in the currently released components are :-
ADDED BITS |
DESCRIPTION |
DirectX Structures |
DirectX structures have been converted into Wrapper or MultiWrapper components.
- You can easily access the internal DirectX structure(s) inside each component.
- The components have in-built error checking, such as out-of-range errors.
|
DirectX Structure Members |
DirectX structure members have been converted into BCB Properties
- Most BCB Properties directly modify the relevant structure member.
- Some structure members have "shadow" properties, the original and a synchronized BCB version.
- Some structures refer to other structures or interfaces, hence relevant cross-component synchonization is automatic.
|
DirectX Structure Member Flags |
All available DirectX flags are used normally or their custom "shadow" BCB Properties.
- Most DirectX flags have been converted to TSet<>'s, used in the Object Inspector for setting flags.
- For example, take a look at TDDCaps source code, especially things like TDDCaps::Caps and TDDCapsCaps_Set<>
- You can get a TStringList of the current values of the custom BCB Properties.
|
DirectX Interfaces |
DirectX interfaces have been converted into BCB components.
- You can easily access the internal DirectX interface(s) inside each component.
- The components maintain their DirectX interfaces automatically using Create() and Destroy().
- Automatic creation, destruction of interfaces and OnCreate() and OnDestroy() events make life easy.
- The components have built-in error detection and reporting using OnError() and an ErrorValue property.
|
DirectX Interface Functions |
DirectX function interfaces have been converted into equivalent BCB component methods.
- Some parameters have been changed, some require component pointers, some not required.
- Some methods automatically cascade passed-in data elements.
- Some methods call call On###() events.
|
DirectX Interface Function Flags |
DirectX function parameters flags are used normally.
|
DirectX Callbacks |
DirectX callback functions have been converted into easy-to-use BCB component On###() events.
- Callback event parameters have been converted from DirectX structures to BCB components.
|
DirectX Win32 Event Queue's |
DirectX often generates win32 events, in the main win32 event queue...
- Handling of the win32 events, and the handling of the win32 event queue is automatic.
- Hidden threads monitor the win32 event queue and redirect events to easy-to-use BCB On###() events.
|
MORE INFORMATION
Top
Prev
For more information, choose from the following links :-
|
|