コード例 #1
0
        public void SpriteVertices_AreNotReuploaded_OnceSpriteHasBeenRemovedFromBatch()
        {
            var sprite = new Sprite(spriteSheet.Object.GetRegion(0), 10, 10);
            spriteBatch.Add(sprite);

            vbo.ResetCalls();
            spriteBatch.Remove(sprite);
            sprite.Modify((s) => s.X = 80);

            vbo.Verify(
                v => v.FillPartial(It.IsAny<IntPtr>(), It.IsAny<IntPtr>(), sprite.Vertices),
                Times.Never
            );
        }
コード例 #2
0
        public void SpriteHandlers_AreRemovedFromBatch_OnDisposal()
        {
            var sprite = new Sprite(spriteSheet.Object.GetRegion(0), 10, 10);
            var sprite2 = new Sprite(spriteSheet.Object.GetRegion(1), 20, 10);
            spriteBatch.Add(sprite, sprite2);

            vbo.ResetCalls();
            spriteBatch.Dispose();
            sprite.Modify((s) => s.Width = 100);
            sprite2.Modify((s) => s.Colour = Colour4.ForestGreen);

            vbo.Verify(
                (v) => v.FillPartial(It.IsAny<IntPtr>(), It.IsAny<IntPtr>(), It.IsAny<VertexPositionColourTexture[]>()),
                Times.Never
            );
        }
コード例 #3
0
        public void SpriteVertices_AreReuploaded_WhenSpriteHasBeenModified()
        {
            var sprite = new Sprite(spriteSheet.Object.GetRegion(0), 10, 10);
            spriteBatch.Add(sprite);

            vbo.ResetCalls();
            sprite.Modify((s) => {
                s.X = 80;
                s.Y = 160;
            });
            vbo.Verify(
                v => v.FillPartial(It.IsAny<IntPtr>(), It.IsAny<IntPtr>(), sprite.Vertices),
                Times.Once
            );
        }