Пример #1
0
    private void Start()
    {
        factory3   = new Factory3();                        // to wywołanie tworzy instancję Service3 i innych klas, których wywołania zawiera factory
        service3If = factory3.Service3();

        Debug.Log("Name is: " + service3If.Name);
    }
 public Registration Register(string name, Factory3 factory)
 {
     return(null);
 }
 public Registration Register(string name, Factory3 factory) { return null; }
Пример #4
0
 /// <summary>	
 /// Initializes a new instance of the <see cref="Device2"/> class.
 /// </summary>	
 /// <param name="factory"><para>The <see cref="Factory3"/> object used when creating  the <see cref="SharpDX.Direct2D1.Device2"/>. </para></param>	
 /// <param name="device"><para>The <see cref="SharpDX.DXGI.Device"/> object used when creating  the <see cref="SharpDX.Direct2D1.Device2"/>. </para></param>	
 /// <remarks>	
 /// Each call to CreateDevice returns a unique <see cref="SharpDX.Direct2D1.Device2"/> object.The <see cref="SharpDX.DXGI.Device"/> object is obtained by calling QueryInterface on an ID3D10Device or an ID3D11Device.	
 /// </remarks>	
 /// <unmanaged>HRESULT ID2D1Factory3::CreateDevice([In] IDXGIDevice* dxgiDevice,[Out] ID2D1Device2** d2dDevice2)</unmanaged>	
 public Device2(Factory3 factory, SharpDX.DXGI.Device device)
     : base(IntPtr.Zero)
 {
     factory.CreateDevice(device, this);
 }
Пример #5
0
        public Window(SwapChainPanel panel, Aiv.Fast2D.UWP.IGame game)
        {
            this.context = panel;
            this.game    = game;

            using (D3D11.Device defaultDevice = new D3D11.Device(D3D.DriverType.Hardware, D3D11.DeviceCreationFlags.Debug))
            {
                this.device = defaultDevice.QueryInterface <D3D11.Device2>();
            }

            // Save the context instance
            this.deviceContext = this.device.ImmediateContext2;

            // Properties of the swap chain
            SwapChainDescription1 swapChainDescription = new SwapChainDescription1()
            {
                // No transparency.
                AlphaMode = AlphaMode.Ignore,
                // Double buffer.
                BufferCount = 2,
                // BGRA 32bit pixel format.
                Format = Format.R8G8B8A8_UNorm,
                // Unlike in CoreWindow swap chains, the dimensions must be set.
                Height = (int)(this.context.RenderSize.Height),
                Width  = (int)(this.context.RenderSize.Width),
                // Default multisampling.
                SampleDescription = new SampleDescription(1, 0),
                // In case the control is resized, stretch the swap chain accordingly.
                Scaling = Scaling.Stretch,
                // No support for stereo display.
                Stereo = false,
                // Sequential displaying for double buffering.
                SwapEffect = SwapEffect.FlipSequential,
                // This swapchain is going to be used as the back buffer.
                Usage = Usage.BackBuffer | Usage.RenderTargetOutput,
            };

            // Retrive the DXGI device associated to the Direct3D device.
            using (Device3 dxgiDevice3 = this.device.QueryInterface <Device3>())
            {
                // Get the DXGI factory automatically created when initializing the Direct3D device.
                using (Factory3 dxgiFactory3 = dxgiDevice3.Adapter.GetParent <Factory5>())
                {
                    // Create the swap chain and get the highest version available.
                    using (SwapChain1 swapChain1 = new SwapChain1(dxgiFactory3, this.device, ref swapChainDescription))
                    {
                        this.swapChain = swapChain1.QueryInterface <SwapChain2>();
                    }
                }
            }

            // Obtain a reference to the native COM object of the SwapChainPanel.
            using (ISwapChainPanelNative nativeObject = ComObject.As <ISwapChainPanelNative>(this.context))
            {
                // Set its swap chain.
                nativeObject.SwapChain = this.swapChain;
            }

            // Create a Texture2D from the existing swap chain to use as
            D3D11.Texture2D backBufferTexture = D3D11.Texture2D.FromSwapChain <D3D11.Texture2D>(this.swapChain, 0);
            this.renderTargetView = new D3D11.RenderTargetView(this.device, backBufferTexture);



            FinalizeSetup();

            width  = (int)this.context.RenderSize.Width;
            height = (int)this.context.RenderSize.Height;

            scaleX = 1;
            scaleY = 1;



            this.SetViewport(0, 0, width, height);

            // for now disable only backface culling
            D3D11.RasterizerStateDescription rasterizerDescription = D3D11.RasterizerStateDescription.Default();
            rasterizerDescription.CullMode      = D3D11.CullMode.None;
            this.deviceContext.Rasterizer.State = new SharpDX.Direct3D11.RasterizerState(this.device, rasterizerDescription);

            vsync = 1;

            CompositionTarget.Rendering += this.Update;
            this.game.GameSetup(this);

            watch = new Stopwatch();
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Device2"/> class.
 /// </summary>
 /// <param name="factory"><para>The <see cref="Factory3"/> object used when creating  the <see cref="SharpDX.Direct2D1.Device2"/>. </para></param>
 /// <param name="device"><para>The <see cref="SharpDX.DXGI.Device"/> object used when creating  the <see cref="SharpDX.Direct2D1.Device2"/>. </para></param>
 /// <remarks>
 /// Each call to CreateDevice returns a unique <see cref="SharpDX.Direct2D1.Device2"/> object.The <see cref="SharpDX.DXGI.Device"/> object is obtained by calling QueryInterface on an ID3D10Device or an ID3D11Device.
 /// </remarks>
 /// <unmanaged>HRESULT ID2D1Factory3::CreateDevice([In] IDXGIDevice* dxgiDevice,[Out] ID2D1Device2** d2dDevice2)</unmanaged>
 public Device2(Factory3 factory, SharpDX.DXGI.Device device)
     : base(IntPtr.Zero)
 {
     factory.CreateDevice(device, this);
 }