1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
namespace Simple_fenetre_directx_3
{
public partial class Form1 : Form
{
private Device device = null;
public Form1()
{
InitializeComponent();
InitializeDevice();
}
private void InitializeDevice()
{
PresentParameters pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Reference, this, CreateFlags.SoftwareVertexProcessing, pp);
}
protected override void OnPaint(PaintEventArgs e)
{
device.Clear(ClearFlags.Target, Color.CornflowerBlue, 0, 1);
device.Present();
}
}
} |
Partager