Project Saving/Loading Added!

This commit is contained in:
quinnvoker
2018-12-02 18:56:46 -08:00
parent de9d120a23
commit 898a14962d
10 changed files with 343 additions and 576 deletions
@@ -1,74 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1938BD7-A474-427F-91F1-F8A1875B28CE}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>AnimationGenerator</RootNamespace>
<AssemblyName>AnimationGenerator</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.8.0.76, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework.Content.Pipeline">
<HintPath>C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MonoGame.Framework.Content.Pipeline.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QURO.AnimationLibrary\QURO.AnimationLibrary.csproj">
<Project>{69dadc27-fbeb-4625-9212-6eb5bed5102a}</Project>
<Name>QURO.AnimationLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\QURO\QURO.csproj">
<Project>{4581e0c8-b14a-454d-9a7b-52d37535e7e9}</Project>
<Name>QURO</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Content\boardMap.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
-76
View File
@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
<Asset Type="System.Collections.Generic.Dictionary[System.String, Microsoft.Xna.Framework.Rectangle]">
<Item><Key>block0</Key><Value>0 0 16 16</Value></Item>
<Item><Key>block0_bounce1</Key><Value>16 0 16 16</Value></Item>
<Item><Key>block0_bounce2</Key><Value>32 0 16 16</Value></Item>
<Item><Key>block0_flash</Key><Value>48 0 16 16</Value></Item>
<Item><Key>block0_pop</Key><Value>64 0 16 16</Value></Item>
<Item><Key>block0_squish</Key><Value>80 0 16 16</Value></Item>
<Item><Key>block1</Key><Value>0 16 16 16</Value></Item>
<Item><Key>block1_bounce1</Key><Value>16 16 16 16</Value></Item>
<Item><Key>block1_bounce2</Key><Value>32 16 16 16</Value></Item>
<Item><Key>block1_flash</Key><Value>48 16 16 16</Value></Item>
<Item><Key>block1_pop</Key><Value>64 16 16 16</Value></Item>
<Item><Key>block1_squish</Key><Value>80 16 16 16</Value></Item>
<Item><Key>block2</Key><Value>0 32 16 16</Value></Item>
<Item><Key>block2_bounce1</Key><Value>16 32 16 16</Value></Item>
<Item><Key>block2_bounce2</Key><Value>32 32 16 16</Value></Item>
<Item><Key>block2_flash</Key><Value>48 32 16 16</Value></Item>
<Item><Key>block2_pop</Key><Value>64 32 16 16</Value></Item>
<Item><Key>block2_squish</Key><Value>80 32 16 16</Value></Item>
<Item><Key>block3</Key><Value>0 48 16 16</Value></Item>
<Item><Key>block3_bounce1</Key><Value>16 48 16 16</Value></Item>
<Item><Key>block3_bounce2</Key><Value>32 48 16 16</Value></Item>
<Item><Key>block3_flash</Key><Value>48 48 16 16</Value></Item>
<Item><Key>block3_pop</Key><Value>64 48 16 16</Value></Item>
<Item><Key>block3_squish</Key><Value>80 48 16 16</Value></Item>
<Item><Key>block4</Key><Value>0 64 16 16</Value></Item>
<Item><Key>block4_bounce1</Key><Value>16 64 16 16</Value></Item>
<Item><Key>block4_bounce2</Key><Value>32 64 16 16</Value></Item>
<Item><Key>block4_flash</Key><Value>48 64 16 16</Value></Item>
<Item><Key>block4_pop</Key><Value>64 64 16 16</Value></Item>
<Item><Key>block4_squish</Key><Value>80 64 16 16</Value></Item>
<Item><Key>soloCursor</Key><Value>16 80 23 23</Value></Item>
<Item><Key>soloCursor_pulse</Key><Value>39 80 23 23</Value></Item>
<Item><Key>tiledBG_default</Key><Value>0 80 16 16</Value></Item>
<Item><Key>twinCursor</Key><Value>0 103 39 23</Value></Item>
<Item><Key>twinCursor_pulse</Key><Value>39 103 39 23</Value></Item>
</Asset>
</XnaContent>
@@ -1,50 +0,0 @@
/*
* Class auto generated by TexturePacker
*
* Contains references to each image within the sprite sheet.
*
* https://www.codeandweb.com/texturepacker
* $TexturePacker:SmartUpdate:9c249f83b4f96ec61c8a09e8200742d5:d881ff5ec3da86acaaa577e6ab9bd7aa:05477a09d9d5a6dca0fdadde24fc3000$
*
*/
namespace TexturePackerSpriteDefinitions
{
public class SpriteNames
{
public const string Block0 = "block0";
public const string Block0_bounce1 = "block0_bounce1";
public const string Block0_bounce2 = "block0_bounce2";
public const string Block0_flash = "block0_flash";
public const string Block0_pop = "block0_pop";
public const string Block0_squish = "block0_squish";
public const string Block1 = "block1";
public const string Block1_bounce1 = "block1_bounce1";
public const string Block1_bounce2 = "block1_bounce2";
public const string Block1_flash = "block1_flash";
public const string Block1_pop = "block1_pop";
public const string Block1_squish = "block1_squish";
public const string Block2 = "block2";
public const string Block2_bounce1 = "block2_bounce1";
public const string Block2_bounce2 = "block2_bounce2";
public const string Block2_flash = "block2_flash";
public const string Block2_pop = "block2_pop";
public const string Block2_squish = "block2_squish";
public const string Block3 = "block3";
public const string Block3_bounce1 = "block3_bounce1";
public const string Block3_bounce2 = "block3_bounce2";
public const string Block3_flash = "block3_flash";
public const string Block3_pop = "block3_pop";
public const string Block3_squish = "block3_squish";
public const string Block4 = "block4";
public const string Block4_bounce1 = "block4_bounce1";
public const string Block4_bounce2 = "block4_bounce2";
public const string Block4_flash = "block4_flash";
public const string Block4_pop = "block4_pop";
public const string Block4_squish = "block4_squish";
public const string SoloCursor = "soloCursor";
public const string SoloCursor_pulse = "soloCursor_pulse";
public const string TiledBG_default = "tiledBG_default";
public const string TwinCursor = "twinCursor";
public const string TwinCursor_pulse = "twinCursor_pulse";
}
}
-161
View File
@@ -1,161 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using QURO;
using QURO.AnimationLibrary;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
namespace AnimationGenerator
{
class Program
{
public static Dictionary<string, Rectangle> loadedFrames;
public static AnimationSet output;
public static void Main(string[] args)
{
using(XmlReader xmlRead = XmlReader.Create("Content/boardMap.xml"))
{
loadedFrames = IntermediateSerializer.Deserialize<Dictionary<string, Rectangle>>(xmlRead, null);
}
output = new AnimationSet();
Frame[] soloCursor_pulse_frames = new Frame[]
{
new Frame(loadedFrames["soloCursor"], FrameTime.FramesToSeconds(20)),
new Frame(loadedFrames["soloCursor_pulse"], FrameTime.FramesToSeconds(20)),
};
output.Add(new Animation("soloCursor_pulse", soloCursor_pulse_frames, true));
Frame[] twinCursor_pulse_frames = new Frame[]
{
new Frame(loadedFrames["twinCursor"], FrameTime.FramesToSeconds(20)),
new Frame(loadedFrames["twinCursor_pulse"], FrameTime.FramesToSeconds(20)),
};
output.Add(new Animation("twinCursor_pulse", twinCursor_pulse_frames, true));
Frame[] block_default_frames = new Frame[]
{
new Frame(loadedFrames["block0"], 0),
};
output.Add(new Animation("block_default", block_default_frames, false));
Frame[] block_matched_frames = new Frame[]
{
new Frame(loadedFrames["block0"], 0),
new Frame(loadedFrames["block0_flash"], 0)
};
output.Add(new Animation("block_matched", block_matched_frames, true));
Frame[] block_pop_frames = new Frame[]
{
new Frame(loadedFrames["block0_pop"], 0),
};
output.Add(new Animation("block_pop", block_pop_frames, false));
Frame[] block_fall_frames = new Frame[]
{
new Frame(loadedFrames["block0"], 0),
new Frame(loadedFrames["block0_bounce1"], 0),
new Frame(loadedFrames["block0_bounce2"], 0),
};
output.Add(new Animation("block_fall", block_fall_frames, false));
Frame[] block_squished_frames = new Frame[]
{
new Frame(loadedFrames["block0_squish"], 0),
};
output.Add(new Animation("block_squished", block_squished_frames, false));
Frame[] block_bounce_frames = new Frame[]
{
new Frame(loadedFrames["block0_bounce2"], FrameTime.FramesToSeconds(1)),
new Frame(loadedFrames["block0"], FrameTime.FramesToSeconds(1)),
new Frame(loadedFrames["block0_squish"], FrameTime.FramesToSeconds(1)),
new Frame(loadedFrames["block0"], FrameTime.FramesToSeconds(1)),
new Frame(loadedFrames["block0_bounce1"], FrameTime.FramesToSeconds(2)),
new Frame(loadedFrames["block0"], FrameTime.FramesToSeconds(0)),
};
output.Add(new Animation("block_bounce", block_bounce_frames, false));
Frame[] tiledBG_default_frames = new Frame[]
{
new Frame(loadedFrames["tiledBG_default"], 0),
};
output.Add(new Animation("tiledBG_default", tiledBG_default_frames, false));
var xmlSettings = new XmlWriterSettings();
xmlSettings.Indent = true;
using(XmlWriter writer = XmlWriter.Create("output.xml"))
{
IntermediateSerializer.Serialize(writer, output, null);
}
}
/*
public Animation TwinCursor_pulse => new Animation("twinCursor_pulse", textureAtlas, twinCursor_pulse_frames, FrameTimerUtility.FramesToSeconds(20), true);
private readonly string[] twinCursor_pulse_frames = new string[]
{
SpriteNames.TwinCursor,
SpriteNames.TwinCursor_pulse
};
//red blocks
public Animation Block_default => new Animation("block_default", textureAtlas, block_default_frames, defaultDelay, false);
private readonly string[] block_default_frames = new string[]
{
SpriteNames.Block0
};
public Animation Block_matched => new Animation("block_matched", textureAtlas, block_matched_frames, defaultDelay, true);
private readonly string[] block_matched_frames = new string[]
{
SpriteNames.Block0,
SpriteNames.Block0_flash
};
public Animation Block_pop => new Animation("block_pop", textureAtlas, block_pop_frames, defaultDelay, true);
private readonly string[] block_pop_frames = new string[]
{
SpriteNames.Block0_pop
};
public Animation Block_fall => new Animation("block_fall", textureAtlas, block_fall_frames, defaultDelay, false);
private readonly string[] block_fall_frames = new string[]
{
SpriteNames.Block0,
SpriteNames.Block0_bounce1,
SpriteNames.Block0_bounce2,
};
public Animation Block_squished => new Animation("block_squished", textureAtlas, block_squished_frames, defaultDelay, false);
private readonly string[] block_squished_frames = new string[]
{
SpriteNames.Block0_squish
};
public Animation Block_bounce => new Animation("block_bounce", textureAtlas, block_bounce_frames, defaultDelay, false);
private readonly string[] block_bounce_frames = new string[]
{
SpriteNames.Block0_bounce2,
SpriteNames.Block0,
SpriteNames.Block0_squish,
SpriteNames.Block0,
SpriteNames.Block0_bounce1,
SpriteNames.Block0_bounce1,
SpriteNames.Block0
};
public Animation TiledBG_default => new Animation("tiledBG_default", textureAtlas, tiledBG_default_frames, defaultDelay, false);
private readonly string[] tiledBG_default_frames = new string[]
{
SpriteNames.TiledBG_default
};
*/
}
}
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AnimationGenerator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AnimationGenerator")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b1938bd7-a474-427f-91f1-f8a1875b28ce")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+173 -112
View File
@@ -37,11 +37,14 @@
this.moveUpButton = new System.Windows.Forms.Button();
this.spritesLabel = new System.Windows.Forms.Label();
this.spriteEditPanel = new System.Windows.Forms.Panel();
this.editingOriginCheckBox = new System.Windows.Forms.CheckBox();
this.originEditPanel = new System.Windows.Forms.Panel();
this.originPresetLabel = new System.Windows.Forms.Label();
this.originPresetBox = new System.Windows.Forms.ComboBox();
this.originXPosLabel = new System.Windows.Forms.Label();
this.originYPosLabel = new System.Windows.Forms.Label();
this.originYPosBox = new System.Windows.Forms.NumericUpDown();
this.originXPosBox = new System.Windows.Forms.NumericUpDown();
this.originYPosLabel = new System.Windows.Forms.Label();
this.originXPosLabel = new System.Windows.Forms.Label();
this.editingOriginCheckBox = new System.Windows.Forms.CheckBox();
this.spriteHeightBox = new System.Windows.Forms.NumericUpDown();
this.spriteWidthBox = new System.Windows.Forms.NumericUpDown();
this.spriteYPosBox = new System.Windows.Forms.NumericUpDown();
@@ -62,23 +65,27 @@
this.zoomLabel = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadSpriteSheetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.newProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.saveSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveSpriteMapAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveProjectAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.importSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSpriteMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.highlightCheckBox = new System.Windows.Forms.CheckBox();
this.outlineTimer = new System.Windows.Forms.Timer(this.components);
this.originPresetBox = new System.Windows.Forms.ComboBox();
this.originPresetLabel = new System.Windows.Forms.Label();
this.originEditPanel = new System.Windows.Forms.Panel();
this.viewEditPanel = new System.Windows.Forms.Panel();
this.saveProjectDialog = new System.Windows.Forms.SaveFileDialog();
this.openProjectDialog = new System.Windows.Forms.OpenFileDialog();
this.importSpriteSheetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.spriteSheetViewer = new SpriteMapEditor.PictureBoxWithInterpolationMode();
this.spriteListEditPanel.SuspendLayout();
this.spriteEditPanel.SuspendLayout();
this.originEditPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.originYPosBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.originXPosBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spriteHeightBox)).BeginInit();
@@ -87,7 +94,6 @@
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).BeginInit();
this.spriteViewerPanel.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.originEditPanel.SuspendLayout();
this.viewEditPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spriteSheetViewer)).BeginInit();
this.SuspendLayout();
@@ -103,7 +109,7 @@
this.spriteList.MinimumSize = new System.Drawing.Size(4, 4);
this.spriteList.Name = "spriteList";
this.spriteList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.spriteList.Size = new System.Drawing.Size(182, 121);
this.spriteList.Size = new System.Drawing.Size(182, 251);
this.spriteList.TabIndex = 0;
this.spriteList.SelectedValueChanged += new System.EventHandler(this.spriteList_SelectedValueChanged);
//
@@ -143,13 +149,13 @@
this.spriteListEditPanel.Enabled = false;
this.spriteListEditPanel.Location = new System.Drawing.Point(2, 27);
this.spriteListEditPanel.Name = "spriteListEditPanel";
this.spriteListEditPanel.Size = new System.Drawing.Size(191, 215);
this.spriteListEditPanel.Size = new System.Drawing.Size(191, 321);
this.spriteListEditPanel.TabIndex = 8;
//
// moveDownButton
//
this.moveDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.moveDownButton.Location = new System.Drawing.Point(41, 183);
this.moveDownButton.Location = new System.Drawing.Point(41, 289);
this.moveDownButton.Name = "moveDownButton";
this.moveDownButton.Size = new System.Drawing.Size(70, 20);
this.moveDownButton.TabIndex = 5;
@@ -160,7 +166,7 @@
// moveUpButton
//
this.moveUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.moveUpButton.Location = new System.Drawing.Point(117, 183);
this.moveUpButton.Location = new System.Drawing.Point(117, 289);
this.moveUpButton.Name = "moveUpButton";
this.moveUpButton.Size = new System.Drawing.Size(71, 20);
this.moveUpButton.TabIndex = 6;
@@ -195,21 +201,61 @@
this.spriteEditPanel.Controls.Add(this.spriteSettingsLabel);
this.spriteEditPanel.Controls.Add(this.spriteNameBox);
this.spriteEditPanel.Enabled = false;
this.spriteEditPanel.Location = new System.Drawing.Point(2, 241);
this.spriteEditPanel.Location = new System.Drawing.Point(2, 347);
this.spriteEditPanel.Name = "spriteEditPanel";
this.spriteEditPanel.Size = new System.Drawing.Size(191, 180);
this.spriteEditPanel.TabIndex = 9;
//
// editingOriginCheckBox
// originEditPanel
//
this.editingOriginCheckBox.AutoSize = true;
this.editingOriginCheckBox.Location = new System.Drawing.Point(9, 103);
this.editingOriginCheckBox.Name = "editingOriginCheckBox";
this.editingOriginCheckBox.Size = new System.Drawing.Size(107, 17);
this.editingOriginCheckBox.TabIndex = 23;
this.editingOriginCheckBox.Text = "Edit Origin Point?";
this.editingOriginCheckBox.UseVisualStyleBackColor = true;
this.editingOriginCheckBox.CheckedChanged += new System.EventHandler(this.editingOriginCheckBox_CheckedChanged);
this.originEditPanel.Controls.Add(this.originPresetLabel);
this.originEditPanel.Controls.Add(this.originPresetBox);
this.originEditPanel.Controls.Add(this.originXPosLabel);
this.originEditPanel.Controls.Add(this.originYPosLabel);
this.originEditPanel.Controls.Add(this.originYPosBox);
this.originEditPanel.Controls.Add(this.originXPosBox);
this.originEditPanel.Enabled = false;
this.originEditPanel.Location = new System.Drawing.Point(0, 123);
this.originEditPanel.Name = "originEditPanel";
this.originEditPanel.Size = new System.Drawing.Size(191, 54);
this.originEditPanel.TabIndex = 18;
//
// originPresetLabel
//
this.originPresetLabel.AutoSize = true;
this.originPresetLabel.Location = new System.Drawing.Point(6, 33);
this.originPresetLabel.Name = "originPresetLabel";
this.originPresetLabel.Size = new System.Drawing.Size(70, 13);
this.originPresetLabel.TabIndex = 25;
this.originPresetLabel.Text = "Origin Preset:";
//
// originPresetBox
//
this.originPresetBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.originPresetBox.FormattingEnabled = true;
this.originPresetBox.Location = new System.Drawing.Point(78, 30);
this.originPresetBox.Name = "originPresetBox";
this.originPresetBox.Size = new System.Drawing.Size(110, 21);
this.originPresetBox.TabIndex = 24;
this.originPresetBox.SelectedIndexChanged += new System.EventHandler(this.originPresetBox_SelectedIndexChanged);
//
// originXPosLabel
//
this.originXPosLabel.AutoSize = true;
this.originXPosLabel.Location = new System.Drawing.Point(6, 7);
this.originXPosLabel.Name = "originXPosLabel";
this.originXPosLabel.Size = new System.Drawing.Size(44, 13);
this.originXPosLabel.TabIndex = 19;
this.originXPosLabel.Text = "Origin X";
//
// originYPosLabel
//
this.originYPosLabel.AutoSize = true;
this.originYPosLabel.Location = new System.Drawing.Point(98, 7);
this.originYPosLabel.Name = "originYPosLabel";
this.originYPosLabel.Size = new System.Drawing.Size(44, 13);
this.originYPosLabel.TabIndex = 20;
this.originYPosLabel.Text = "Origin Y";
//
// originYPosBox
//
@@ -247,23 +293,16 @@
this.originXPosBox.TabIndex = 21;
this.originXPosBox.ValueChanged += new System.EventHandler(this.originXPosBox_ValueChanged);
//
// originYPosLabel
// editingOriginCheckBox
//
this.originYPosLabel.AutoSize = true;
this.originYPosLabel.Location = new System.Drawing.Point(98, 7);
this.originYPosLabel.Name = "originYPosLabel";
this.originYPosLabel.Size = new System.Drawing.Size(44, 13);
this.originYPosLabel.TabIndex = 20;
this.originYPosLabel.Text = "Origin Y";
//
// originXPosLabel
//
this.originXPosLabel.AutoSize = true;
this.originXPosLabel.Location = new System.Drawing.Point(6, 7);
this.originXPosLabel.Name = "originXPosLabel";
this.originXPosLabel.Size = new System.Drawing.Size(44, 13);
this.originXPosLabel.TabIndex = 19;
this.originXPosLabel.Text = "Origin X";
this.editingOriginCheckBox.AutoSize = true;
this.editingOriginCheckBox.Location = new System.Drawing.Point(9, 103);
this.editingOriginCheckBox.Name = "editingOriginCheckBox";
this.editingOriginCheckBox.Size = new System.Drawing.Size(107, 17);
this.editingOriginCheckBox.TabIndex = 23;
this.editingOriginCheckBox.Text = "Edit Origin Point?";
this.editingOriginCheckBox.UseVisualStyleBackColor = true;
this.editingOriginCheckBox.CheckedChanged += new System.EventHandler(this.editingOriginCheckBox_CheckedChanged);
//
// spriteHeightBox
//
@@ -383,19 +422,23 @@
//
// loadSpriteSheetDialog
//
this.loadSpriteSheetDialog.FileName = "openFileDialog1";
this.loadSpriteSheetDialog.FileName = " ";
this.loadSpriteSheetDialog.Filter = "PNG files|*.png";
this.loadSpriteSheetDialog.Title = "Import Sprite Sheet Image";
//
// loadMapDialog
//
this.loadMapDialog.DefaultExt = "smap";
this.loadMapDialog.FileName = "openFileDialog1";
this.loadMapDialog.FileName = " ";
this.loadMapDialog.Filter = "QUROGame SpriteMap|*.smap";
this.loadMapDialog.Title = "Import Sprite Map";
//
// saveMapDialog
//
this.saveMapDialog.DefaultExt = "smap";
this.saveMapDialog.FileName = " ";
this.saveMapDialog.Filter = "QUROGame SpriteMap|*.smap";
this.saveMapDialog.Title = "Export Sprite Map";
//
// spriteViewerPanel
//
@@ -409,7 +452,7 @@
this.spriteViewerPanel.Enabled = false;
this.spriteViewerPanel.Location = new System.Drawing.Point(198, 59);
this.spriteViewerPanel.Name = "spriteViewerPanel";
this.spriteViewerPanel.Size = new System.Drawing.Size(599, 362);
this.spriteViewerPanel.Size = new System.Drawing.Size(599, 468);
this.spriteViewerPanel.TabIndex = 14;
this.spriteViewerPanel.Scroll += new System.Windows.Forms.ScrollEventHandler(this.spriteViewerPanel_Scroll);
//
@@ -459,50 +502,74 @@
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.loadSpriteSheetToolStripMenuItem,
this.loadSpriteMapToolStripMenuItem,
this.newProjectToolStripMenuItem,
this.openProjectToolStripMenuItem,
this.toolStripMenuItem1,
this.saveSpriteMapToolStripMenuItem,
this.saveSpriteMapAsToolStripMenuItem});
this.saveProjectToolStripMenuItem,
this.saveProjectAsToolStripMenuItem,
this.toolStripMenuItem2,
this.importSpriteSheetToolStripMenuItem,
this.importSpriteMapToolStripMenuItem,
this.exportSpriteMapToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// loadSpriteSheetToolStripMenuItem
// newProjectToolStripMenuItem
//
this.loadSpriteSheetToolStripMenuItem.Name = "loadSpriteSheetToolStripMenuItem";
this.loadSpriteSheetToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
this.loadSpriteSheetToolStripMenuItem.Text = "Load Sprite Sheet...";
this.loadSpriteSheetToolStripMenuItem.Click += new System.EventHandler(this.loadSpriteSheetToolStripMenuItem_Click);
this.newProjectToolStripMenuItem.Name = "newProjectToolStripMenuItem";
this.newProjectToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.newProjectToolStripMenuItem.Text = "New Project...";
this.newProjectToolStripMenuItem.Click += new System.EventHandler(this.newProjectMenuItem_Click);
//
// loadSpriteMapToolStripMenuItem
// openProjectToolStripMenuItem
//
this.loadSpriteMapToolStripMenuItem.Enabled = false;
this.loadSpriteMapToolStripMenuItem.Name = "loadSpriteMapToolStripMenuItem";
this.loadSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
this.loadSpriteMapToolStripMenuItem.Text = "Load Sprite Map...";
this.loadSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.loadMapToolStripMenuItem_Click);
this.openProjectToolStripMenuItem.Name = "openProjectToolStripMenuItem";
this.openProjectToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.openProjectToolStripMenuItem.Text = "Open Project...";
this.openProjectToolStripMenuItem.Click += new System.EventHandler(this.openProjectToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(181, 6);
//
// saveSpriteMapToolStripMenuItem
// saveProjectToolStripMenuItem
//
this.saveSpriteMapToolStripMenuItem.Enabled = false;
this.saveSpriteMapToolStripMenuItem.Name = "saveSpriteMapToolStripMenuItem";
this.saveSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
this.saveSpriteMapToolStripMenuItem.Text = "Save Sprite Map";
this.saveSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.saveSpriteMapToolStripMenuItem_Click);
this.saveProjectToolStripMenuItem.Enabled = false;
this.saveProjectToolStripMenuItem.Name = "saveProjectToolStripMenuItem";
this.saveProjectToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.saveProjectToolStripMenuItem.Text = "Save Project";
this.saveProjectToolStripMenuItem.Click += new System.EventHandler(this.saveProjectToolStripMenuItem_Click);
//
// saveSpriteMapAsToolStripMenuItem
// saveProjectAsToolStripMenuItem
//
this.saveSpriteMapAsToolStripMenuItem.Enabled = false;
this.saveSpriteMapAsToolStripMenuItem.Name = "saveSpriteMapAsToolStripMenuItem";
this.saveSpriteMapAsToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
this.saveSpriteMapAsToolStripMenuItem.Text = "Save Sprite Map As...";
this.saveSpriteMapAsToolStripMenuItem.Click += new System.EventHandler(this.saveMapAsToolStripMenuItem_Click);
this.saveProjectAsToolStripMenuItem.Enabled = false;
this.saveProjectAsToolStripMenuItem.Name = "saveProjectAsToolStripMenuItem";
this.saveProjectAsToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.saveProjectAsToolStripMenuItem.Text = "Save Project As...";
this.saveProjectAsToolStripMenuItem.Click += new System.EventHandler(this.saveProjectAsToolStripMenuItem_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(181, 6);
//
// importSpriteMapToolStripMenuItem
//
this.importSpriteMapToolStripMenuItem.Enabled = false;
this.importSpriteMapToolStripMenuItem.Name = "importSpriteMapToolStripMenuItem";
this.importSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.importSpriteMapToolStripMenuItem.Text = "Import Sprite Map...";
this.importSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.importMapToolStripMenuItem_Click);
//
// exportSpriteMapToolStripMenuItem
//
this.exportSpriteMapToolStripMenuItem.Enabled = false;
this.exportSpriteMapToolStripMenuItem.Name = "exportSpriteMapToolStripMenuItem";
this.exportSpriteMapToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.exportSpriteMapToolStripMenuItem.Text = "Export Sprite Map...";
this.exportSpriteMapToolStripMenuItem.Click += new System.EventHandler(this.exportMapToolStripMenuItem_Click);
//
// editToolStripMenuItem
//
@@ -547,39 +614,6 @@
this.outlineTimer.Interval = 66;
this.outlineTimer.Tick += new System.EventHandler(this.outlineTimer_Tick);
//
// originPresetBox
//
this.originPresetBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.originPresetBox.FormattingEnabled = true;
this.originPresetBox.Location = new System.Drawing.Point(78, 30);
this.originPresetBox.Name = "originPresetBox";
this.originPresetBox.Size = new System.Drawing.Size(110, 21);
this.originPresetBox.TabIndex = 24;
this.originPresetBox.SelectedIndexChanged += new System.EventHandler(this.originPresetBox_SelectedIndexChanged);
//
// originPresetLabel
//
this.originPresetLabel.AutoSize = true;
this.originPresetLabel.Location = new System.Drawing.Point(6, 33);
this.originPresetLabel.Name = "originPresetLabel";
this.originPresetLabel.Size = new System.Drawing.Size(70, 13);
this.originPresetLabel.TabIndex = 25;
this.originPresetLabel.Text = "Origin Preset:";
//
// originEditPanel
//
this.originEditPanel.Controls.Add(this.originPresetLabel);
this.originEditPanel.Controls.Add(this.originPresetBox);
this.originEditPanel.Controls.Add(this.originXPosLabel);
this.originEditPanel.Controls.Add(this.originYPosLabel);
this.originEditPanel.Controls.Add(this.originYPosBox);
this.originEditPanel.Controls.Add(this.originXPosBox);
this.originEditPanel.Enabled = false;
this.originEditPanel.Location = new System.Drawing.Point(0, 123);
this.originEditPanel.Name = "originEditPanel";
this.originEditPanel.Size = new System.Drawing.Size(191, 54);
this.originEditPanel.TabIndex = 18;
//
// viewEditPanel
//
this.viewEditPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -593,6 +627,27 @@
this.viewEditPanel.Size = new System.Drawing.Size(246, 29);
this.viewEditPanel.TabIndex = 18;
//
// saveProjectDialog
//
this.saveProjectDialog.DefaultExt = "smappr";
this.saveProjectDialog.FileName = " ";
this.saveProjectDialog.Filter = "QUROGames Sprite Map Editor Project|*.smappr";
this.saveProjectDialog.Title = "Save Project As";
//
// openProjectDialog
//
this.openProjectDialog.DefaultExt = "smappr";
this.openProjectDialog.FileName = " ";
this.openProjectDialog.Filter = "QUROGames Sprite Map Editor Project|*.smappr";
this.openProjectDialog.Title = "Open Project";
//
// importSpriteSheetToolStripMenuItem
//
this.importSpriteSheetToolStripMenuItem.Name = "importSpriteSheetToolStripMenuItem";
this.importSpriteSheetToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.importSpriteSheetToolStripMenuItem.Text = "Import Sprite Sheet...";
this.importSpriteSheetToolStripMenuItem.Click += new System.EventHandler(this.importSpriteSheetToolStripMenuItem_Click);
//
// spriteSheetViewer
//
this.spriteSheetViewer.BackgroundImage = global::SpriteMapEditor.Properties.Resources.transparentUI;
@@ -615,7 +670,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(800, 424);
this.ClientSize = new System.Drawing.Size(800, 530);
this.Controls.Add(this.viewEditPanel);
this.Controls.Add(this.spriteViewerPanel);
this.Controls.Add(this.spriteEditPanel);
@@ -631,6 +686,8 @@
this.spriteListEditPanel.PerformLayout();
this.spriteEditPanel.ResumeLayout(false);
this.spriteEditPanel.PerformLayout();
this.originEditPanel.ResumeLayout(false);
this.originEditPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.originYPosBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.originXPosBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spriteHeightBox)).EndInit();
@@ -640,8 +697,6 @@
this.spriteViewerPanel.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.originEditPanel.ResumeLayout(false);
this.originEditPanel.PerformLayout();
this.viewEditPanel.ResumeLayout(false);
this.viewEditPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.spriteSheetViewer)).EndInit();
@@ -685,11 +740,10 @@
private System.Windows.Forms.Button moveUpButton;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadSpriteSheetToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadSpriteMapToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem newProjectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem importSpriteMapToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem saveSpriteMapToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveSpriteMapAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSpriteMapToolStripMenuItem;
private System.Windows.Forms.CheckBox editingOriginCheckBox;
private System.Windows.Forms.CheckBox highlightCheckBox;
private System.Windows.Forms.Timer outlineTimer;
@@ -700,6 +754,13 @@
private System.Windows.Forms.ComboBox originPresetBox;
private System.Windows.Forms.Panel originEditPanel;
private System.Windows.Forms.Panel viewEditPanel;
private System.Windows.Forms.ToolStripMenuItem saveProjectAsToolStripMenuItem;
private System.Windows.Forms.SaveFileDialog saveProjectDialog;
private System.Windows.Forms.ToolStripMenuItem openProjectToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog openProjectDialog;
private System.Windows.Forms.ToolStripMenuItem saveProjectToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem importSpriteSheetToolStripMenuItem;
}
}
+155 -59
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -33,14 +34,37 @@ namespace SpriteMapEditor
private bool editingOrigin = false;
const string TITLE = "QUROGames Sprite Map Editor";
private string currentSpriteMapFileLocation;
private string _currentSpriteMapFileLocation;
private string CurrentSpriteMapFileLocation
{
get { return currentSpriteMapFileLocation; }
get { return _currentSpriteMapFileLocation; }
set
{
currentSpriteMapFileLocation = value;
Text = TITLE + " - " + Path.GetFileName(currentSpriteMapFileLocation);
_currentSpriteMapFileLocation = value;
loadMapDialog.FileName = _currentSpriteMapFileLocation;
saveMapDialog.FileName = _currentSpriteMapFileLocation;
}
}
private string _currentSpriteSheetFileLocation;
private string CurrentSpriteSheetFileLocation
{
get { return _currentSpriteSheetFileLocation; }
set
{
_currentSpriteSheetFileLocation = value;
loadSpriteSheetDialog.FileName = _currentSpriteSheetFileLocation;
}
}
private string _currentProjectFileLocation;
private string CurrentProjectFileLocation
{
get { return _currentProjectFileLocation; }
set
{
_currentProjectFileLocation = value;
Text = TITLE + " - " + Path.GetFileName(_currentProjectFileLocation);
openProjectDialog.FileName = _currentProjectFileLocation;
saveProjectDialog.FileName = _currentProjectFileLocation;
}
}
@@ -76,7 +100,7 @@ namespace SpriteMapEditor
InitializeComponent();
FormBorderStyle = FormBorderStyle.Sizable;
undoHistory = new SpriteMapModifications.History();
undoHistory = new History();
originPresetBox.DataSource = Enum.GetValues(typeof(OriginPreset));
@@ -102,21 +126,108 @@ namespace SpriteMapEditor
LoadSpriteEditorValues();
}
private void loadSpriteSheetToolStripMenuItem_Click(object sender, EventArgs e)
private void newProjectMenuItem_Click(object sender, EventArgs e)
{
CurrentProjectFileLocation = null;
CurrentSpriteMapFileLocation = null;
CurrentSpriteSheetFileLocation = null;
sprites = new BindingList<SpriteMapRegion>() { new SpriteMapRegion() };
LoadSpriteSheet();
if (spriteSheet == null)
return;
spriteList.DataSource = sprites;
}
private void LoadSpriteSheet()
{
if (loadSpriteSheetDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
spriteSheet = Image.FromFile(loadSpriteSheetDialog.FileName);
CurrentSpriteSheetFileLocation = loadSpriteSheetDialog.FileName;
spriteSheet = Image.FromFile(CurrentSpriteSheetFileLocation);
spriteSheetViewer.Image = spriteSheet;
if (spriteSheet == null)
return;
importSpriteSheetToolStripMenuItem.Text = "Replace Sprite Sheet...";
InitializeMask();
EnableEditing();
}
}
private void LoadSpriteMap()
{
if (loadMapDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CurrentSpriteMapFileLocation = loadMapDialog.FileName;
Dictionary<string, SpriteMapRegion> loadedSpriteMap;
using (XmlReader xmlRead = XmlReader.Create(CurrentSpriteMapFileLocation))
{
loadedSpriteMap = IntermediateSerializer.Deserialize<Dictionary<string, SpriteMapRegion>>(xmlRead, null);
}
sprites = new BindingList<SpriteMapRegion>();
foreach (KeyValuePair<string, SpriteMapRegion> sprite in loadedSpriteMap)
{
sprites.Add(sprite.Value);
}
spriteList.DataSource = sprites;
}
}
private void SaveProject()
{
if (CurrentProjectFileLocation != null)
{
SpriteMapProject project = new SpriteMapProject(CurrentSpriteSheetFileLocation, sprites.ToList());
using (XmlWriter writer = XmlWriter.Create(CurrentProjectFileLocation))
{
IntermediateSerializer.Serialize(writer, project, null);
}
}
}
private void LoadProject()
{
SpriteMapProject loadedProject;
using (XmlReader xmlRead = XmlReader.Create(CurrentProjectFileLocation))
{
loadedProject = IntermediateSerializer.Deserialize<SpriteMapProject>(xmlRead, null);
}
if (File.Exists(loadedProject.SpriteSheetFileLocation))
{
CurrentSpriteSheetFileLocation = loadedProject.SpriteSheetFileLocation;
spriteSheet = Image.FromFile(loadedProject.SpriteSheetFileLocation);
spriteSheetViewer.Image = spriteSheet;
InitializeMask();
EnableEditing();
}
else
{
MessageBox.Show("Image referenced by project not found!\nPlease locate a new Sprite Sheet image...");
LoadSpriteSheet();
}
if (spriteSheet == null)
return;
importSpriteSheetToolStripMenuItem.Text = "Replace Sprite Sheet...";
sprites = new BindingList<SpriteMapRegion>(loadedProject.SpriteMap);
spriteList.DataSource = sprites;
saveProjectToolStripMenuItem.Enabled = true;
}
private void EnableEditing()
{
loadSpriteMapToolStripMenuItem.Enabled = true;
saveSpriteMapAsToolStripMenuItem.Enabled = true;
importSpriteMapToolStripMenuItem.Enabled = true;
exportSpriteMapToolStripMenuItem.Enabled = true;
saveProjectAsToolStripMenuItem.Enabled = true;
spriteListEditPanel.Enabled = true;
spriteEditPanel.Enabled = true;
viewEditPanel.Enabled = true;
@@ -425,7 +536,7 @@ namespace SpriteMapEditor
bottomMost.Y + bottomMost.Height - topMost.Y);
}
private void saveMapAsToolStripMenuItem_Click(object sender, EventArgs e)
private void exportMapToolStripMenuItem_Click(object sender, EventArgs e)
{
var exportDict = new Dictionary<string, SpriteMapRegion>();
foreach (SpriteMapRegion sprite in sprites)
@@ -451,58 +562,11 @@ namespace SpriteMapEditor
IntermediateSerializer.Serialize(writer, exportDict, null);
}
}
saveSpriteMapToolStripMenuItem.Enabled = true;
}
private void saveSpriteMapToolStripMenuItem_Click(object sender, EventArgs e)
private void importMapToolStripMenuItem_Click(object sender, EventArgs e)
{
if (CurrentSpriteMapFileLocation != null)
{
var exportDict = new Dictionary<string, SpriteMapRegion>();
foreach (SpriteMapRegion sprite in sprites)
{
if (exportDict.ContainsKey(sprite.Name))
{
string errorMessage = "Duplicate names found! Please ensure all sprites have unique names.";
string caption = "Save Aborted";
MessageBoxButtons saveError = MessageBoxButtons.OK;
MessageBox.Show(errorMessage, caption, saveError);
return;
}
exportDict.Add(sprite.Name, sprite);
}
using (XmlWriter writer = XmlWriter.Create(CurrentSpriteMapFileLocation))
{
IntermediateSerializer.Serialize(writer, exportDict, null);
}
}
}
private void loadMapToolStripMenuItem_Click(object sender, EventArgs e)
{
if(loadMapDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CurrentSpriteMapFileLocation = loadMapDialog.FileName;
Dictionary<string, SpriteMapRegion> loadedSpriteMap;
using (XmlReader xmlRead = XmlReader.Create(CurrentSpriteMapFileLocation))
{
loadedSpriteMap = IntermediateSerializer.Deserialize<Dictionary<string, SpriteMapRegion>>(xmlRead, null);
}
sprites = new BindingList<SpriteMapRegion>();
foreach(KeyValuePair<string, SpriteMapRegion> sprite in loadedSpriteMap)
{
sprites.Add(sprite.Value);
}
spriteList.DataSource = sprites;
saveSpriteMapToolStripMenuItem.Enabled = true;
}
LoadSpriteMap();
}
private void spriteSheetViewer_MouseMove(object sender, MouseEventArgs e)
@@ -747,5 +811,37 @@ namespace SpriteMapEditor
undoHistory.Add(modification);
spriteSheetViewer.Refresh();
}
private void saveProjectAsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveProjectDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CurrentProjectFileLocation = saveProjectDialog.FileName;
SaveProject();
}
saveProjectToolStripMenuItem.Enabled = true;
}
private void openProjectToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openProjectDialog.ShowDialog() == DialogResult.OK)
{
CurrentProjectFileLocation = openProjectDialog.FileName;
LoadProject();
}
}
private void saveProjectToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveProject();
}
private void importSpriteSheetToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadSpriteSheet();
}
}
}
+6
View File
@@ -132,4 +132,10 @@
<metadata name="outlineTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>576, 17</value>
</metadata>
<metadata name="saveProjectDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>696, 17</value>
</metadata>
<metadata name="openProjectDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>845, 17</value>
</metadata>
</root>
+8 -1
View File
@@ -6,11 +6,18 @@ namespace SpriteMapEditor
{
public class SpriteMapProject
{
public Image SpriteSheet { get; set; }
public string SpriteSheetFileLocation { get; set; }
public List<SpriteMapRegion> SpriteMap { get; set; }
public SpriteMapProject()
{
}
public SpriteMapProject(string spriteSheetLocation, List<SpriteMapRegion> spriteMap)
{
SpriteSheetFileLocation = spriteSheetLocation;
SpriteMap = spriteMap;
}
}
}