A game framework written with osu! in mind.
at master 51 lines 1.6 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 osu.Framework.Graphics.Shapes; 5using osuTK; 6 7namespace osu.Framework.Graphics.Containers 8{ 9 public class BasicScrollContainer : BasicScrollContainer<Drawable> 10 { 11 public BasicScrollContainer(Direction scrollDirection = Direction.Vertical) 12 : base(scrollDirection) 13 { 14 } 15 } 16 17 public class BasicScrollContainer<T> : ScrollContainer<T> 18 where T : Drawable 19 { 20 public BasicScrollContainer(Direction scrollDirection = Direction.Vertical) 21 : base(scrollDirection) 22 { 23 } 24 25 protected override ScrollbarContainer CreateScrollbar(Direction direction) => new BasicScrollbar(direction); 26 27 protected internal class BasicScrollbar : ScrollbarContainer 28 { 29 private const float dim_size = 8; 30 31 public BasicScrollbar(Direction direction) 32 : base(direction) 33 { 34 Child = new Box 35 { 36 RelativeSizeAxes = Axes.Both, 37 Colour = FrameworkColour.YellowGreen 38 }; 39 } 40 41 public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None) 42 { 43 Vector2 size = new Vector2(dim_size) 44 { 45 [(int)ScrollDirection] = val 46 }; 47 this.ResizeTo(size, duration, easing); 48 } 49 } 50 } 51}