Vorbereitung
Zuerst muss das DirectX-SDK auf dem Festplatte installiert werden und dann sind wir praktisch schon fertig. Um ein Grundgerüst zu haben bauen wir uns noch eben ein Grundgerüst. Hier ist der Code für die Fensterklasse "D3DWindow":
D3DWindow.cs:
using System; using System.Drawing; using System.Windows.Forms; namespace DXTutorial { public class D3DWindow : Form { public D3DWindow() { this.ClientSize = new System.Drawing.Size(640,480); this.Text = "DX Tutorial by ArcanumDesign"; } } }
Hier kommt später der DirectX-Code rein. Jetzt muss nur ncoh in der Hauptfunktion eine Instanz der Klasse und eine Hauptschleife erstellt werden.
Main.cs:
using System; using System.Windows.Forms; namespace DXTutorial { class MainClass { public static void Main(string[] args) { using( D3DWindow m_AppWnd = new D3DWindow()) { m_AppWnd.Show(); while(m_AppWnd.Created) { Application.DoEvents(); } } } } }
Tja, das wars schon.
Downloads
Source & Binaries [Download]