|
|
|
|
|
|
Additional info
|
|
|
|
|
Latest Forum posts
|
|
|
|
|
Ads
|
|
|
|
|
|
|
|
|
|
|
|

Opening your project window |
Welcome to the first entry of the Managed DirectX 9 Tutorial. This tutorial is aimed at people who haven't done any 3D programming so far and would like to see some results in the shortest possible time. To this end, C# is an ideal programming language. C# is a relatively easy language, so anyone who has some basic programming experience should be able to start right away. Even more, this tutorial is written in such a way that anyone who has any programming experience should be able to understand and complete it.
The required software to start writing your own DirectX 9 code :
A C# programming environment. Popular is Visual Studio .NET, but you can also download the free evaluation version of Borland C# Builder. Recently, Microsoft has released a free version of Visual Studio, Visual Studio Express, which you can download here: (link) The .NET framework. (free) (link) And of course the DirectX9 SDK. (free) (link)
With all this software installed, you can start a new C# Application. To do this in Visual Studio, click the File menu and select New. As project type, we of course need Visual C#. Now on the right, you can select Windows Application. Fill in the name, and hit the OK button!
Now you should see a small empty form. To switch to the code, find Program.cs at the right of your screen. Right click on it and select View code. Next, you should add a reference to Microsoft.DirectX and to Microsoft.DirectX.Direct3D. This is how you do it: in Visual Studio, go to the Project menu, and select ‘Add reference…’. In the list that comes up, pick Microsoft.DirectX and Microsoft.DirectX.Direct3D. Be sure NOT to select DirectX version 2.0. Also add the following lines to you using-block, so your program can use the referenced libraries:
using Microsoft.DirectX; using Microsoft.DirectX.Direct3D;
Compiling this will already give you an empty form. Now we want to change the size and the title of it. To do this, simply find the InitializeComponent() method and change the size to (500,500) and the title (= this.Text) to "DirectX Tutorial" or whatever you like.
Next we are going to change the Main() method a bit:
static void Main() { using (WinForm our_directx_form = new WinForm()) { Application.Run(our_directx_form); } }
You are now ready to start programming with DirectX! Compiling this code should give you a small form.

Click here to go to the forum on this chapter!
Or click on one of the topics on this chapter to go there: WinForm not found
using System;
using System.Collections.Ge...download links outdated Hey Riemer
The links on this page have expired ...System.BadImageFormatException I'm working on a 64bit laptop and just installed ...Add Reference to Microsoft.Direct3D Hi, I'm new to Game development, but have been us...Microsoft.Samples.DirectX.UtilityToolkit (Hey the topic is exactly 40 chars! And sorry if t...Opening your project window K been stuck on this for hours now lol.
I cant ma...Build Error When im done with the code and debug i get a build...not win 32 application Helo,
I have visoual studio 2005 prof edition, ...Why am i gettin CMD window... Why am i gettin CMD window... i dont want the cons...Run .exe file Hi, I'm a C# n00b,
I have followed this tutorial...WinForm or Form? I'm not sure if this is right, but using Visual S...starting yes when i create the windows application in the c...Linking Errors Hi, I'm using VSC++ 2005. The program compiles, ...Linking Errors Hi, I'm using VSC++ 2005. The program compiles, ...initialize component method where is the initialize component() method? The on...Problem... When I put in all the code that you said, I got th...where should I start write code? Hello, I am new in DirectX programmin.
I am using...Error.. Hi,
when i type :
using Microsoft.DirectX.Di...
After each chapter I will list the whole code so far, so this is what you should have by now :
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; namespace DirectX_Tutorial { public class WinForm : System.Windows.Forms.Form { private Device device; private System.ComponentModel.Container components = null; public WinForm() { InitializeComponent(); } protected override void Dispose (bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.Size = new System.Drawing.Size(500,500); this.Text = "DirectX Tutorial"; } static void Main() { using (WinForm our_dx_form = new WinForm()) { Application.Run(our_dx_form); } } } }
- Website design & XNA + DirectX code : Riemer Grootjans - ©2003 - 2008 Riemer Grootjans
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007 - 2008 MVP Award DirectX - XNA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Support this site -- any amount is welcome !
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|