Skip to content

Commit

Permalink
Merge pull request #33 from InfinaMii/main
Browse files Browse the repository at this point in the history
Load window icon properly on Linux
  • Loading branch information
KillzXGaming authored Oct 16, 2024
2 parents 77bf226 + 5d4999c commit 5f51f14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ bld/
[Ll]og/
[Ll]ogs/

#Rider/Idea options directory
.idea/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
Expand Down
3 changes: 3 additions & 0 deletions Track Studio/TrackStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<Content Update="Lib\Fonts\OpenFontIcons.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions Track Studio/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ static void Main(string[] args)
var wnd = new UIFramework.Framework(new MainWindow(argumentHandle), mode, asssemblyVersion);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
wnd.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
wnd.Icon = new System.Drawing.Icon(
System.IO.File.Open(Path.Combine(assemblyDir, "Icon.ico"), FileMode.Open), 256, 256);
}

wnd.VSync = OpenTK.VSyncMode.On;
wnd.Run();
}
Expand Down

0 comments on commit 5f51f14

Please sign in to comment.