Search Tips Advanced Search |
| Delphi Graphics and Game Programming Exposed with DirectX 7.0 by John Ayres Wordware Publishing, Inc. ISBN: 1556226373 Pub Date: 12/01/99
Search this book:
Previous | Table of Contents | Next
#### DirectX Components DirectX is comprised of many components. Indeed, it seems as if new DirectX components are added every day, and there are sure to be more and more in subsequent versions. While the inventive game developer could potentially make use of all of these DirectComponents, there are only a few that are essential for game development. In this book, we will specifically look at the DirectDraw, DirectSound, and DirectInput components. DirectDraw The DirectDraw component is responsible for all graphical output to the screen. DirectDraw objects provide functionality for such tasks as tear-free animation using page flipping techniques, access to graphical coprocessors, display memory management, and color palette manipulation. It is the core component of DirectX, and serves as the foundation for other DirectX components, such as Direct3D. DirectSound The DirectSound component is responsible for digitized audio playback. It provides stereo and 3-D sound functionality and sound card memory management. It allows the developer to asynchronously play any number of sounds, mixing them on the fly and automatically converting their format to that of the primary sound output stream. DirectInput The DirectInput component is responsible for providing the application with data retrieved from any type of input device. This not only includes the mouse and keyboard, but joysticks, flightsticks, rudder pedals, steering wheels, and other devices that have yet to be invented. DirectInput also supports output devices, such as force feedback peripherals. Other DirectX Components There are several other DirectX components that are of particular interest to game developers, but are not quite as essential as the previous three. Several of these components may be required depending on the type of game being produced, and certainly any game could be enhanced by taking advantage of the functionality represented by these components. This is not an exhaustive list by any means, but game developers may want to further investigate the following components: DirectPlay – Provides transport-independent messaging services between multiple computers. This is an essential component for multiplayer games, and includes functionality for organizing and launching a multiplayer game session. DirectSetup – Provides automated installation of DirectX drivers. Direct3D – Provides three-dimensional graphics rendering functionality. This component is segregated into low-level and high-level interfaces, which provide varying levels of control and expedience. DirectMusic – Provides playback of MIDI music compositions. This component allows developers to directly control the exact sound of each instrument, and includes the ability to mix separate MIDI compositions on the fly to achieve context-sensitive musical transitions. ### DirectX and Delphi Now that we know what DirectX is, we need to know what is required in order to use DirectX under the Delphi environment. Unfortunately, Delphi programmers do not enjoy the automatic access to DirectX resources that C/C++ developers do. If Microsoft were to include a type library along with the DirectX DLLs, it would be a simple task indeed to import the type library and immediately begin using the DirectX COM objects. Alas, this is not the case, and accessing DirectX functionality is the first obstacle that enthusiastic Delphi game developers must face. #### The DirectX SDK As a C/C++ developer, you would simply need to purchase the DirectX SDK from Microsoft and install its accompanying files to begin developing DirectX applications. As a Delphi developer, however, there is no need to purchase the DirectX SDK. All that is required is the DirectX redistributable files available for free download from Microsoft’s DirectX web site, or from the many commercial games that include them. However, it may be worth your while to purchase the DirectX SDK, as it includes many benefits. The most important thing you will gain by purchasing the SDK is the DirectX documentation. As this book is not a reference manual, it will not discuss many of the nuances of DirectX programming that are available in the hundreds of pages of DirectX documentation. Dozens of examples are also available in the SDK which, although written in C/C++, are valuable references for investigating some ofDirectX’s more powerful features. The SDK also includes a DirectX control panel applet that allows you to control numerous global settings that may be helpful during debugging. Perhaps most importantly, the DirectX SDK includes information on the files that can be distributed with your applications. While you can always suggest that your users visit the Microsoft web site to download the DirectX files if they do not already have them installed, it is a wise practice to always include all required files and DLLs with your applications. Therefore, you will need to be aware of the many legal requirements for bundling the DirectX redistributables with your applications. For more information about the DirectX SDK, check out http://www.microsoft.com/directx/resources/devdl.htm. You can order the DirectX SDK for a nominal fee by visiting http://www.microsoft.com/directx/sdkcdorder.asp. #### Project JEDI If you have the DirectX end user redistributable files installed (which you probably do if you’ve played any recent games), all you will need are the Delphi import files converted from the original DirectX C/C++ header files. All code in this book is based around the Project JEDI DirectX header files written by Erik Unger. Project JEDI (Joint Endeavor of Delphi Innovators) is a nonprofit organization composed of Delphi programmers all over the world. Their goal is to convert C/C++ header files for various APIs into Delphi import units, thus giving Delphi developers everywhere access to the same programming resources as their C/C++ cousins. Erik’s header files are a raw conversion of the original C/C++ headers, supporting DirectX 6 under Delphi 4. This gives Delphi developers the exact same functionality as would be available under C/C++. This is not a library that automates certain tasks; it is a hard-core unit containing the same low-level objects and methods that the C/C++ programmers use. This book is aimed at teaching the reader how to program DirectX, not how to use some arbitrary DirectX library. Thus, these units were the perfect choice. Indeed, after reviewing several of the DirectX examples used throughout this book, you should be able to comprehend most C/C++ examples, as the DirectX method calls are the same. This book, and the companion CD, contain the latest version of Erik’s header files at the time of publication. However, to get more information about the header files, some examples, and the latest version, check out http://www.delphi-jedi.org/DelphiGraphics/jedi-index.htm.
Previous | Table of Contents | Next

Products | Contact Us | About Us | Privacy | Ad Info | Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.