mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Minor tweaks
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
||||
|
||||
using Starlight.Communication;
|
||||
using System.Drawing;
|
||||
using System.Management;
|
||||
using System.Text;
|
||||
|
||||
@@ -193,16 +192,14 @@ namespace Starlight.AnimeMatrix
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
|
||||
}
|
||||
|
||||
public int SetLedPlanar(int x, int y, byte value)
|
||||
public void SetLedPlanar(int x, int y, byte value)
|
||||
{
|
||||
EnsureRowInRange(y);
|
||||
var start = RowToLinearAddress(y) - XStart(y);
|
||||
if (x >= XStart(y) && x < XEnd(y))
|
||||
{
|
||||
SetLedLinear(start + x, value);
|
||||
return start + x;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void Clear(bool present = false)
|
||||
@@ -270,11 +267,6 @@ namespace Starlight.AnimeMatrix
|
||||
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
|
||||
}
|
||||
|
||||
static int GetColor(Bitmap bmp, int x, int y)
|
||||
{
|
||||
var pixel = bmp.GetPixel(Math.Max(0, Math.Min(bmp.Width - 1, x)), Math.Max(0, Math.Min(bmp.Height - 1, y)));
|
||||
return (Math.Min((pixel.R + pixel.G + pixel.B) / 3, 255));
|
||||
}
|
||||
|
||||
|
||||
public void PresentText(string text, float fontSize = 8F)
|
||||
@@ -327,6 +319,7 @@ namespace Starlight.AnimeMatrix
|
||||
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
|
||||
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
|
||||
|
||||
}
|
||||
|
||||
using (Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows))
|
||||
@@ -334,7 +327,10 @@ namespace Starlight.AnimeMatrix
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
if (x % 2 == y % 2)
|
||||
SetLedPlanar(x / 2, y, (byte)GetColor(bmp, x, y));
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
SetLedPlanar(x / 2, y, (byte)((pixel.R + pixel.G + pixel.B)/3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
app/Fans.Designer.cs
generated
20
app/Fans.Designer.cs
generated
@@ -259,7 +259,7 @@ namespace GHelper
|
||||
buttonApply.Secondary = true;
|
||||
buttonApply.Size = new Size(248, 44);
|
||||
buttonApply.TabIndex = 14;
|
||||
buttonApply.Text = "Apply Fan Curve";
|
||||
buttonApply.Text = "Apply Custom Curve";
|
||||
buttonApply.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// panelPower
|
||||
@@ -346,12 +346,11 @@ namespace GHelper
|
||||
//
|
||||
// labelCPU
|
||||
//
|
||||
labelCPU.AutoSize = true;
|
||||
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelCPU.Location = new Point(44, 40);
|
||||
labelCPU.Location = new Point(13, 40);
|
||||
labelCPU.Margin = new Padding(4, 0, 4, 0);
|
||||
labelCPU.Name = "labelCPU";
|
||||
labelCPU.Size = new Size(61, 32);
|
||||
labelCPU.Size = new Size(120, 32);
|
||||
labelCPU.TabIndex = 13;
|
||||
labelCPU.Text = "CPU";
|
||||
labelCPU.TextAlign = ContentAlignment.MiddleCenter;
|
||||
@@ -393,25 +392,24 @@ namespace GHelper
|
||||
//
|
||||
// labelTotal
|
||||
//
|
||||
labelTotal.AutoSize = true;
|
||||
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelTotal.Location = new Point(46, 40);
|
||||
labelTotal.Location = new Point(16, 40);
|
||||
labelTotal.Margin = new Padding(4, 0, 4, 0);
|
||||
labelTotal.Name = "labelTotal";
|
||||
labelTotal.Size = new Size(70, 32);
|
||||
labelTotal.Size = new Size(122, 32);
|
||||
labelTotal.TabIndex = 12;
|
||||
labelTotal.Text = "Total";
|
||||
labelTotal.Text = "Platform";
|
||||
labelTotal.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(48, 8);
|
||||
label1.Location = new Point(26, 8);
|
||||
label1.Margin = new Padding(4, 0, 4, 0);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(65, 32);
|
||||
label1.Size = new Size(104, 32);
|
||||
label1.TabIndex = 11;
|
||||
label1.Text = "Total";
|
||||
label1.Text = "Platform";
|
||||
label1.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// trackTotal
|
||||
|
||||
1
app/Settings.Designer.cs
generated
1
app/Settings.Designer.cs
generated
@@ -393,6 +393,7 @@ namespace GHelper
|
||||
// labelCPUFan
|
||||
//
|
||||
labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelCPUFan.Cursor = Cursors.Hand;
|
||||
labelCPUFan.Location = new Point(384, 15);
|
||||
labelCPUFan.Margin = new Padding(8, 0, 8, 0);
|
||||
labelCPUFan.Name = "labelCPUFan";
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace GHelper
|
||||
public Keyboard keyb;
|
||||
|
||||
static AnimeMatrixDevice mat;
|
||||
static long lastTip;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
@@ -116,7 +117,7 @@ namespace GHelper
|
||||
button120Hz.MouseMove += Button120Hz_MouseHover;
|
||||
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
|
||||
|
||||
//Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||
|
||||
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
|
||||
|
||||
@@ -127,28 +128,17 @@ namespace GHelper
|
||||
|
||||
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
|
||||
{
|
||||
trayPoint = Cursor.Position;
|
||||
|
||||
if (!aTimer.Enabled)
|
||||
{
|
||||
aTimer.Interval = 100;
|
||||
aTimer.Enabled = true;
|
||||
}
|
||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTip) < 2000) return;
|
||||
lastTip = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
RefreshSensors();
|
||||
}
|
||||
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
{
|
||||
if (Program.settingsForm.Visible || Cursor.Position == trayPoint)
|
||||
{
|
||||
aTimer.Interval = 2000;
|
||||
aTimer.Interval = 2000;
|
||||
if (Program.settingsForm.Visible)
|
||||
RefreshSensors();
|
||||
} else
|
||||
{
|
||||
Program.trayIcon.Text = "";
|
||||
aTimer.Enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Button120Hz_MouseHover(object? sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user