Beispiel #1
0
 public Framework(IntPtr handle, int width, int height, string mediaRootPath)
 {
     Device = new Device(handle, width, height);
     AssetManager = new AssetManager(Device, mediaRootPath);
     Light = new Light();
     SpriteRenderer = new SpriteRenderer(Device);
     Renderer = new RenderSystem(Device, SpriteRenderer);
 }
Beispiel #2
0
        public void RenderSystem_RenderFail_Test()
        {
            var rs = new RenderSystem(Device, SpriteRenderer);

            Assert.IsTrue(
                TestHelpers.CatchException(typeof(ArgumentNullException),
                () => rs.Render(rs.PrimaryRenderTarget, null, null, null, new Light(), false)));
            Assert.IsTrue(
                TestHelpers.CatchException(typeof(ArgumentNullException),
                () => rs.Render(rs.PrimaryRenderTarget, null, null, new Camera(), null, false)));
        }
Beispiel #3
0
        public void RenderSystem_Render_Test()
        {
            var rs = new RenderSystem(Device, SpriteRenderer);

            var renderable = TestHelpers.CreateRenderableMock(Device);
            int numRenderCalled = 0;
            renderable.RenderCalled += ((o, e) => ++numRenderCalled);
            var renderables = new List<IRenderable>() { renderable };

            var sprite = TestHelpers.CreateSpriteMock(Device);
            sprite.RenderCalled += ((o, e) => ++numRenderCalled);
            var sprites = new List<ISprite>() { sprite };

            Assert.IsTrue(rs.Render(rs.PrimaryRenderTarget, renderables, sprites, new Camera(), new Light(), false));
            Assert.AreEqual(2, numRenderCalled);
            Assert.AreEqual(0.0f, rs.PrimaryRenderTarget.LastFps);
        }
Beispiel #4
0
 public void RenderSystem_Constructor_Test()
 {
     var rs = new RenderSystem(Device, SpriteRenderer);
     Assert.IsNotNull(rs.PrimaryRenderTarget);
 }
Beispiel #5
0
 public void SetUp()
 {
     Device = TestHelpers.GetDevice();
     RenderSystem = new RenderSystem(Device, new SpriteRenderer(Device));
     AssetManager = new AssetManager(Device, RenderSettings.MediaPath);
 }
Beispiel #6
0
 public bool Render(RenderSystem renderSystem, IRenderTarget renderTarget, bool present)
 {
     return renderSystem.Render(renderTarget, renderables, sprites, Camera, Light, present);
 }