mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
Updated corsair SDK to iCUE SDK v4.0.48
This commit is contained in:
1 parent
d60d4833ca
commit
180b0e4538
68 files changed
+2001
-3085
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair;
|
||||
|
||||
@@ -7,12 +8,25 @@ internal static class NativeExtensions
|
||||
{
|
||||
internal static Rectangle ToRectangle(this _CorsairLedPosition position)
|
||||
{
|
||||
//HACK DarthAffe 08.07.2018: It seems like corsair introduced a bug here - it's always 0.
|
||||
float width = position.width < 0.5f ? 10 : (float)position.width;
|
||||
float height = position.height < 0.5f ? 10 : (float)position.height;
|
||||
float posX = (float)position.left;
|
||||
float posY = (float)position.top;
|
||||
const float WIDTH = 10;
|
||||
const float HEIGHT = 10;
|
||||
float posX = (float)position.cx;
|
||||
float posY = (float)position.cy;
|
||||
|
||||
return new Rectangle(posX, posY, width, height);
|
||||
return new Rectangle(posX, posY, WIDTH, HEIGHT);
|
||||
}
|
||||
|
||||
internal static T[] ToArray<T>(this nint ptr, int size)
|
||||
{
|
||||
int tSize = Marshal.SizeOf<T>();
|
||||
T[] array = new T[size];
|
||||
nint loopPtr = ptr;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
array[i] = Marshal.PtrToStructure<T>(loopPtr)!;
|
||||
loopPtr += tSize;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user