A game framework written with osu! in mind.
at master 51 lines 1.4 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 System; 5using osuTK; 6using osuTK.Graphics; 7using osu.Framework.Graphics.Shapes; 8 9namespace osu.Framework.Graphics.UserInterface 10{ 11 public class BasicSliderBar<T> : SliderBar<T> 12 where T : struct, IComparable<T>, IConvertible, IEquatable<T> 13 { 14 public Color4 BackgroundColour 15 { 16 get => Box.Colour; 17 set => Box.Colour = value; 18 } 19 20 public Color4 SelectionColour 21 { 22 get => SelectionBox.Colour; 23 set => SelectionBox.Colour = value; 24 } 25 26 protected readonly Box SelectionBox; 27 protected readonly Box Box; 28 29 public BasicSliderBar() 30 { 31 Children = new Drawable[] 32 { 33 Box = new Box 34 { 35 RelativeSizeAxes = Axes.Both, 36 Colour = FrameworkColour.Green, 37 }, 38 SelectionBox = new Box 39 { 40 RelativeSizeAxes = Axes.Both, 41 Colour = FrameworkColour.Yellow, 42 } 43 }; 44 } 45 46 protected override void UpdateValue(float value) 47 { 48 SelectionBox.ScaleTo(new Vector2(value, 1), 300, Easing.OutQuint); 49 } 50 } 51}