The type or namespace name 'Device' could not be found (are you missing a using directive or an assembly reference... what to do to resolve this???
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Samples.DirectX.UtilityToolkit;
namespace BattleTank2005
{
public partial class GameEngine : Form
{
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 behaves
PresentParameters presentParams = new PresentParameters();
presentParams.SwapEffect = SwapEffect.Discard;
// Make sure we are in windowed mode when we are debugging
#if DEBUG
presentParams.Windowed = true;
#endif
// Now create the device
device = new Device(adapterOrdinal, DeviceType.Hardware, this,
createFlags, presentParams);
// force the window to a standard size
// the provides the correct aspect ratio of 1.33
this.Size = new Size(800, 600);
}
protected override void OnPaint(PaintEventArgs e)
{
deltaTime = FrameworkTimer.GetElapsedTime();
this.Text = string.Format("The framerate is {0}",FrameRate.CalculateFrameRate());
FrameworkTimer.Start();
device.Clear(ClearFlags.Target, Color.DarkBlue, 1.0f, 0);
device.Present();
this.Invalidate();
}
private void GameEngine_Load(object sender, EventArgs e)
{
}
private double deltaTime;
private Device device;
}
}