Device Class
.NET Framework 3.0
The parent object of all graphical objects in the scene.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
Microsoft.WindowsMobile.DirectX.Direct3D Namespace
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
The following code example creates a device.
public class CreateDevice : Form { // Set global variables for this project. Device device = null; public CreateDevice() { // Set the initial size of the form. this.ClientSize = new System.Drawing.Size(400, 300); // Set the caption for the form. this.Text = "D3D Tutorial 01: CreateDevice"; } public bool InitializeGraphics() { try { // Set up presentation parameters and create the // Direct3D device. PresentParameters presentParams = new PresentParameters(); presentParams.Windowed = true; presentParams.SwapEffect = SwapEffect.Discard; device = new Device(0, DeviceType.Default, this, CreateFlags.None, presentParams); return true; } catch (DirectXException) { return false; } } private void Render() { if (device == null) return; //Clear the backbuffer to a blue color. device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0); //Begin the scene. device.BeginScene(); // Rendering scene objects, if desired. //End the scene. device.EndScene(); device.Present(); } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { // Render on painting. this.Render(); } protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e) { if ((int)(byte)e.KeyChar == (int)System.Windows.Forms.Keys.Escape) // Handle the ESC key being pressed. this.Close(); } /// <Summary> /// The main entry point for the application. /// </Summary> static void Main() { using (CreateDevice DeviceForm = new CreateDevice()) { // Initialize Direct3D. if (!DeviceForm.InitializeGraphics()) { MessageBox.Show("Could not initialize Direct3D. This tutorial will exit."); return; } DeviceForm.Show(); // While the form is still valid, render and process messages. // while (DeviceForm.Created) //{ DeviceForm.Render(); Application.DoEvents(); //} } } }
System.Object
Microsoft.WindowsMobile.DirectX.Direct3D.BaseMesh
Microsoft.WindowsMobile.DirectX.Direct3D.Device
Microsoft.WindowsMobile.DirectX.Direct3D.BaseMesh
Microsoft.WindowsMobile.DirectX.Direct3D.Device
Reference
Device MembersMicrosoft.WindowsMobile.DirectX.Direct3D Namespace
Other Resources
Direct3D ProgrammingCommunity Additions
ADD
Show: