Welcome to the DX-Corner column. In this column we will explore the COM interoperability of DirectX and focus on game programming with C#. In the upcoming issues I will teach you the basics of 2D game programming by using the DirectDraw and DirectInput classes of DirectX. I will explain how to write a 2D game engine which you can customize and integrate within your game, Artificial intelligence programming and Network uplinking by using DirectPlay.
Before we can start all that funky stuff, let's take a quick look at DirectX and find out what it all means.
What is DirectX?
DirectX is a programmers API which take the advantage of device independent functions to simplify game related tasks performed by the computer. The DirectX API handles most of the I/O aspects you need at a very low-level, and therefore it will certainly payoff to make the no usage of the standard Windows I/O functions provided by the GDI in order to gain as much speed as possible.
Below you will find the set of classes included within DirectX.
The DirectX COM object
|Class Name ||Purpose|
|DirectDraw ||2D drawing functions for processing buffered screens |
|Direct3D ||3D drawing output functions for processing buffered screens |
|DirectInput ||Provides keyboard, joystick and mouse input handling|
|DirectSound ||Soundcard independent handler for playing sounds|
|DirectMusic ||Soundcard independent handler for playing and mixing midi based music compositions|
|DirectPlay ||A game network messaging model for a vast range of protocols.|
As you can see, the DirectX has a rich set of sub-classes which you can use for your application. You will learn how to create a nice wrapper for each of the class objects in order to simplify the class functions even more and make it easy to use for any future DirectX enabled project you want to write.
Are you all exited yet? Let's take a deep breath and start with the first article!