I am making a game called Battle Tank and I referenced a DirectX reference just as the tutorial said but I'm getting an error saying:
1 Error, The type 'Microsoft.DirectX.Direct3D.Device' exists in both 'c:\WINDOWS\Microsoft.NET\DirectX for Managed Code\2.0.0.0_x86\Microsoft.DirectX.dll' and 'c:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.Direct3D.dll'
Here's my code to the game:
using
System;using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Drawing;using
System.Text;using
System.Windows.Forms;using
Microsoft.Samples.DirectX.UtilityToolkit;namespace
BattleTank2005{
public partial class GameEngine : Form { protected override void OnPaint(PaintEventArgs e) {deltaTime =
FrameworkTimer.GetElapsedTime(); FrameworkTimer.Start();device.Clear(ClearFlags.Target,
Color.DarkBlue, 1.0f, 0);device.Present();
this.Invalidate();}
public GameEngine(){
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); // Get the ordinal for the default adapter int adapterOrdinal = Manager.Adapters.Default.Adapter;
// Get our device capabilities so we can check them to set up the CreateFlags
Caps caps = Manager.GetDeviceCaps(adapterOrdinal, DeviceType.Hardware);
CreateFlags createFlags;
// Check the capabilities of the graphcis card is capable of // performing the vertex-processing operations // The HardwareVertexProcessing choice is the best if (caps.DeviceCaps.SupportsHardwareTransformAndLight){
createFlags = CreateFlags.HardwareVertexProcessing;
}
else{
createFlags = CreateFlags.SoftwareVertexProcessing;
}
// If the graphics card supports vertex processing check if the device can // do rasterization, matrix transformations, and lighting and shading operations // This combination provides the fastest game experience if (caps.DeviceCaps.SupportsPureDevice && createFlags == CreateFlags.HardwareVertexProcessing){
createFlags |= CreateFlags.PureDevice;
}
// Set up the PresentParameters which determine how the device behavesPresentParameters presentParams =
new PresentParameters();presentParams.SwapEffect = SwapEffect.Discard;
// Make sure we are in windowed mode when we are debugging#if
DEBUGpresentParams.Windowed =
true;#endif
// Now create the devicedevice =
new Device(adapterOrdinal,
DeviceType.Hardware,
this,createFlags,
presentParams
);
}
private double deltaTime; private Microsoft.DirectX.Direct3D.Device device;}
}

DirectX Error
J.C.
SamCKayak
I know what it means but it won't let me, here I'll tell you exactly what i'm referencing:
1. Microsoft.DirectX
Version: 2.0.0.0
Runtime Version: 2.0.50727
2. Microsoft.DirectX.Direct3D
Version: 1.0.2902
Runtime Version: 1.1.4322
I realize that they are two different versions but Microsoft has not yet released a Microsoft.DirectX.Direct3D version 2.0 yet, so that is why I had to reference two different versions, so I don't know what it wants me to do to fix it yet.
kenlefeb
that means you're referencing both versions of the .Net framework in your project. You have to go to the references and leave all assembly references from the version you don't want to use. For example, if you want to use the .net 2.0 then remove all assemblies you're referencing from the .net v1.1.
Krista
http://www.thezbuffer.com/articles/385.aspx
There will never be a Direct3dX for MDX 2.0 they put all the namespaces inside a single assembly. You only need DirectX.dll