A game framework written with osu! in mind.

Merge branch 'master' into overlay-dont-block-scroll

authored by

Dan Balasescu and committed by
GitHub
35be7037 d89dffbb

+39 -20
+4 -1
osu.Framework.Tests/Input/KeyCombinationTest.cs
··· 18 18 new object[] { new KeyCombination(InputKey.LAlt, InputKey.F4), "LAlt-F4" }, 19 19 new object[] { new KeyCombination(InputKey.D, InputKey.LControl), "LCtrl-D" }, 20 20 new object[] { new KeyCombination(InputKey.LShift, InputKey.F, InputKey.LControl), "LCtrl-LShift-F" }, 21 - new object[] { new KeyCombination(InputKey.LAlt, InputKey.LControl, InputKey.LSuper, InputKey.LShift), "LCtrl-LAlt-LShift-LWin" } 21 + new object[] { new KeyCombination(InputKey.LAlt, InputKey.LControl, InputKey.LSuper, InputKey.LShift), "LCtrl-LAlt-LShift-LWin" }, 22 + new object[] { new KeyCombination(InputKey.Alt, InputKey.LAlt, InputKey.RControl, InputKey.A), "RCtrl-LAlt-A" }, 23 + new object[] { new KeyCombination(InputKey.Shift, InputKey.LControl, InputKey.X), "LCtrl-Shift-X" }, 24 + new object[] { new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Alt, InputKey.Super, InputKey.LAlt, InputKey.RShift, InputKey.LSuper), "Ctrl-LAlt-RShift-LWin" }, 22 25 }; 23 26 24 27 [TestCaseSource(nameof(key_combination_display_test_cases))]
-2
osu.Framework/Extensions/Color4Extensions/Color4Extensions.cs
··· 85 85 /// </summary> 86 86 /// <param name="colour">Original colour</param> 87 87 /// <param name="scalar">A scalar to multiply with</param> 88 - /// <returns></returns> 89 88 public static Color4 Multiply(this Color4 colour, float scalar) 90 89 { 91 90 if (scalar < 0) ··· 180 179 /// <param name="h">The hue, between 0 and 360.</param> 181 180 /// <param name="s">The saturation, between 0 and 1.</param> 182 181 /// <param name="v">The value, between 0 and 1.</param> 183 - /// <returns></returns> 184 182 public static Color4 FromHSV(float h, float s, float v) 185 183 { 186 184 if (h < 0 || h > 360)
-1
osu.Framework/Extensions/ExtensionMethods.cs
··· 56 56 /// </summary> 57 57 /// <param name="dictionary">The dictionary.</param> 58 58 /// <param name="lookup">The lookup key.</param> 59 - /// <returns></returns> 60 59 public static TValue GetOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey lookup) => dictionary.TryGetValue(lookup, out TValue outVal) ? outVal : default; 61 60 62 61 /// <summary>
-1
osu.Framework/Extensions/TypeExtensions/TypeExtensions.cs
··· 40 40 /// Return every base type until (and excluding) <see cref="object"/> 41 41 /// </summary> 42 42 /// <param name="t"></param> 43 - /// <returns></returns> 44 43 public static IEnumerable<Type> EnumerateBaseTypes(this Type t) 45 44 { 46 45 while (t != null && t != typeof(object))
-1
osu.Framework/Graphics/Colour4.cs
··· 89 89 /// The final alpha is clamped to the 0-1 range. 90 90 /// </summary> 91 91 /// <param name="scalar">The value that the existing alpha will be multiplied by.</param> 92 - /// <returns></returns> 93 92 public Colour4 MultiplyAlpha(float scalar) 94 93 { 95 94 if (scalar < 0)
-1
osu.Framework/Graphics/Containers/ScrollContainer.cs
··· 135 135 /// </summary> 136 136 /// <param name="position">The value to clamp.</param> 137 137 /// <param name="extension">An extension value beyond the normal extent.</param> 138 - /// <returns></returns> 139 138 protected float Clamp(float position, float extension = 0) => Math.Max(Math.Min(position, ScrollableExtent + extension), -extension); 140 139 141 140 protected override Container<T> Content => ScrollContent;
-1
osu.Framework/Graphics/Lines/SmoothPath.cs
··· 78 78 /// Retrieves the colour from a position in the texture of the <see cref="Path"/>. 79 79 /// </summary> 80 80 /// <param name="position">The position within the texture. 0 indicates the outermost-point of the path, 1 indicates the centre of the path.</param> 81 - /// <returns></returns> 82 81 protected virtual Color4 ColourAt(float position) => Color4.White; 83 82 } 84 83 }
-1
osu.Framework/Graphics/UserInterface/Menu.cs
··· 538 538 /// <summary> 539 539 /// Creates a sub-menu for <see cref="MenuItem.Items"/> of <see cref="MenuItem"/>s added to this <see cref="Menu"/>. 540 540 /// </summary> 541 - /// <returns></returns> 542 541 protected abstract Menu CreateSubMenu(); 543 542 544 543 /// <summary>
+34 -3
osu.Framework/Input/Bindings/KeyCombination.cs
··· 232 232 233 233 public string ReadableString() 234 234 { 235 - var sortedKeys = Keys.GetValuesInOrder(); 236 - return string.Join('-', sortedKeys.Select(getReadableKey)); 235 + var sortedKeys = Keys.GetValuesInOrder().ToArray(); 236 + 237 + return string.Join('-', sortedKeys.Select(key => 238 + { 239 + switch (key) 240 + { 241 + case InputKey.Control: 242 + if (sortedKeys.Contains(InputKey.LControl) || sortedKeys.Contains(InputKey.RControl)) 243 + return null; 244 + 245 + break; 246 + 247 + case InputKey.Shift: 248 + if (sortedKeys.Contains(InputKey.LShift) || sortedKeys.Contains(InputKey.RShift)) 249 + return null; 250 + 251 + break; 252 + 253 + case InputKey.Alt: 254 + if (sortedKeys.Contains(InputKey.LAlt) || sortedKeys.Contains(InputKey.RAlt)) 255 + return null; 256 + 257 + break; 258 + 259 + case InputKey.Super: 260 + if (sortedKeys.Contains(InputKey.LSuper) || sortedKeys.Contains(InputKey.RSuper)) 261 + return null; 262 + 263 + break; 264 + } 265 + 266 + return getReadableKey(key); 267 + }).Where(s => !string.IsNullOrEmpty(s))); 237 268 } 238 269 239 270 [MethodImpl(MethodImplOptions.AggressiveInlining)] ··· 259 290 return false; 260 291 } 261 292 262 - private string getReadableKey(InputKey key) 293 + private static string getReadableKey(InputKey key) 263 294 { 264 295 if (key >= InputKey.FirstTabletAuxiliaryButton) 265 296 return $"Tablet Aux {key - InputKey.FirstTabletAuxiliaryButton + 1}";
-1
osu.Framework/Platform/Display.cs
··· 59 59 /// <param name="size">The <see cref="Size"/> to match.</param> 60 60 /// <param name="bitsPerPixel">The bits per pixel to match. If null, the highest available bits per pixel will be used.</param> 61 61 /// <param name="refreshRate">The refresh rate in hertz. If null, the highest available refresh rate will be used.</param> 62 - /// <returns></returns> 63 62 public DisplayMode FindDisplayMode(Size size, int? bitsPerPixel = null, int? refreshRate = null) => 64 63 DisplayModes.Where(mode => mode.Size.Width <= size.Width && mode.Size.Height <= size.Height && 65 64 (bitsPerPixel == null || mode.BitsPerPixel == bitsPerPixel) &&
-2
osu.Framework/Platform/IWindow.cs
··· 151 151 /// Convert a screen based coordinate to local window space. 152 152 /// </summary> 153 153 /// <param name="point"></param> 154 - /// <returns></returns> 155 154 Point PointToClient(Point point); 156 155 157 156 /// <summary> 158 157 /// Convert a window based coordinate to global screen space. 159 158 /// </summary> 160 159 /// <param name="point"></param> 161 - /// <returns></returns> 162 160 Point PointToScreen(Point point); 163 161 164 162 /// <summary>
-1
osu.Framework/Statistics/GlobalStatistics.cs
··· 33 33 /// <param name="group">The group specification.</param> 34 34 /// <param name="name">The name specification.</param> 35 35 /// <typeparam name="T">The type.</typeparam> 36 - /// <returns></returns> 37 36 public static GlobalStatistic<T> Get<T>(string group, string name) 38 37 { 39 38 lock (statistics)
-1
osu.Framework/Testing/TestScene.cs
··· 394 394 /// Remove the "TestScene" prefix from a name. 395 395 /// </summary> 396 396 /// <param name="name"></param> 397 - /// <returns></returns> 398 397 public static string RemovePrefix(string name) 399 398 { 400 399 return name.Replace("TestCase", string.Empty) // TestScene used to be called TestCase. This handles consumer projects which haven't updated their naming for the near future.
-1
osu.Framework/Utils/Interpolation.cs
··· 26 26 /// <param name="final">The end value.</param> 27 27 /// <param name="base">The base of the exponential. The valid range is [0, 1], where smaller values mean that the final value is achieved more quickly, and values closer to 1 results in slow convergence to the final value.</param> 28 28 /// <param name="exponent">The exponent of the exponential. An exponent of 0 results in the start values, whereas larger exponents make the result converge to the final value.</param> 29 - /// <returns></returns> 30 29 public static double Damp(double start, double final, double @base, double exponent) 31 30 { 32 31 if (@base < 0 || @base > 1)
-1
osu.Framework/Utils/PathApproximator.cs
··· 314 314 /// Computes various properties that can be used to approximate the circular arc. 315 315 /// </summary> 316 316 /// <param name="controlPoints">Three distinct points on the arc.</param> 317 - /// <returns></returns> 318 317 private static CircularArcProperties circularArcProperties(ReadOnlySpan<Vector2> controlPoints) 319 318 { 320 319 Vector2 a = controlPoints[0];
+1 -1
osu.Framework/osu.Framework.csproj
··· 46 46 See https://github.com/NuGet/Home/issues/4514 and https://github.com/dotnet/sdk/issues/765 . --> 47 47 <PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2021.115.0" /> 48 48 <PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" /> 49 - <PackageReference Include="OpenTabletDriver" Version="0.5.2.3" /> 49 + <PackageReference Include="OpenTabletDriver" Version="0.5.3" /> 50 50 <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.9.0" /> 51 51 <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.9.0"> 52 52 <NoWarn>NU1701</NoWarn> <!-- Requires .NETFramework for MSBuild, but we use Microsoft.Build.Locator which allows this package to work in .NETCoreApp. -->