Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Game Icons Apr 7, 2024 #338

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This `IconPacks` library contains controls, markup extensions and converters to
| [Font Awesome Free](https://fontawesome.com/) | 6.5.2 | 2045 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.FontAwesome/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.FontAwesome.svg?style=flat-square&&label=FontAwesome"></a> |
| [Fontisto](https://github.com/kenangundogan/fontisto) | 3.0.4 | 616 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Fontisto/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Fontisto.svg?style=flat-square&&label=Fontisto"></a> |
| [Fork Awesome](https://forkaweso.me/) | 1.2.0 | 794 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.ForkAwesome/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.ForkAwesome.svg?style=flat-square&&label=ForkAwesome"></a> |
| [Game Icons](https://game-icons.net/) | Apr 7, 2024| 4149 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.GameIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.GameIcons.svg?style=flat-square&&label=GameIcons"></a> |
| [Ionicons](https://ionicons.com/) | 4.6.4.1 | 696 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Ionicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Ionicons.svg?style=flat-square&&label=Ionicons"></a> |
| [Jam Icons](https://github.com/michaelampr/jam) | 3.1.0 | 940 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.JamIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.JamIcons.svg?style=flat-square&&label=JamIcons"></a> |
| [Lucide Icons](https://github.com/lucide-icons/lucide) | 0.378.0 | 1460 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Lucide/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Lucide.svg?style=flat-square&&label=Lucide"></a> |
Expand All @@ -52,7 +53,7 @@ This `IconPacks` library contains controls, markup extensions and converters to
| [Material Icons (Google)](https://github.com/google/material-design-icons) | 4.0.0 | 8413 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.MaterialDesign/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.MaterialDesign.svg?style=flat-square&&label=MaterialDesign"></a> |
| [Memory Icons](https://pictogrammers.com/library/memory/) | 1.5.0 | 651 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.MemoryIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.MemoryIcons.svg?style=flat-square&&label=MemoryIcons"></a> |
| [Microns](https://github.com/stephenhutchings/microns) | 1.1.4 | 164 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Microns/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Microns.svg?style=flat-square&&label=Microns"></a> |
| [Modern UI Icons](https://github.com/Templarian/WindowsIcons) | | 1260 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Modern/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Modern.svg?style=flat-square&&label=Modern"></a> |
| [Modern UI Icons](https://github.com/Templarian/WindowsIcons) | Feb 12, 2015 | 1260 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Modern/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Modern.svg?style=flat-square&&label=Modern"></a> |
| [Primer Octicons (GitHub)](https://github.com/primer/octicons) | 19.9.0 | 604 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Octicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Octicons.svg?style=flat-square&&label=Octicons"></a> |
| [PICOL Icons](https://github.com/PicolSigns/Icons) | 1.1.0 | 549 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.PicolIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.PicolIcons.svg?style=flat-square&&label=PicolIcons"></a> |
| [Pixelarticons Free](https://pixelarticons.com/) | 1.8.1 | 486 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.PixelartIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.PixelartIcons.svg?style=flat-square&&label=PixelartIcons"></a> |
Expand All @@ -64,7 +65,7 @@ This `IconPacks` library contains controls, markup extensions and converters to
| [Unicons](https://github.com/Iconscout/unicons) | 4.0.8 | 1607 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Unicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Unicons.svg?style=flat-square&&label=Unicons"></a> |
| [Vaadin Icons](https://vaadin.com/icons) | 24.3.11 | 636 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.VaadinIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.VaadinIcons.svg?style=flat-square&&label=VaadinIcons"></a> |
| [Weather Icons](https://github.com/erikflowers/weather-icons) | 2.0.10 | 219 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.WeatherIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.WeatherIcons.svg?style=flat-square&&label=WeatherIcons"></a> |
| [Zondicons](https://www.zondicons.com) | | 297 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Zondicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Zondicons.svg?style=flat-square&&label=Zondicons"></a> |
| [Zondicons](https://www.zondicons.com) | July 12, 2017 | 297 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Zondicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Zondicons.svg?style=flat-square&&label=Zondicons"></a> |

## Note

Expand Down
14 changes: 14 additions & 0 deletions src/MahApps.Metro.IconPacks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.Cir
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.Lucide", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.Lucide.csproj", "{1E35D230-1B57-4EDC-967E-B8972D4271BD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.GameIcons", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.GameIcons.csproj", "{ED5CB032-C631-48B4-AE1F-16B88300A025}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -524,6 +526,18 @@ Global
{1E35D230-1B57-4EDC-967E-B8972D4271BD}.Release|x64.Build.0 = Release|Any CPU
{1E35D230-1B57-4EDC-967E-B8972D4271BD}.Release|x86.ActiveCfg = Release|Any CPU
{1E35D230-1B57-4EDC-967E-B8972D4271BD}.Release|x86.Build.0 = Release|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Debug|x64.ActiveCfg = Debug|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Debug|x64.Build.0 = Debug|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Debug|x86.ActiveCfg = Debug|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Debug|x86.Build.0 = Debug|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Release|Any CPU.Build.0 = Release|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Release|x64.ActiveCfg = Release|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Release|x64.Build.0 = Release|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Release|x86.ActiveCfg = Release|Any CPU
{ED5CB032-C631-48B4-AE1F-16B88300A025}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
76 changes: 76 additions & 0 deletions src/MahApps.Metro.IconPacks/Icons/GameIcons/PackIconGameIcons.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
#if (NETFX_CORE || WINDOWS_UWP)
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
#else
using System.Windows;
#endif

namespace MahApps.Metro.IconPacks
{
/// <summary>
/// All icons sourced from Game Icons <see><cref>https://github.com/game-icons/icons</cref></see>
/// In accordance of <see><cref>https://github.com/game-icons/icons?tab=License-1-ov-file#readme</cref></see>.
/// </summary>
[MetaData("Game Icons", "https://github.com/game-icons/icons", "https://github.com/game-icons/icons?tab=License-1-ov-file#readme")]
public class PackIconGameIcons : PackIconControlBase
{
public static readonly DependencyProperty KindProperty
= DependencyProperty.Register(nameof(Kind), typeof(PackIconGameIconsKind), typeof(PackIconGameIcons), new PropertyMetadata(default(PackIconGameIconsKind), KindPropertyChangedCallback));

private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((PackIconGameIcons)dependencyObject).UpdateData();
}
}

/// <summary>
/// Gets or sets the icon to display.
/// </summary>
public PackIconGameIconsKind Kind
{
get { return (PackIconGameIconsKind)GetValue(KindProperty); }
set { SetValue(KindProperty, value); }
}

#if !(NETFX_CORE || WINDOWS_UWP)
static PackIconGameIcons()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIconGameIcons), new FrameworkPropertyMetadata(typeof(PackIconGameIcons)));
}
#endif

public PackIconGameIcons()
{
#if NETFX_CORE || WINDOWS_UWP
this.DefaultStyleKey = typeof(PackIconGameIcons);
#endif
}

protected override void SetKind<TKind>(TKind iconKind)
{
#if NETFX_CORE || WINDOWS_UWP
BindingOperations.SetBinding(this, PackIconGameIcons.KindProperty, new Binding() { Source = iconKind, Mode = BindingMode.OneTime });
#else
this.SetCurrentValue(KindProperty, iconKind);
#endif
}

protected override void UpdateData()
{
if (Kind != default(PackIconGameIconsKind))
{
string data = null;
PackIconGameIconsDataFactory.DataIndex.Value?.TryGetValue(Kind, out data);
this.Data = data;
}
else
{
this.Data = null;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;

namespace MahApps.Metro.IconPacks
{
[MarkupExtensionReturnType(typeof(Cursor))]
public class GameIconsCursorExtension : GameIconsImageExtension, IPackIconCursorExtension
{
public GameIconsCursorExtension() : base() => base.Brush = PackIconCursorHelper.DefaultBrush;
public GameIconsCursorExtension(PackIconGameIconsKind kind) : base(kind) => base.Brush = PackIconCursorHelper.DefaultBrush;

/// <inheritdoc/>
public Point HotSpot { get; set; }
/// <inheritdoc/>
public double Width { get; set; } = PackIconCursorHelper.DefaultWidth;
/// <inheritdoc/>
public double Height { get; set; } = PackIconCursorHelper.DefaultHeight;
/// <inheritdoc/>
public Brush StrokeBrush { get; set; }
/// <inheritdoc/>
public double StrokeThickness { get; set; } = PackIconCursorHelper.DefaultStrokeThickness;

public override object ProvideValue(IServiceProvider serviceProvider)
{
TransformGroup transformGroup = (TransformGroup)GetTransformGroup(this.Kind);
Geometry geometry = PackIconCursorHelper.GetCursorGeometry(GetPathData(this.Kind), transformGroup, Width, Height);
return PackIconCursorHelper.GeometryToCursor(geometry, Brush, StrokeBrush, StrokeThickness, HotSpot);
}
}
}
Loading
Loading