Example #1
0
 public Composer(DeviceContext10_1 deviceContext)
 {
     m_drawStateManagement = new DrawStateManagement();
     m_spriteRenderer = new SpriteRenderer(deviceContext.Device, MAX_SPRITE_INSTANCES);
 }
Example #2
0
        /// <summary>
        /// Creates a new instance of the DrawingLayer
        /// </summary>
        /// <param name="directCanvasFactory">The factory that the DrawingLayer belongs to</param>
        /// <param name="renderTargetTexture">The Direct3D texture to use</param>
        internal DrawingLayer(DirectCanvasFactory directCanvasFactory, RenderTargetTexture renderTargetTexture)
        {
            m_directCanvasFactory = directCanvasFactory;
            m_format = renderTargetTexture.Description.Format;

            m_drawStateManagement = new DrawStateManagement();

            /* Set our Direct3D texture */
            RenderTargetTexture = renderTargetTexture;

            /* Create the Direct2D render target, using our Direct3D texture we were passed */
            D2DRenderTarget = new Direct2DRenderTarget(m_directCanvasFactory.DeviceContext,
                                                       m_renderTargetTexture.InternalDxgiSurface, 
                                                       m_format);
        }
Example #3
0
 /// <summary>
 /// Creates a new instance of the DrawingLayer.  This is the constructor that 
 /// presenter subclasses will use, making sure they override the D2DRenderTarget and RenderTargetTexture
 /// </summary>
 /// <param name="directCanvasFactory">The factory that the DrawingLayer belongs to</param>
 internal DrawingLayer(DirectCanvasFactory directCanvasFactory)
 {
     m_drawStateManagement = new DrawStateManagement();
     m_directCanvasFactory = directCanvasFactory;
 }
Example #4
0
        /// <summary>
        /// Creates a new instance of the DrawingLayer
        /// </summary>
        /// <param name="directCanvasFactory">The factory that the DrawingLayer belongs to</param>
        /// <param name="width">The pixel size in width to make the D3D texture</param>
        /// <param name="height">The pixel size in height to make the D3D texture</param>
        /// <param name="format">The color format to make the D3D texture</param>
        /// <param name="optionFlags">Option flags to use on the creation of the D3D texture</param>
        internal DrawingLayer(DirectCanvasFactory directCanvasFactory, 
                              int width, 
                              int height, 
                              Format format = Format.B8G8R8A8_UNorm, 
                              ResourceOptionFlags optionFlags = ResourceOptionFlags.None)
        {
            m_directCanvasFactory = directCanvasFactory;
            m_format = format;

            m_drawStateManagement = new DrawStateManagement();

            var device = m_directCanvasFactory.DeviceContext.Device;

            /* Create our Direct3D texture */
            RenderTargetTexture = new RenderTargetTexture(device, width, height, m_format, optionFlags);

            /* Create the Direct2D render target, using our Direct3D texture we just created */
            D2DRenderTarget = new Direct2DRenderTarget(m_directCanvasFactory.DeviceContext,
                                                       m_renderTargetTexture.InternalDxgiSurface, 
                                                       m_format);
        }