Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CorsairHelper.cs
Go to the documentation of this file.
1using System;
4
6
7internal static class CorsairHelper
8{
10 {
11 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
12 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
13 //IL_006b: Unknown result type (might be due to invalid IL or missing references)
14 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
15 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
16 //IL_00ea: Unknown result type (might be due to invalid IL or missing references)
17 //IL_0189: Unknown result type (might be due to invalid IL or missing references)
18 //IL_018e: Unknown result type (might be due to invalid IL or missing references)
19 Point[] array = (Point[])(object)new Point[leds.Length];
20 Vector2[] array2 = (Vector2[])(object)new Vector2[leds.Length];
21 double num = 0.0;
22 double num2 = 0.0;
23 if (leds.Length != 0)
24 {
25 num = leds[0].Top + (double)offset.Y;
26 num2 = leds[0].Top + (double)offset.Y;
27 }
28 Point point = default(Point);
29 for (int i = 0; i < leds.Length; i++)
30 {
31 leds[i].Left += offset.X;
32 leds[i].Top += offset.Y;
33 ((Point)(ref point))._002Ector((int)Math.Floor((leds[i].Left + leds[i].Width * 0.5) / 20.0), (int)Math.Floor(leds[i].Top / 20.0));
34 array[i] = point;
35 num = Math.Min(leds[i].Top, num);
36 num2 = Math.Max(leds[i].Top, num2);
37 }
38 double num3 = 1.0;
39 if (num != num2)
40 {
41 num3 = 1.0 / (num2 - num);
42 }
43 for (int j = 0; j < leds.Length; j++)
44 {
45 array2[j] = new Vector2((float)((leds[j].Left + leds[j].Width * 0.5) * num3), (float)((leds[j].Top - num) * num3));
46 }
47 return Fragment.FromCustom(array, array2);
48 }
49
51 {
53 if (intPtr == IntPtr.Zero)
54 {
55 return new CorsairLedPosition[0];
56 }
58 int numberOfLed = corsairLedPositions.NumberOfLed;
59 CorsairLedPosition[] array = new CorsairLedPosition[numberOfLed];
60 int num = Marshal.SizeOf(typeof(CorsairLedPosition));
61 for (int i = 0; i < numberOfLed; i++)
62 {
64 corsairLedPositions.LedPositionPtr += num;
65 }
66 return array;
67 }
68}
static Fragment CreateFragment(CorsairLedPosition[] leds, Vector2 offset)
static CorsairLedPosition[] GetLedPositionsForMouseMatOrKeyboard(int deviceIndex)
static IntPtr CorsairGetLedPositionsByDeviceIndex(int deviceIndex)
static Fragment FromCustom(Point[] gridPositions)
Definition Fragment.cs:60
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Floor(double d)
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static ? object PtrToStructure(IntPtr ptr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type structureType)
Definition Marshal.cs:1164
static int SizeOf(object structure)
Definition Marshal.cs:697
static readonly IntPtr Zero
Definition IntPtr.cs:18