mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 02:26:23 +02:00
misc: chore: Pass rainbow color by reference in the event instead of passing around a packed int.
This commit is contained in:
parent
023bd5f00f
commit
71d8cfd232
5 changed files with 67 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
|||
using Gommon;
|
||||
using Ryujinx.Common.Helper;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
|
@ -55,7 +56,7 @@ namespace Ryujinx.Common.Utilities
|
|||
{
|
||||
_color = HsbToRgb((_color.GetHue() + Speed) / 360);
|
||||
|
||||
_updatedHandler.Call(_color.ToArgb());
|
||||
_updatedHandler.Call(ref _color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,13 +68,13 @@ namespace Ryujinx.Common.Utilities
|
|||
_color = Color.Blue;
|
||||
}
|
||||
|
||||
public static event Action<int> Updated
|
||||
public static event RefEvent<Color>.Handler Updated
|
||||
{
|
||||
add => _updatedHandler.Add(value);
|
||||
remove => _updatedHandler.Remove(value);
|
||||
}
|
||||
|
||||
private static readonly Event<int> _updatedHandler = new();
|
||||
private static readonly RefEvent<Color> _updatedHandler = new();
|
||||
|
||||
private static Color HsbToRgb(float hue, float saturation = 1, float brightness = 1)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue