Skip to content

Commit

Permalink
Added an Image to Pixel-art Editor Plugin. (#1910)
Browse files Browse the repository at this point in the history
* Added an Image to Pixel-art Editor Plugin.

* Added an Image to Pixel-art Editor Plugin.

* Added an Image to Pixel-art Editor Plugin.
  • Loading branch information
RussDev7 authored Jul 14, 2024
1 parent 5123140 commit 6f8571f
Show file tree
Hide file tree
Showing 14 changed files with 34,497 additions and 4 deletions.
38 changes: 38 additions & 0 deletions src/TEdit/Editor/Plugins/ImageToPixelartEditor.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
220 changes: 220 additions & 0 deletions src/TEdit/Editor/Plugins/ImageToPixelartEditorView.xaml

Large diffs are not rendered by default.

Loading

0 comments on commit 6f8571f

Please sign in to comment.