EKsumic's Blog

let today = new Beginning();

Click the left button to use the catalog.

OR

从零开始的SharpDX(一)——创建SharpDX窗口

开发环境:Visual Studio 2019

新建项目:.NET Framework 的控制台

需要nuget的包有:

  • SharpDX
  • SharpDX.D3DCompiler
  • SharpDX.Desktop
  • SharpDX.Direct2D1
  • SharpDX.Direct3D11
  • SharpDX.DXGI

Nuget-Package

完整代码:

using SharpDX.Windows;
using System;
using System.Drawing;

namespace CreateWindow
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var temp = new CreateSharpDXWindow())
            {
                temp.Run();
            }
        }
    }
    class CreateSharpDXWindow : IDisposable
    {
        private RenderForm _renderForm;
        private const int Width = 1280;
        private const int Height = 720;

        public CreateSharpDXWindow()
        {
            _renderForm = new RenderForm();
            _renderForm.ClientSize = new Size(Width, Height);
        }
        public void Run()
        {
            RenderLoop.Run(_renderForm, RenderCallback);
        }
        private void RenderCallback()
        {

        }
        public void Dispose()
        {
            _renderForm?.Dispose();
        }
    }
}

下一篇:从零开始的SharpDX(二)——初始化DirectX并修改颜色

This article was last edited at 2020-07-01 18:10:28

* *