Skip to content

Commit

Permalink
* Massive UI change from WinForms to WPF.
Browse files Browse the repository at this point in the history
* Now requires C# 7.2, .NET 4.6.2, most likely needs to be built with Visual Studio 2017.
* Utilizes PostSharp, primarily for INotifyPropertyChanged support and some required contracts. (You do not need a license to build unless you change something yourself.)
* Included Roboto Mono font for the text boxes.
* Rebuilt wall images.
* Nicer About dialog box.
* More caching being done.
* Utilized asynchronous methods, which allowed for a "throbber" of sorts to be used.
* Added a loading overlay for the above.
* Split a few objects into their own files.
* Added a display of the selected color to the Color to Wall controls.
* Used DebuggerDisplay over ToString in many places.
* Partially fixed the issue with the way walls were being rendered, rand.Next(0, 2) would only get a 0 or a 1, 2 was never picked. Still seems off from the actual game, though.
* Switched to PackageReference over packages.config.
* Made it so the process to regenerate the wall images edits the project file directly, as resources were changed to comply with WPF's way of embedding resources.
* Updated README to include updates and listing what 3rd-party resources I used.
* Updated copyright year.
* Included a program icon (it is just Terraria's actual icon).
* Included a nice unhandled exception window, as WPF doesn't have one like WinForms does.
  • Loading branch information
CyberBotX committed Nov 1, 2018
1 parent 638a24a commit 65148cd
Show file tree
Hide file tree
Showing 174 changed files with 3,612 additions and 4,669 deletions.
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
.vs/
# User-specific files
*.user

# Build results
[Bb]in/
[Oo]bj/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Visual Studio 2015/2017 cache/options directory
.vs/
75 changes: 75 additions & 0 deletions About.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<Window x:Class="TerrariaPixelArtHelper.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:TerrariaPixelArtHelper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="About"
FocusManager.FocusedElement="{Binding ElementName=okButton, Mode=OneTime}"
ResizeMode="NoResize" ShowInTaskbar="False"
SizeToContent="WidthAndHeight" WindowStartupLocation="CenterOwner"
WindowStyle="ThreeDBorderWindow"
mc:Ignorable="d">
<Window.Background>
<SolidColorBrush Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" />
</Window.Background>
<StackPanel Margin="10">
<Label Padding="0"
Content="{x:Static local:About.Version}"
ContentStringFormat="Terraria Pixel Art Helper v{0} by: Naram Qashat (CyberBotX)" />
<TextBlock>
<Hyperlink NavigateUri="https://github.com/CyberBotX/TerrariaPixelArtHelper" RequestNavigate="Hyperlink_RequestNavigate">https://github.com/CyberBotX/TerrariaPixelArtHelper</Hyperlink>
</TextBlock>
<ContentControl Content="{StaticResource Lines}" />
<TextBlock>
<Run>Terraria is copyright to</Run>
<Hyperlink NavigateUri="https://re-logic.com/" RequestNavigate="Hyperlink_RequestNavigate">Re-Logic</Hyperlink>
</TextBlock>
<TextBlock Text="Program icon comes from Terraria" />
<ContentControl Content="{StaticResource Lines}" />
<TextBlock Text="Uses the font Roboto Mono by: Christian Robertson" />
<TextBlock>
<Hyperlink NavigateUri="https://fonts.google.com/specimen/Roboto+Mono" RequestNavigate="Hyperlink_RequestNavigate">https://fonts.google.com/specimen/Roboto+Mono</Hyperlink>
</TextBlock>
<ContentControl Content="{StaticResource Lines}" />
<GroupBox>
<GroupBox.BorderBrush>
<SolidColorBrush Color="{StaticResource {x:Static SystemColors.ControlDarkDarkColorKey}}" />
</GroupBox.BorderBrush>
<GroupBox.Header>
<TextBlock Height="17" Text="Utilizes the following libraries:" />
</GroupBox.Header>
<!-- Idea for AlternationCount and DataTemplate.Triggers comes from https://stackoverflow.com/a/34138980 -->
<ItemsControl Margin="2"
AlternationCount="{Binding Items.Count, RelativeSource={RelativeSource Self}, Mode=OneWay}"
ItemsSource="{Binding Source={x:Static local:About.Libraries}, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<ContentControl x:Name="Separator" Content="{StaticResource Lines}" />
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Library, Mode=OneWay}" />
<TextBlock Text=" v" />
<TextBlock Text="{Binding Version, Mode=OneWay}" />
<TextBlock Text=" by: " />
<TextBlock Text="{Binding Author, Mode=OneWay}" />
</StackPanel>
<TextBlock>
<Hyperlink NavigateUri="{Binding Url, Mode=OneWay}" RequestNavigate="Hyperlink_RequestNavigate">
<Run Text="{Binding Url, Mode=OneWay}" />
</Hyperlink>
</TextBlock>
</StackPanel>
<DataTemplate.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter TargetName="Separator" Property="Visibility" Value="Collapsed" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
<Button x:Name="okButton"
Width="50"
Margin="0,5,0,0"
Click="OK_Click" Content="OK" />
</StackPanel>
</Window>
82 changes: 82 additions & 0 deletions About.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Navigation;

/// <remarks>
/// See Program.cs for license.
/// </remarks>
namespace TerrariaPixelArtHelper
{
/// <summary>
/// Interaction logic for About.xaml
/// </summary>
public partial class About : Window
{
public static List<LibraryData> Libraries = new List<LibraryData>()
{
new LibraryData()
{
Library = "CalcBinding",
Version = typeof(CalcBinding.Binding).Assembly.GetName().Version,
Author = "Alexander Zinchenko",
Url = "https://github.com/Alex141/CalcBinding"
},
new LibraryData()
{
Library = "FontAwesome5",
Version = typeof(FontAwesome5.WPF.FontAwesome).Assembly.GetName().Version,
Author = "Codinion",
Url = "https://github.com/MartinTopfstedt/FontAwesome5"
},
new LibraryData()
{
Library = "JeremyAnsel.ColorQuant",
Version = typeof(JeremyAnsel.ColorQuant.WuColorQuantizer).Assembly.GetName().Version,
Author = "Jérémy Ansel",
Url = "https://github.com/JeremyAnsel/JeremyAnsel.ColorQuant"
},
new LibraryData()
{
Library = "Math.NET Numerics",
Version = typeof(MathNet.Numerics.Constants).Assembly.GetName().Version,
Author = "Christoph Ruegg, Marcus Cuda, Jurgen Van Gael",
Url = "https://numerics.mathdotnet.com/"
},
new LibraryData()
{
Library = "PostSharp",
Version = typeof(PostSharp.Post).Assembly.GetName().Version,
Author = "PostSharp Technologies",
Url = "https://www.postsharp.net/"
},
new LibraryData()
{
Library = "WriteableBitmapEx",
Version = typeof(System.Windows.Media.Imaging.BitmapFactory).Assembly.GetName().Version,
Author = "Schulte Software Development",
Url = "https://github.com/teichgraf/WriteableBitmapEx"
}
};

public static Version Version = typeof(About).Assembly.GetName().Version;

public About() => this.InitializeComponent();

void OK_Click(object sender, RoutedEventArgs e) => this.Close();

void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) => Process.Start(e.Uri.ToString());
}

public class LibraryData
{
public string Author { get; set; }

public string Library { get; set; }

public Version Version { get; set; }

public string Url { get; set; }
}
}
22 changes: 22 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Application x:Class="TerrariaPixelArtHelper.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DispatcherUnhandledException="Application_DispatcherUnhandledException" StartupUri="MainWindow.xaml">
<Application.Resources>
<FontFamily x:Key="RobotoMono">pack://application:,,,/Fonts/RobotoMono/#Roboto Mono</FontFamily>
<StackPanel x:Key="Lines"
Margin="0,5"
x:Shared="False">
<Line Height="1"
Stroke="White"
X2="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}}" />
<Line Height="1" X2="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}}">
<Line.Stroke>
<SolidColorBrush Color="{StaticResource {x:Static SystemColors.ControlDarkDarkColorKey}}" />
</Line.Stroke>
</Line>
<Line Height="1"
Stroke="White"
X2="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}}" />
</StackPanel>
</Application.Resources>
</Application>
Loading

0 comments on commit 65148cd

Please sign in to comment.