Managed DirectX First Steps: Direct 3D Basics and DirectX vs. GDI+ - The Application Proposal
(Page 7 of 14 )
Our proposal for this chapter sample is to create a simple application that will help you to understand the basics of DirectX, so you can apply this knowledge to creating games in coming chapters.
To accomplish this, you’ll create an application that will test your machines and return the capabilities of the installed hardware and software, and also run some tests that will give you the necessary information on how to:
- Create an application that runs in windowed mode.
- Create an application that runs in full-screen mode.
- Create an application that shows a transparent sprite using texture capabilities.
- Create an application that deals with lighting, using different light colors. Although we won’t explore this feature extensively in this book, it’s quite useful to learn the basics of lighting, so you can create interesting effects in your games.
- Create an application that deals with basic matrix transformations, which will be very useful in your games because they provide a built-in capability to translate (move around the screen), rotate around an axis, and scale any preloaded images to different sizes.
You’ll create a separate window for each of the tests listed previously, and all the tests will execute the same drawing procedure—one that will present the walking man textures at full speed on screen in order to give you an idea of how fast your 3-D acceleration board really is.
In the next section, we’ll discuss some extra details about this sample application.
The Application Project This application project will be very straightforward; you can’t add too much detail to it for now, because you’ll be focusing on what you can do with Direct3D in this chapter.
The coding phase will be divided into six steps, as described in the following list, each one exploring additional features involved in the Direct3D application:
Create a main window with four list boxes that will show you the machine adapters, the devices for each adapter, the display modes for each device, and the device capabilities. From the main window, present the other windows that will do each of the tests defined in the project proposal. The main window is shown in the Figure 3-19.

Figure 3-19. The main window interface
2. Create a DirectX windowed test that will use a set of textures
to produce the illusion of a walking man.
3. Adjust the code from the previous step to create a DirectX
application that runs in full-screen mode.
4. Create a new DirectX windowed test, from the test created in
step 2, to test the use of transparent textures. For this test,
you’ll create an image with transparent parts that can be moved
with the mouse, so you can see that it’s really transparent.
5. From the test created in step 2, create a new test that will
exemplify the use of lighting. For this test you’ll create a control
window that will allow you to change each of the RGB
components of the diffuse light colors in each of the figure
vertices. Figure 3-20 presents the interface that you’ll use to
control the light colors.

Figure 3-20. The Light Control window
6. Your last test will demonstrate the use of matrix transformations
on 3-D shapes. For this you’ll create a cube and a window that
will control the matrix transformations on it. You’ll also add an
option to make the figure move automatically while the shape
rotates. The matrix transformations control window is shown in
Figure 3-21.

Figure 3-21. The MatrixControl window
In the next section, you’ll start coding your application, starting from the main window code.
This chapter is from Beginning .NET Game Programming in C# by David Weller et. al.(Apress, 2004, ISBN: 1590593197). Check it out at your favorite bookstore today. Buy this book now.
|
Next: The Coding Phase >>
More ASP.NET Articles
More By Apress Publishing