E
emr
Hi, just downloaded DirectX SDK (latest one) and found an example but it
doesn't work. So any1 can tell me what the heck is with the Main() method
what did this guy do? Thanks.
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();
}
public void InitializeDevice()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, presentParams);
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs
e)
{
device.Clear(ClearFlags.Target, Color.DarkSlateBlue , 1.0f,
0);
device.Present();
}
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 Tutotial";
}
static void Main()
{
using (WinForm dx_form = new WinForm())
{
dx_form.InitializeDevice();
Application.Run(dx_form);
}
}
}
}
doesn't work. So any1 can tell me what the heck is with the Main() method
what did this guy do? Thanks.
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();
}
public void InitializeDevice()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, presentParams);
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs
e)
{
device.Clear(ClearFlags.Target, Color.DarkSlateBlue , 1.0f,
0);
device.Present();
}
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 Tutotial";
}
static void Main()
{
using (WinForm dx_form = new WinForm())
{
dx_form.InitializeDevice();
Application.Run(dx_form);
}
}
}
}