Clootie graphics pages - Articles

 Compiling fusion DirectX projects: Delphi/C++Builder
  • Introduction
  • What additional files do you need?
  • Actions

  • Introduction

    This page describes which additional files you will need and actions you should take to compile fusion DirectX projects between Borland C++Builder and Borland Delphi. More precisely this article describes steps you should take to inject ObjectPascal DirectX code in C++Bulder projects. Final result can be seen in Nitro Font renderer sample.
    Article is written based on C++Builder 5 IDE.

    What additional files do you need?

    1. C++Builder library pack
      [ Direct3D 8.0b version / Direct3D 8.1 version / Direct3D 9.0 version ]
    2. Direct3D headers for Delphi - small version. Or you can download whole version which includes D3DX8 helper DLL's noted below
      [ for DirectX 8.0b / for DirectX 8.1 / for DirectX 9.0 ]
    3. DLL needed for both Delphi and C++ Builder, to use D3DX8 functionality
      [ for DirectX 8.0b / for DirectX 8.1 / for DirectX 9.0 ]
      It's recommended to place these DLLs in Windows system directory.
    4. Original DirectX SDK include files / and samples source /
      [ can be downloaded here ]
    5. Final result ;-)
      At least for ObjectPascal source code and font binary file (DirectX 8.x sample).
      [ Nitro Font renderer sample ]


    As base C++ project we will take Text3D sample from MS DirectX 8.0 SDK and make it use Delphi TNitroFont font renderer class instead of CD3DFont C++ class.
    1. Copy original MS DirectX 8.0 SDK sample to directory structure described in: C++ Builder special actions in "How to compile ObjectPascal DirectX examples" just like any ObjectPascal sample (this is needed so we can used "fixed relative paths" in project options).
    2. Copy 'Common\inc' and 'Common\scr' directories from MS DirectX 8.0 SDK 'Samples\Multimedia' directory - or you will need to modify "Include Path" in C++Builder project options later to point where D3D sample framework source code is.
    3. Convert MS VC sample to use with C++Builder as desribed here and try to compiler it.
    4. Close project in C++Builder.
    Main actions
    1. As C++Builder VC convertion wizard genarated wrong project options flags for ObjectPascal compiler you should modify them. So not opening project in C++Builder IDE open BPR project file in any text editor (like notepad), find <PFLAGS> entity and modify it to: <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>. After what you could open project in C++Builder.
    2. Copy NitroFnt.pas in Text3D sample directory and add it to project.
    3. In text3d.cpp source you will need to add '#include "NitroFnt.hpp";' and make modifications to source what you would like. Instead you can just copy/paste source from already modified text3d.cpp from provided sample code.
    4. Under 'Project\Options\"Directories / Conditionals"' tab you should add:
      in "Include Path": '($BCB)\include\vcl;..\..\Headers' - for ObjectPascal RTL/VCL pregenerated inc files and ObjectPascal DirectX headers
      in "Library Path"'($BCB)\lib\obj;..\..\Headers' - for ObjectPascal RTL/VCL precompiled obj files and ObjectPascal DirectX headers.
    5. Copy 'text.fnt' binary font file to Release subdirectory.
    6. Push Compile button!

    Please inform me of any grammar or general errors, contained on these pages, Alexey Barkovoy
    Last updated: 28-Feb-2003