Use ref for more color struct routines

This commit is contained in:
Travis Nickles 2019-02-12 01:31:18 -06:00
parent ce0ac67dcd
commit 6098c91e29
2 changed files with 15 additions and 15 deletions

View File

@ -47,8 +47,8 @@ namespace DS4Windows
{
if (getLedAsBatteryIndicator(deviceNum))
{
DS4Color fullColor = getCustomColor(deviceNum);
DS4Color lowColor = getLowColor(deviceNum);
ref DS4Color fullColor = ref getCustomColor(deviceNum);
ref DS4Color lowColor = ref getLowColor(deviceNum);
color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery());
}
else
@ -83,8 +83,8 @@ namespace DS4Windows
}
else if (getLedAsBatteryIndicator(deviceNum))
{
DS4Color fullColor = getMainColor(deviceNum);
DS4Color lowColor = getLowColor(deviceNum);
ref DS4Color fullColor = ref getMainColor(deviceNum);
ref DS4Color lowColor = ref getLowColor(deviceNum);
color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery());
}
else
@ -95,7 +95,7 @@ namespace DS4Windows
if (device.getBattery() <= getFlashAt(deviceNum) && !defaultLight && !device.isCharging())
{
DS4Color flashColor = getFlashColor(deviceNum);
ref DS4Color flashColor = ref getFlashColor(deviceNum);
if (!(flashColor.red == 0 &&
flashColor.green == 0 &&
flashColor.blue == 0))

View File

@ -794,27 +794,27 @@ namespace DS4Windows
=> m_Config.SetGyroMouseToggle(index, value, control);
public static DS4Color[] MainColor => m_Config.m_Leds;
public static DS4Color getMainColor(int index)
public static ref DS4Color getMainColor(int index)
{
return m_Config.m_Leds[index];
return ref m_Config.m_Leds[index];
}
public static DS4Color[] LowColor => m_Config.m_LowLeds;
public static DS4Color getLowColor(int index)
public static ref DS4Color getLowColor(int index)
{
return m_Config.m_LowLeds[index];
return ref m_Config.m_LowLeds[index];
}
public static DS4Color[] ChargingColor => m_Config.m_ChargingLeds;
public static DS4Color getChargingColor(int index)
public static ref DS4Color getChargingColor(int index)
{
return m_Config.m_ChargingLeds[index];
return ref m_Config.m_ChargingLeds[index];
}
public static DS4Color[] CustomColor => m_Config.m_CustomLeds;
public static DS4Color getCustomColor(int index)
public static ref DS4Color getCustomColor(int index)
{
return m_Config.m_CustomLeds[index];
return ref m_Config.m_CustomLeds[index];
}
public static bool[] UseCustomLed => m_Config.useCustomLeds;
@ -824,9 +824,9 @@ namespace DS4Windows
}
public static DS4Color[] FlashColor => m_Config.m_FlashLeds;
public static DS4Color getFlashColor(int index)
public static ref DS4Color getFlashColor(int index)
{
return m_Config.m_FlashLeds[index];
return ref m_Config.m_FlashLeds[index];
}
public static byte[] TapSensitivity => m_Config.tapSensitivity;