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
Erik Unger’s headers give Delphi developers access to DirectDraw, DirectSound, DirectInput, DirectPlay, DirectSetup, and Direct3D. This is the full functionality available under all of these DirectX subsystems, including force feedback and 3-D sound. The DXTools unit accompanying the files also includes several utility functions, such as testing the return results of DirectX methods and performing matrix manipulations. Throughout the course of this book, we will develop a utility unit converted from a C/C++ utility unit shipping with the DirectX SDK that simplifies several menial tasks such as loading a bitmap, a WAV file, or a palette. Later in this chapter, we will begin to use our utility unit and Erik’s header files to create a baseline DirectX application from which all other examples in this book are based.
| Tip: While the latest headers at the time of the writing were used for all of the book’s examples, it is quite possible that the headers will have gone through several more versions by the time this book goes to print. The examples in this book will compile with the headers included on the CD, but you should get the latest headers from the JEDI page to have access to all the newest features. Bear in mind that the book examples may require a little adjustment when used with the new headers, as method declarations may have changed.
#### Other Components and Headers Fortunately, the Delphi gaming community is starting to see a rise in the number of available DirectX headers and components. Some are freely available, others you must purchase, but all of them give the Delphi developer a little more functionality than the raw headers accompanying this book. DelphiX A freeware component suite written by Hiroyuki Hori, DelphiX comes complete with source code and gives the developer access to DirectDraw, Direct3D, DirectSound, DirectInput (including force feedback support), and DirectPlay. There are several cool components in this suite which allow the developer to bundle graphics and sound into compressed libraries, and includes some awesome alpha blending functionality. The examples clearly demonstrate some of the advanced techniques capable with DelphiX, and there are several freeware tools available that make editing sound and graphics libraries easy. For more information, check out http://www.ingjapan.or.jp/hori/indexe.html. The Delphi Games Creator (DGC) Another freeware component suite, the DGC gives developers access to DirectDraw, DirectSound, DirectPlay, and DirectInput. Written by John Pullen, Paul Bearne, and Jeff Kurtz, the DGC comes complete with source code. The DGC also comes with editors for bundling sound and graphics into libraries, and will map all images in a graphics library to a single palette. Palette cycling and cool transition effects are just some of the added functionality available with this component suite. It also includes a scrolling map component and editor for making tile-based map engines. One of the first and oldest freeware DirectX component suites, the DGC has a large following, and is suitable for private or commercial DirectX applications. For more information, check out http://www.ex.ac.uk/~PMBearne/DGC.html. RingZero GDK Created by Systems Advisory Group Enterprises, Inc., the RingZero GDK and RingZero 3D are component suites that give the Delphi developer access to DirectDraw, DirectSound, DirectPlay, DirectInput, and Direct3D. Although these component suites must be purchased, you gain the benefit of technical support and continuing updates (which may or may not always be available with freeware components). Source code is also available. These component suites are very easy to use, and can expedite the creation of a DirectX game if you are impatient or have a pressing deadline. Unfortunately, as of this writing, these components only support DirectX 5, and can only be used under Delphi 2 or 3. However, by the time this book reaches store shelves, RingZero may be compatible with Delphi 4 and DirectX 6. For more information, check out http://www.sage-inc.com. ### A DirectDraw Tutorial DirectX has hopefully been installed to your machine by now, and we have the units required to give us access to DirectX components and functionality. At this point, we can begin exploring the world of DirectX programming and all of its nuances, pitfalls, and rewards. DirectDraw is the core, most fundamental DirectX component, and as such, is a good starting point for a discussion of DirectX programming. We will go over a good number of DirectDraw concepts, many of which are mirrored in other DirectX components. Several of the methods called and tasks performed by the DirectDraw objects are very similar, if not exact, to those of other DirectX components, such as DirectSound and DirectInput. The learning curve discussed earlier starts here, as there are quite a few concepts to explain. #### Features DirectDraw offers many features above and beyond what is available through the Win32 API. As with all DirectX components, DirectDraw gives the developer more control over graphical output than the Windows API, while providing incredible performance not attainable using GDI functions. DirectDraw provides the following features and many more for powerful Windows game programming: • Direct access to image memory, whether located in system or display memory • The ability to specify the location of surface memory (i.e., system or display memory) • Hardware acceleration for many graphical functions • Screen resolution and color depth changing on the fly • Direct control over the system palette (in full-screen mode) • Powerful page-flipping methods for incredibly fast animation In the following sections we will see how DirectDraw is used to change the display mode and color depth, how bitmaps are loaded into usable DirectDrawSurfaces, and how page-flipping animation is implemented. #### Functional Overview DirectX programming primarily consists of creating parent objects, namely objects that represent specific DirectX components, and then using these objects to create child objects that represent a specific functionality. The following illustration and discussion outline actions that will become familiar when we cover other DirectX components. DirectDraw programming consists of creating a DirectDraw object and several DirectDrawSurface objects. The DirectDraw object itself acts as a liaison between the application and the display driver. Through the DirectDraw object, we can change the display resolution and color depth as well as create individual DirectDrawSurface and DirectDrawPalette objects.
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.