A game framework written with osu! in mind.
at master 29 lines 788 B 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 4namespace osu.Framework.Bindables 5{ 6 public class BindableBool : Bindable<bool> 7 { 8 public BindableBool(bool value = false) 9 : base(value) 10 { 11 } 12 13 public override string ToString() => Value.ToString(); 14 15 public override void Parse(object input) 16 { 17 if (input is "1") 18 Value = true; 19 else if (input is "0") 20 Value = false; 21 else 22 base.Parse(input); 23 } 24 25 public void Toggle() => Value = !Value; 26 27 protected override Bindable<bool> CreateInstance() => new BindableBool(); 28 } 29}