Exemple #1
0
        private void InnerBegin()
        {
            switch (lastItem)
            {
            case ItemType.Sprite:
                if (this.sprite == null)
                {
                    this.sprite = new SpriteBatchEx(this.GraphicsDevice);
                }
                this.sprite.Begin(SpriteSortMode.Deferred, this.alphaBlendState, transformMatrix: this.matrix);
                break;

            case ItemType.Skeleton:
                if (this.spineRender == null)
                {
                    this.spineRender = new SkeletonMeshRenderer(this.GraphicsDevice);
                }
                this.spineRender.Effect.World = matrix ?? Matrix.Identity;
                this.spineRender.Begin();
                break;

            case ItemType.D2DObject:
                if (this.d2dRender == null)
                {
                    this.d2dRender = new D2DRenderer(this.GraphicsDevice);
                }
                if (this.matrix == null)
                {
                    this.d2dRender.Begin();
                }
                else
                {
                    this.d2dRender.Begin(this.matrix.Value);
                }
                break;

            case ItemType.Sprite_BlendAdditive:
                if (this.sprite == null)
                {
                    this.sprite = new SpriteBatchEx(this.GraphicsDevice);
                }
                this.sprite.Begin(SpriteSortMode.Deferred, BlendState.Additive, transformMatrix: this.matrix);
                break;

            case ItemType.Sprite_BlendNonPremultiplied:
                if (this.sprite == null)
                {
                    this.sprite = new SpriteBatchEx(this.GraphicsDevice);
                }
                this.sprite.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, transformMatrix: this.matrix);
                break;
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WcR2Renderer" /> class.
        /// </summary>
        /// <param name="graphicsDevice">The graphics device.</param>
        /// <param name="nativeScreenWidth">Width of the native screen.</param>
        /// <param name="nativeScreenHeight">Height of the native screen.</param>
        public WcR2Renderer(GraphicsDevice graphicsDevice, int nativeScreenWidth, int nativeScreenHeight)
        {
            spriteBatch      = new SpriteBatchEx(graphicsDevice);
            this.d2dRenderer = new D2DRenderer(graphicsDevice);
            GraphicsDevice   = graphicsDevice;

            if (graphicsDevice.PresentationParameters.IsFullScreen)
            {
                NativeScreenWidth  = nativeScreenWidth;
                NativeScreenHeight = nativeScreenHeight;
            }
            else
            {
                NativeScreenWidth  = graphicsDevice.PresentationParameters.BackBufferWidth;
                NativeScreenHeight = graphicsDevice.PresentationParameters.BackBufferHeight;
            }

            clipRectanges = new Stack <Rectangle>();
            activeEffects = new Stack <Effect>();
        }