public void SetUp()
 {
     AppControl.SetUpApplication();
     form = new D3DHostForm();
     con = new D3DHostControl();
 }
Пример #2
0
 void SetParent(D3DHostControl parent)
 {
     this.hostControl = parent;
     this.hostControl.SetEngine(this);
 }
Пример #3
0
        public virtual void Init(D3DHostControl control)
        {
            DisposeManaged();

            this.control = control;
            DXGI.SampleDescription sampledesc = new SlimDX.DXGI.SampleDescription(1, 0);
            DXGI.ModeDescription modedesc = new SlimDX.DXGI.ModeDescription()
            {
                Format = DXGI.Format.R8G8B8A8_UNorm,
                RefreshRate = new Rational(60, 1),
                Width = control.Width,
                Height = control.Height
            };

            DXGI.SwapChainDescription swapchaindesc = new SlimDX.DXGI.SwapChainDescription()
            {
                ModeDescription = modedesc,
                SampleDescription = sampledesc,
                BufferCount = 1,
                Flags = DXGI.SwapChainFlags.None,
                IsWindowed = true,
                OutputHandle = control.Handle,
                SwapEffect = DXGI.SwapEffect.Discard,
                Usage = DXGI.Usage.RenderTargetOutput
            };

            D3D.DeviceCreationFlags deviceflags = D3D.DeviceCreationFlags.None;

            D3D.Device device = null;
            DXGI.SwapChain swapchain = null;
            D3D.Device.CreateWithSwapChain(null, D3D.DriverType.Hardware, deviceflags, swapchaindesc, out device, out swapchain);
            this.Device = device;
            this.SwapChain = swapchain;

            SetSize(control.Width, control.Height);
            SetBlendState(true);
        }