A game framework written with osu! in mind.
at master 2.7 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using NUnit.Framework; 5using osu.Framework.Graphics; 6using osu.Framework.Graphics.Containers; 7using osu.Framework.Graphics.Shapes; 8using osu.Framework.Graphics.Sprites; 9using osuTK; 10using osuTK.Graphics; 11 12namespace osu.Framework.Tests.Visual.Containers 13{ 14 public class TestSceneFrontToBackBufferedContainer : FrameworkTestScene 15 { 16 [Test] 17 public void TestBufferedContainerBehindBox() 18 { 19 AddStep("set children", () => 20 { 21 Children = new Drawable[] 22 { 23 new TestBufferedContainer(true) 24 { 25 Anchor = Anchor.Centre, 26 Origin = Anchor.BottomCentre, 27 Size = new Vector2(200) 28 }, 29 new Box 30 { 31 Anchor = Anchor.Centre, 32 Origin = Anchor.Centre, 33 Colour = Color4.SlateGray, 34 Size = new Vector2(300), 35 }, 36 }; 37 }); 38 } 39 40 [Test] 41 public void TestBufferedContainerAboveBox() 42 { 43 AddStep("set children", () => 44 { 45 Children = new Drawable[] 46 { 47 new Box 48 { 49 Anchor = Anchor.Centre, 50 Origin = Anchor.Centre, 51 Colour = Color4.SlateGray, 52 Size = new Vector2(300), 53 }, 54 new TestBufferedContainer(false) 55 { 56 Anchor = Anchor.Centre, 57 Origin = Anchor.BottomCentre, 58 Size = new Vector2(200) 59 }, 60 }; 61 }); 62 } 63 64 public class TestBufferedContainer : BufferedContainer 65 { 66 public TestBufferedContainer(bool behind) 67 { 68 Children = new Drawable[] 69 { 70 new Box 71 { 72 RelativeSizeAxes = Axes.Both, 73 Colour = Color4.Orange 74 }, 75 new SpriteText 76 { 77 Anchor = Anchor.TopCentre, 78 Origin = Anchor.TopCentre, 79 Y = 5, 80 Text = $"Behind = {behind}" 81 } 82 }; 83 } 84 } 85 } 86}