From 6f8571fddfff5d09e11236c504a12ce7b29d1366 Mon Sep 17 00:00:00 2001 From: DannyRuss <33048298+RussDev7@users.noreply.github.com> Date: Sat, 13 Jul 2024 21:22:03 -0500 Subject: [PATCH] Added an Image to Pixel-art Editor Plugin. (#1910) * Added an Image to Pixel-art Editor Plugin. * Added an Image to Pixel-art Editor Plugin. * Added an Image to Pixel-art Editor Plugin. --- .../Editor/Plugins/ImageToPixelartEditor.cs | 38 + .../Plugins/ImageToPixelartEditorView.xaml | 220 + .../Plugins/ImageToPixelartEditorView.xaml.cs | 2028 + src/TEdit/Images/Overlays/Thumbs.db | Bin 0 -> 5632 bytes src/TEdit/Images/Pixelart/etp.jpg | Bin 0 -> 32976 bytes src/TEdit/Images/Pixelart/globeTest.png | Bin 0 -> 49695 bytes src/TEdit/Images/Thumbs.db | Bin 0 -> 13312 bytes src/TEdit/Images/Toolbar/Thumbs.db | Bin 0 -> 4096 bytes src/TEdit/Images/Tools/Thumbs.db | Bin 0 -> 4096 bytes src/TEdit/Images/te5.png | Bin 0 -> 5990 bytes src/TEdit/Images/tedit.ico | Bin 34494 -> 9662 bytes src/TEdit/MapColors.xml | 32198 ++++++++++++++++ src/TEdit/TEdit.csproj | 10 +- src/TEdit/ViewModel/ViewModelLocator.cs | 7 +- 14 files changed, 34497 insertions(+), 4 deletions(-) create mode 100644 src/TEdit/Editor/Plugins/ImageToPixelartEditor.cs create mode 100644 src/TEdit/Editor/Plugins/ImageToPixelartEditorView.xaml create mode 100644 src/TEdit/Editor/Plugins/ImageToPixelartEditorView.xaml.cs create mode 100644 src/TEdit/Images/Overlays/Thumbs.db create mode 100644 src/TEdit/Images/Pixelart/etp.jpg create mode 100644 src/TEdit/Images/Pixelart/globeTest.png create mode 100644 src/TEdit/Images/Thumbs.db create mode 100644 src/TEdit/Images/Toolbar/Thumbs.db create mode 100644 src/TEdit/Images/Tools/Thumbs.db create mode 100644 src/TEdit/Images/te5.png create mode 100644 src/TEdit/MapColors.xml diff --git a/src/TEdit/Editor/Plugins/ImageToPixelartEditor.cs b/src/TEdit/Editor/Plugins/ImageToPixelartEditor.cs new file mode 100644 index 000000000..c39d7de1e --- /dev/null +++ b/src/TEdit/Editor/Plugins/ImageToPixelartEditor.cs @@ -0,0 +1,38 @@ +using TEdit.ViewModel; +using System.Windows; + +namespace TEdit.Editor.Plugins +{ + public class ImageToPixelartEditor : BasePlugin + { + // Private field to keep a reference to the ImageToPixelartEditorView window. + private ImageToPixelartEditorView _view; + + // Constructor for ImageToPixelartEditor. + public ImageToPixelartEditor(WorldViewModel worldViewModel) : base(worldViewModel) + { + Name = "Image To Pixelart Editor"; + } + + // Method to execute the plugin functionality. + public override void Execute() + { + // No need to wait for world load due to the nature of this plugin. + // if (_wvm.CurrentWorld == null) return; + + // Initialize and show the ImageToPixelartEditorView window as a non-modal window. + _view = new ImageToPixelartEditorView(_wvm); // Pass down "_wvm" instance to the new window. + _view.Show(); // Open as non-modal window. + + // Subscribe to the main window's Closed event. + Application.Current.MainWindow.Closed += MainWindow_Closed; + } + + // Event handler for the main window's Closed event. + private void MainWindow_Closed(object sender, System.EventArgs e) + { + // Close the ImageToPixelartEditorView window if it is open. + _view?.Close(); + } + } +} diff --git a/src/TEdit/Editor/Plugins/ImageToPixelartEditorView.xaml b/src/TEdit/Editor/Plugins/ImageToPixelartEditorView.xaml new file mode 100644 index 000000000..011b15d66 --- /dev/null +++ b/src/TEdit/Editor/Plugins/ImageToPixelartEditorView.xaml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +