Skip to content

Commit 9017775

Browse files
authored
Merge pull request #6 from dend/february-2025
February 2025 Update
2 parents d8b0742 + 3e02890 commit 9017775

File tree

14 files changed

+902
-236
lines changed

14 files changed

+902
-236
lines changed

src/DeckSurf.SDK.StartBoard/Program.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using DeckSurf.SDK.Core;
2-
using DeckSurf.SDK.Models;
3-
using DeckSurf.SDK.Util;
4-
using System;
1+
using System;
52
using System.Collections.Generic;
3+
using System.Drawing;
4+
using System.Drawing.Imaging;
65
using System.IO;
76
using System.Threading;
7+
using DeckSurf.SDK.Core;
8+
using DeckSurf.SDK.Models;
9+
using DeckSurf.SDK.Util;
810

911
namespace DeckSurf.SDK.StartBoard
1012
{
@@ -28,23 +30,29 @@ static void Main(string[] args)
2830

2931
byte[] testImage = File.ReadAllBytes(args[0]);
3032

31-
var image = ImageHelpers.ResizeImage(testImage, device.ScreenWidth, device.ScreenHeight, device.IsButtonImageFlipRequired);
32-
33-
device.SetScreen(image, 250, device.ScreenWidth, device.ScreenHeight);
33+
var image = ImageHelpers.ResizeImage(testImage, device.ScreenWidth, device.ScreenHeight, RotateFlipType.Rotate180FlipNone, ImageFormat.Jpeg);
34+
device.SetScreen(image, 0, device.ScreenWidth, device.ScreenHeight);
3435

35-
var keyImage = ImageHelpers.ResizeImage(testImage, device.ButtonResolution, device.ButtonResolution, device.IsButtonImageFlipRequired);
36-
device.SetKey(1, keyImage);
36+
device.SetKey(1, testImage);
3737

38-
device.SetBrightness(29);
38+
device.SetBrightness(45);
3939
//device.ClearButtons();
4040

41+
device.SetKeyColor(2, Color.Red);
42+
device.SetKeyColor(4, Color.Green);
43+
4144
Console.WriteLine("Done");
4245
exitSignal.WaitOne();
4346
}
4447

4548
private static void Device_OnButtonPress(object source, ButtonPressEventArgs e)
4649
{
47-
Console.WriteLine($"Button with ID {e.Id} was pressed. It's identified as {e.ButtonKind}. Event is {e.EventKind}. If this is a touch screen, coordinates are {e.TapCoordinates.X} and {e.TapCoordinates.Y}. Is knob rotated: {e.IsKnobRotating}. Rotation direction: {e.KnobRotationDirection}.");
50+
Console.WriteLine($"Button with ID {e.Id} was pressed. It's identified as {e.ButtonKind}. Event is {e.EventKind}. Is knob rotated: {e.IsKnobRotating}. Rotation direction: {e.KnobRotationDirection}.");
51+
52+
if (e.TapCoordinates != null)
53+
{
54+
Console.WriteLine($"If this is a touch screen, coordinates are {e.TapCoordinates.Value.X} and {e.TapCoordinates.Value.Y}.");
55+
}
4856
}
4957
}
5058
}

src/DeckSurf.SDK/Core/DeviceManager.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ public static IEnumerable<ConnectedDevice> GetDeviceList()
7878
break;
7979
}
8080

81+
case DeviceModel.MK2:
82+
{
83+
connectedDevices.Add(new StreamDeckMK2(device.VendorID, device.ProductID, device.DevicePath, device.GetFriendlyName(), device.GetSerialNumber()
84+
));
85+
break;
86+
}
87+
8188
case DeviceModel.Neo:
8289
{
8390
connectedDevices.Add(new StreamDeckNeo(device.VendorID, device.ProductID, device.DevicePath, device.GetFriendlyName(), device.GetSerialNumber()

src/DeckSurf.SDK/Models/ButtonPressEventArgs.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ namespace DeckSurf.SDK.Models
1919
/// <param name="tapCoordinates">Coordinates on the touch screen where a tap occurred.</param>
2020
/// <param name="isKnobRotating">Determines whether a knob is being rotated.</param>
2121
/// <param name="knobRotationDirection">Direction of a knob being rotated.</param>
22-
public class ButtonPressEventArgs(int id, ButtonEventKind eventKind, ButtonKind buttonKind, Point tapCoordinates, bool isKnobRotating, KnobRotationDirection knobRotationDirection) : EventArgs
22+
public class ButtonPressEventArgs(int id, ButtonEventKind eventKind, ButtonKind? buttonKind, Point? tapCoordinates, bool? isKnobRotating, KnobRotationDirection? knobRotationDirection) : EventArgs
2323
{
2424
/// <summary>
2525
/// Gets a value indicating whether a knob is being rotated.
2626
/// </summary>
27-
public bool IsKnobRotating { get; } = isKnobRotating;
27+
public bool? IsKnobRotating { get; } = isKnobRotating;
2828

2929
/// <summary>
3030
/// Gets the knob rotation direction if the button is a knob and was rotated.
3131
/// </summary>
32-
public KnobRotationDirection KnobRotationDirection { get; } = knobRotationDirection;
32+
public KnobRotationDirection? KnobRotationDirection { get; } = knobRotationDirection;
3333

3434
/// <summary>
3535
/// Gets the coordinates on the touch screen where the tap occurred.
3636
/// </summary>
37-
public Point TapCoordinates { get; } = tapCoordinates;
37+
public Point? TapCoordinates { get; } = tapCoordinates;
3838

3939
/// <summary>
4040
/// Gets the kind of the button pressed.
4141
/// </summary>
42-
public ButtonKind ButtonKind { get; } = buttonKind;
42+
public ButtonKind? ButtonKind { get; } = buttonKind;
4343

4444
/// <summary>
4545
/// Gets the numeric ID of the button being pressed.

0 commit comments

Comments
 (0)