Skip to content

Commit dac065f

Browse files
committed
v1.2.0: Added icons
1 parent 85edb11 commit dac065f

File tree

6 files changed

+44
-1
lines changed

6 files changed

+44
-1
lines changed

ERPLoader/ERPLoader.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<NeutralLanguage>en</NeutralLanguage>
1616
<Version>1.2.0</Version>
1717
<PackageLicenseFile>LICENSE</PackageLicenseFile>
18+
<ApplicationIcon>ERPLoader.ico</ApplicationIcon>
1819
</PropertyGroup>
1920

2021
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

ERPLoader/ERPLoader.ico

162 KB
Binary file not shown.

EasyERPExplorer/EasyERPExplorer.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<AssemblyVersion>1.2.0.0</AssemblyVersion>
1515
<FileVersion>1.2.0.0</FileVersion>
1616
<Version>1.2.0</Version>
17+
<PackageIcon></PackageIcon>
18+
<PackageIconUrl />
19+
<ApplicationIcon>EasyERPExplorer.ico</ApplicationIcon>
1720
</PropertyGroup>
1821

1922
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -28,6 +31,11 @@
2831
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
2932
</PropertyGroup>
3033

34+
<ItemGroup>
35+
<None Remove="icon.png" />
36+
<None Remove="icon.png" />
37+
</ItemGroup>
38+
3139
<ItemGroup>
3240
<PackageReference Include="ImGui.NET" Version="1.78.0" />
3341
<PackageReference Include="OpenTK" Version="4.6.4" />
@@ -45,4 +53,10 @@
4553
</None>
4654
</ItemGroup>
4755

56+
<ItemGroup>
57+
<None Update="EasyERPExplorer.ico">
58+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
59+
</None>
60+
</ItemGroup>
61+
4862
</Project>
152 KB
Binary file not shown.

EasyERPExplorer/Renderer/Window.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using OpenTK.Windowing.Desktop;
55
using System;
66
using System.Collections.Generic;
7+
using System.IO;
78
using System.Linq;
89

910
namespace EasyERPExplorer.Renderer
@@ -17,6 +18,13 @@ public class Window : GameWindow
1718
public Window() : base(GameWindowSettings.Default, new NativeWindowSettings() { Size = new Vector2i(1600, 900), APIVersion = new Version(4, 5) })
1819
{
1920
Instance = this;
21+
22+
// Init icon
23+
if (File.Exists("EasyERPExplorer.ico"))
24+
{
25+
using var icon = new System.Drawing.Bitmap("EasyERPExplorer.ico");
26+
Icon = new OpenTK.Windowing.Common.Input.WindowIcon(new OpenTK.Windowing.Common.Input.Image(icon.Width, icon.Height, Utils.ImgToBytes(icon)));
27+
}
2028
}
2129

2230
protected override void OnLoad()

EasyERPExplorer/Utils.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace EasyERPExplorer
1+
using System.Drawing;
2+
3+
namespace EasyERPExplorer
24
{
35
static class Utils
46
{
@@ -13,5 +15,23 @@ public static string ReplaceAllChars(this string str, char[] characters, char re
1315

1416
return tmp;
1517
}
18+
19+
public static byte[] ImgToBytes(Bitmap img)
20+
{
21+
System.Collections.Generic.List<byte> bytes = new();
22+
for (int y = 0; y < img.Height; y++)
23+
{
24+
for (int x = 0; x < img.Width; x++)
25+
{
26+
var color = img.GetPixel(x, y);
27+
bytes.Add(color.R);
28+
bytes.Add(color.G);
29+
bytes.Add(color.B);
30+
bytes.Add(color.A);
31+
}
32+
}
33+
34+
return bytes.ToArray();
35+
}
1636
}
1737
}

0 commit comments

Comments
 (0)