SpriteMapping tool added

Created first implementation of a spritemap making app!
This commit is contained in:
quinnvoker
2018-11-22 12:56:07 -08:00
parent 9a25f068fc
commit 46959bde2e
16 changed files with 1402 additions and 0 deletions
+6
View File
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationGenerator", "Anima
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO", "QURO\QURO.csproj", "{4581E0C8-B14A-454D-9A7B-52D37535E7E9}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO", "QURO\QURO.csproj", "{4581E0C8-B14A-454D-9A7B-52D37535E7E9}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpriteMapEditor", "SpriteMapEditor\SpriteMapEditor.csproj", "{2AF6999F-93F0-4096-9BC1-863CEE5E7791}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Debug|Any CPU.Build.0 = Debug|Any CPU {4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Release|Any CPU.Build.0 = Release|Any CPU {4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Release|Any CPU.Build.0 = Release|Any CPU
{2AF6999F-93F0-4096-9BC1-863CEE5E7791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2AF6999F-93F0-4096-9BC1-863CEE5E7791}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AF6999F-93F0-4096-9BC1-863CEE5E7791}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AF6999F-93F0-4096-9BC1-863CEE5E7791}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
+442
View File
@@ -0,0 +1,442 @@
namespace SpriteMapEditor
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.spriteList = new System.Windows.Forms.ListBox();
this.addSpriteButton = new System.Windows.Forms.Button();
this.removeSpriteButton = new System.Windows.Forms.Button();
this.loadSpriteSheetButton = new System.Windows.Forms.Button();
this.loadMapButton = new System.Windows.Forms.Button();
this.saveMapButton = new System.Windows.Forms.Button();
this.filePanel = new System.Windows.Forms.Panel();
this.spriteListPanel = new System.Windows.Forms.Panel();
this.spritesLabel = new System.Windows.Forms.Label();
this.spritePanel = new System.Windows.Forms.Panel();
this.spriteHeightBox = new System.Windows.Forms.NumericUpDown();
this.spriteWidthBox = new System.Windows.Forms.NumericUpDown();
this.spriteYPosBox = new System.Windows.Forms.NumericUpDown();
this.spriteXPosBox = new System.Windows.Forms.NumericUpDown();
this.heightLabel = new System.Windows.Forms.Label();
this.widthLabel = new System.Windows.Forms.Label();
this.yPosLabel = new System.Windows.Forms.Label();
this.xPosLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.spriteSettingsLabel = new System.Windows.Forms.Label();
this.spriteNameBox = new System.Windows.Forms.TextBox();
this.loadSpriteSheetDialogue = new System.Windows.Forms.OpenFileDialog();
this.loadMapDialogue = new System.Windows.Forms.OpenFileDialog();
this.saveMapDialogue = new System.Windows.Forms.SaveFileDialog();
this.fillButton = new System.Windows.Forms.Button();
this.spriteViewerPanel = new System.Windows.Forms.Panel();
this.zoomInButton = new System.Windows.Forms.Button();
this.zoomOutButton = new System.Windows.Forms.Button();
this.spriteSheetViewer = new SpriteMapEditor.PictureBoxWithInterpolationMode();
this.filePanel.SuspendLayout();
this.spriteListPanel.SuspendLayout();
this.spritePanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spriteHeightBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spriteWidthBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spriteYPosBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).BeginInit();
this.spriteViewerPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spriteSheetViewer)).BeginInit();
this.SuspendLayout();
//
// spriteList
//
this.spriteList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.spriteList.FormattingEnabled = true;
this.spriteList.Location = new System.Drawing.Point(3, 32);
this.spriteList.Name = "spriteList";
this.spriteList.Size = new System.Drawing.Size(185, 251);
this.spriteList.TabIndex = 0;
this.spriteList.SelectedValueChanged += new System.EventHandler(this.spriteList_SelectedValueChanged);
//
// addSpriteButton
//
this.addSpriteButton.Location = new System.Drawing.Point(126, 3);
this.addSpriteButton.Name = "addSpriteButton";
this.addSpriteButton.Size = new System.Drawing.Size(27, 23);
this.addSpriteButton.TabIndex = 2;
this.addSpriteButton.Text = "+";
this.addSpriteButton.UseVisualStyleBackColor = true;
this.addSpriteButton.Click += new System.EventHandler(this.addSpriteButton_Click);
//
// removeSpriteButton
//
this.removeSpriteButton.Location = new System.Drawing.Point(159, 3);
this.removeSpriteButton.Name = "removeSpriteButton";
this.removeSpriteButton.Size = new System.Drawing.Size(28, 23);
this.removeSpriteButton.TabIndex = 3;
this.removeSpriteButton.Text = "-";
this.removeSpriteButton.UseVisualStyleBackColor = true;
this.removeSpriteButton.Click += new System.EventHandler(this.removeSpriteButton_Click);
//
// loadSpriteSheetButton
//
this.loadSpriteSheetButton.Location = new System.Drawing.Point(3, 3);
this.loadSpriteSheetButton.Name = "loadSpriteSheetButton";
this.loadSpriteSheetButton.Size = new System.Drawing.Size(185, 23);
this.loadSpriteSheetButton.TabIndex = 4;
this.loadSpriteSheetButton.Text = "Load Sprite Sheet...";
this.loadSpriteSheetButton.UseVisualStyleBackColor = true;
this.loadSpriteSheetButton.Click += new System.EventHandler(this.loadSpriteSheetButton_Click);
//
// loadMapButton
//
this.loadMapButton.Location = new System.Drawing.Point(3, 32);
this.loadMapButton.Name = "loadMapButton";
this.loadMapButton.Size = new System.Drawing.Size(92, 23);
this.loadMapButton.TabIndex = 5;
this.loadMapButton.Text = "Load Map...";
this.loadMapButton.UseVisualStyleBackColor = true;
this.loadMapButton.Click += new System.EventHandler(this.loadMapButton_Click);
//
// saveMapButton
//
this.saveMapButton.Location = new System.Drawing.Point(96, 32);
this.saveMapButton.Name = "saveMapButton";
this.saveMapButton.Size = new System.Drawing.Size(92, 23);
this.saveMapButton.TabIndex = 6;
this.saveMapButton.Text = "Save Map As...";
this.saveMapButton.UseVisualStyleBackColor = true;
this.saveMapButton.Click += new System.EventHandler(this.saveMapButton_Click);
//
// filePanel
//
this.filePanel.Controls.Add(this.loadSpriteSheetButton);
this.filePanel.Controls.Add(this.saveMapButton);
this.filePanel.Controls.Add(this.loadMapButton);
this.filePanel.Location = new System.Drawing.Point(2, 2);
this.filePanel.Name = "filePanel";
this.filePanel.Size = new System.Drawing.Size(191, 62);
this.filePanel.TabIndex = 7;
//
// spriteListPanel
//
this.spriteListPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.spriteListPanel.AutoSize = true;
this.spriteListPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.spriteListPanel.Controls.Add(this.spritesLabel);
this.spriteListPanel.Controls.Add(this.spriteList);
this.spriteListPanel.Controls.Add(this.addSpriteButton);
this.spriteListPanel.Controls.Add(this.removeSpriteButton);
this.spriteListPanel.Location = new System.Drawing.Point(2, 63);
this.spriteListPanel.Name = "spriteListPanel";
this.spriteListPanel.Size = new System.Drawing.Size(191, 286);
this.spriteListPanel.TabIndex = 8;
//
// spritesLabel
//
this.spritesLabel.AutoSize = true;
this.spritesLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
this.spritesLabel.Location = new System.Drawing.Point(3, 8);
this.spritesLabel.Name = "spritesLabel";
this.spritesLabel.Size = new System.Drawing.Size(46, 13);
this.spritesLabel.TabIndex = 4;
this.spritesLabel.Text = "Sprites";
//
// spritePanel
//
this.spritePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.spritePanel.Controls.Add(this.spriteHeightBox);
this.spritePanel.Controls.Add(this.spriteWidthBox);
this.spritePanel.Controls.Add(this.spriteYPosBox);
this.spritePanel.Controls.Add(this.spriteXPosBox);
this.spritePanel.Controls.Add(this.heightLabel);
this.spritePanel.Controls.Add(this.widthLabel);
this.spritePanel.Controls.Add(this.yPosLabel);
this.spritePanel.Controls.Add(this.xPosLabel);
this.spritePanel.Controls.Add(this.label2);
this.spritePanel.Controls.Add(this.spriteSettingsLabel);
this.spritePanel.Controls.Add(this.spriteNameBox);
this.spritePanel.Location = new System.Drawing.Point(2, 353);
this.spritePanel.Name = "spritePanel";
this.spritePanel.Size = new System.Drawing.Size(191, 110);
this.spritePanel.TabIndex = 9;
//
// spriteHeightBox
//
this.spriteHeightBox.Location = new System.Drawing.Point(136, 82);
this.spriteHeightBox.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.spriteHeightBox.Name = "spriteHeightBox";
this.spriteHeightBox.Size = new System.Drawing.Size(52, 20);
this.spriteHeightBox.TabIndex = 18;
this.spriteHeightBox.ValueChanged += new System.EventHandler(this.spriteHeightBox_ValueChanged);
//
// spriteWidthBox
//
this.spriteWidthBox.Location = new System.Drawing.Point(44, 82);
this.spriteWidthBox.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.spriteWidthBox.Name = "spriteWidthBox";
this.spriteWidthBox.Size = new System.Drawing.Size(52, 20);
this.spriteWidthBox.TabIndex = 17;
this.spriteWidthBox.ValueChanged += new System.EventHandler(this.spriteWidthBox_ValueChanged);
//
// spriteYPosBox
//
this.spriteYPosBox.Location = new System.Drawing.Point(136, 56);
this.spriteYPosBox.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.spriteYPosBox.Name = "spriteYPosBox";
this.spriteYPosBox.Size = new System.Drawing.Size(52, 20);
this.spriteYPosBox.TabIndex = 16;
this.spriteYPosBox.ValueChanged += new System.EventHandler(this.spriteYPosBox_ValueChanged);
//
// spriteXPosBox
//
this.spriteXPosBox.Location = new System.Drawing.Point(44, 56);
this.spriteXPosBox.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.spriteXPosBox.Name = "spriteXPosBox";
this.spriteXPosBox.Size = new System.Drawing.Size(52, 20);
this.spriteXPosBox.TabIndex = 15;
this.spriteXPosBox.ValueChanged += new System.EventHandler(this.spriteXPosBox_ValueChanged);
//
// heightLabel
//
this.heightLabel.AutoSize = true;
this.heightLabel.Location = new System.Drawing.Point(98, 85);
this.heightLabel.Name = "heightLabel";
this.heightLabel.Size = new System.Drawing.Size(38, 13);
this.heightLabel.TabIndex = 14;
this.heightLabel.Text = "Height";
//
// widthLabel
//
this.widthLabel.AutoSize = true;
this.widthLabel.Location = new System.Drawing.Point(6, 85);
this.widthLabel.Name = "widthLabel";
this.widthLabel.Size = new System.Drawing.Size(35, 13);
this.widthLabel.TabIndex = 12;
this.widthLabel.Text = "Width";
//
// yPosLabel
//
this.yPosLabel.AutoSize = true;
this.yPosLabel.Location = new System.Drawing.Point(98, 59);
this.yPosLabel.Name = "yPosLabel";
this.yPosLabel.Size = new System.Drawing.Size(35, 13);
this.yPosLabel.TabIndex = 10;
this.yPosLabel.Text = "Y Pos";
//
// xPosLabel
//
this.xPosLabel.AutoSize = true;
this.xPosLabel.Location = new System.Drawing.Point(6, 59);
this.xPosLabel.Name = "xPosLabel";
this.xPosLabel.Size = new System.Drawing.Size(38, 13);
this.xPosLabel.TabIndex = 8;
this.xPosLabel.Text = "X Pos.";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(38, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Name:";
//
// spriteSettingsLabel
//
this.spriteSettingsLabel.AutoSize = true;
this.spriteSettingsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
this.spriteSettingsLabel.Location = new System.Drawing.Point(3, 8);
this.spriteSettingsLabel.Name = "spriteSettingsLabel";
this.spriteSettingsLabel.Size = new System.Drawing.Size(90, 13);
this.spriteSettingsLabel.TabIndex = 5;
this.spriteSettingsLabel.Text = "Sprite Settings";
//
// spriteNameBox
//
this.spriteNameBox.Location = new System.Drawing.Point(44, 27);
this.spriteNameBox.Name = "spriteNameBox";
this.spriteNameBox.Size = new System.Drawing.Size(144, 20);
this.spriteNameBox.TabIndex = 0;
this.spriteNameBox.TextChanged += new System.EventHandler(this.spriteNameBox_TextChanged);
//
// loadSpriteSheetDialogue
//
this.loadSpriteSheetDialogue.FileName = "openFileDialog1";
this.loadSpriteSheetDialogue.Filter = "PNG files|*.png";
//
// loadMapDialogue
//
this.loadMapDialogue.FileName = "openFileDialog1";
this.loadMapDialogue.Filter = "Xml files|*.xml";
//
// saveMapDialogue
//
this.saveMapDialogue.DefaultExt = "xml";
this.saveMapDialogue.Filter = "Xml files|*.xml";
//
// fillButton
//
this.fillButton.Location = new System.Drawing.Point(496, 5);
this.fillButton.Name = "fillButton";
this.fillButton.Size = new System.Drawing.Size(86, 23);
this.fillButton.TabIndex = 12;
this.fillButton.Text = "Highight";
this.fillButton.UseVisualStyleBackColor = true;
this.fillButton.Click += new System.EventHandler(this.highlightButton_Click);
//
// spriteViewerPanel
//
this.spriteViewerPanel.AutoScroll = true;
this.spriteViewerPanel.BackColor = System.Drawing.SystemColors.ControlDark;
this.spriteViewerPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.spriteViewerPanel.Controls.Add(this.spriteSheetViewer);
this.spriteViewerPanel.Location = new System.Drawing.Point(199, 34);
this.spriteViewerPanel.Name = "spriteViewerPanel";
this.spriteViewerPanel.Size = new System.Drawing.Size(488, 429);
this.spriteViewerPanel.TabIndex = 14;
this.spriteViewerPanel.Scroll += new System.Windows.Forms.ScrollEventHandler(this.spriteViewerPanel_Scroll);
//
// zoomInButton
//
this.zoomInButton.Location = new System.Drawing.Point(652, 5);
this.zoomInButton.Name = "zoomInButton";
this.zoomInButton.Size = new System.Drawing.Size(27, 23);
this.zoomInButton.TabIndex = 5;
this.zoomInButton.Text = "+";
this.zoomInButton.UseVisualStyleBackColor = true;
this.zoomInButton.Click += new System.EventHandler(this.zoomInButton_Click);
//
// zoomOutButton
//
this.zoomOutButton.Location = new System.Drawing.Point(618, 5);
this.zoomOutButton.Name = "zoomOutButton";
this.zoomOutButton.Size = new System.Drawing.Size(28, 23);
this.zoomOutButton.TabIndex = 6;
this.zoomOutButton.Text = "-";
this.zoomOutButton.UseVisualStyleBackColor = true;
this.zoomOutButton.Click += new System.EventHandler(this.zoomOutButton_Click);
//
// spriteSheetViewer
//
this.spriteSheetViewer.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("spriteSheetViewer.BackgroundImage")));
this.spriteSheetViewer.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
this.spriteSheetViewer.Location = new System.Drawing.Point(0, 0);
this.spriteSheetViewer.Margin = new System.Windows.Forms.Padding(0);
this.spriteSheetViewer.Name = "spriteSheetViewer";
this.spriteSheetViewer.Size = new System.Drawing.Size(147, 143);
this.spriteSheetViewer.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.spriteSheetViewer.TabIndex = 13;
this.spriteSheetViewer.TabStop = false;
this.spriteSheetViewer.Paint += new System.Windows.Forms.PaintEventHandler(this.spriteSheetViewer_Paint);
this.spriteSheetViewer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.spriteSheetViewer_MouseDown);
this.spriteSheetViewer.MouseLeave += new System.EventHandler(this.spriteSheetViewer_MouseLeave);
this.spriteSheetViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.spriteSheetViewer_MouseMove);
this.spriteSheetViewer.MouseUp += new System.Windows.Forms.MouseEventHandler(this.spriteSheetViewer_MouseUp);
//
// Form1
//
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(691, 465);
this.Controls.Add(this.zoomInButton);
this.Controls.Add(this.spriteViewerPanel);
this.Controls.Add(this.zoomOutButton);
this.Controls.Add(this.fillButton);
this.Controls.Add(this.spritePanel);
this.Controls.Add(this.spriteListPanel);
this.Controls.Add(this.filePanel);
this.Name = "Form1";
this.Text = "Sprite Map Editor";
this.filePanel.ResumeLayout(false);
this.spriteListPanel.ResumeLayout(false);
this.spriteListPanel.PerformLayout();
this.spritePanel.ResumeLayout(false);
this.spritePanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.spriteHeightBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spriteWidthBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spriteYPosBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spriteXPosBox)).EndInit();
this.spriteViewerPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.spriteSheetViewer)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListBox spriteList;
private System.Windows.Forms.Button addSpriteButton;
private System.Windows.Forms.Button removeSpriteButton;
private System.Windows.Forms.Button loadSpriteSheetButton;
private System.Windows.Forms.Button loadMapButton;
private System.Windows.Forms.Button saveMapButton;
private System.Windows.Forms.Panel filePanel;
private System.Windows.Forms.Panel spriteListPanel;
private System.Windows.Forms.Label spritesLabel;
private System.Windows.Forms.Panel spritePanel;
private System.Windows.Forms.Label spriteSettingsLabel;
private System.Windows.Forms.TextBox spriteNameBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label xPosLabel;
private System.Windows.Forms.Label heightLabel;
private System.Windows.Forms.Label widthLabel;
private System.Windows.Forms.Label yPosLabel;
private System.Windows.Forms.OpenFileDialog loadSpriteSheetDialogue;
private System.Windows.Forms.OpenFileDialog loadMapDialogue;
private System.Windows.Forms.SaveFileDialog saveMapDialogue;
private System.Windows.Forms.Button fillButton;
private PictureBoxWithInterpolationMode spriteSheetViewer;
private System.Windows.Forms.Panel spriteViewerPanel;
private System.Windows.Forms.Button zoomInButton;
private System.Windows.Forms.Button zoomOutButton;
private System.Windows.Forms.NumericUpDown spriteHeightBox;
private System.Windows.Forms.NumericUpDown spriteWidthBox;
private System.Windows.Forms.NumericUpDown spriteYPosBox;
private System.Windows.Forms.NumericUpDown spriteXPosBox;
}
}
+341
View File
@@ -0,0 +1,341 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.IO;
namespace SpriteMapEditor
{
public partial class Form1 : Form
{
private BindingList<Sprite> sprites;
private bool highlight = false;
private Sprite currentSprite;
private int zoomLevel = 3;
private bool loadingSprite = false;
private bool movingWithMouse = false;
private Point newPosition;
private Point oldPosition;
private int drawingRectangleOffset
{
get
{
if (zoomLevel > 2)
return (zoomLevel - 1) / 2;
else
return 0;
}
}
public Form1()
{
InitializeComponent();
FormBorderStyle = FormBorderStyle.FixedSingle;
spriteSheetViewer.Width = 1;
spriteSheetViewer.Height = 1;
sprites = new BindingList<Sprite> { new Sprite() };
currentSprite = sprites[0];
Console.WriteLine(currentSprite.Bounds);
spriteList.DataSource = sprites;
spriteList.DisplayMember = "Name";
spriteList.ValueMember = "Bounds";
LoadSpriteEditorValues();
Console.WriteLine(currentSprite.Bounds);
}
private void loadSpriteSheetButton_Click(object sender, EventArgs e)
{
if(loadSpriteSheetDialogue.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
spriteSheetViewer.Image = Image.FromFile(loadSpriteSheetDialogue.FileName);
}
}
private void spriteSheetViewer_Paint(object sender, PaintEventArgs e)
{
if (spriteSheetViewer.Image != null)
{
spriteSheetViewer.Width = spriteSheetViewer.Image.Width * zoomLevel;
spriteSheetViewer.Height = spriteSheetViewer.Image.Height * zoomLevel;
if (highlight)
SurroundWithTranslucentRects(GetDrawingRect(currentSprite.Bounds, false), Color.Gray, e.Graphics);
DrawHighContrastOutline(GetDrawingRect(currentSprite.Bounds), e.Graphics);
}
base.OnPaint(e);
}
private void LoadSpriteEditorValues()
{
loadingSprite = true;
spriteNameBox.Text = currentSprite.Name;
spriteXPosBox.Value = currentSprite.Bounds.X;
spriteYPosBox.Value = currentSprite.Bounds.Y;
spriteWidthBox.Value = currentSprite.Bounds.Width;
spriteHeightBox.Value = currentSprite.Bounds.Height;
loadingSprite = false;
}
private void UpdateSpriteBounds()
{
currentSprite.Bounds = new Rectangle((int)spriteXPosBox.Value, (int)spriteYPosBox.Value, (int)spriteWidthBox.Value, (int)spriteHeightBox.Value);
}
private Rectangle GetDrawingRect(Rectangle baseRect, bool outline = true)
{
var drawingRect = baseRect;
drawingRect.X = drawingRect.X * zoomLevel - (zoomLevel - 1);
drawingRect.Y = drawingRect.Y * zoomLevel - (zoomLevel - 1);
drawingRect.X += drawingRectangleOffset;
drawingRect.Y += drawingRectangleOffset;
drawingRect.Width *= zoomLevel;
drawingRect.Height *= zoomLevel;
if (outline)
{
drawingRect.X--;
drawingRect.Y--;
drawingRect.Width++;
drawingRect.Height++;
}
return drawingRect;
}
private void SurroundWithTranslucentRects(Rectangle rect, Color color, Graphics graphics)
{
Rectangle topBorder = new Rectangle(0, 0, spriteSheetViewer.Width, rect.Y);
Rectangle leftBorder = new Rectangle(0, rect.Y, rect.X, rect.Height);
Rectangle rightBorder = new Rectangle(rect.X + rect.Width, rect.Y, spriteSheetViewer.Width - rect.X + rect.Width, rect.Height);
Rectangle bottomBorder = new Rectangle(0, rect.Y + rect.Height, spriteSheetViewer.Width, spriteSheetViewer.Height - rect.Y + rect.Height);
FillTranslucentRects(new Rectangle[] { topBorder, leftBorder, rightBorder, bottomBorder }, color, graphics);
}
private void FillTranslucentRect(Rectangle rect, Color color, Graphics graphics)
{
using (Brush whiteBrush = new SolidBrush(Color.FromArgb(128, color)))
{
graphics.FillRectangle(whiteBrush, rect);
}
}
private void FillTranslucentRects(Rectangle[] rects, Color color, Graphics graphics)
{
using (Brush whiteBrush = new SolidBrush(Color.FromArgb(128, color)))
{
graphics.FillRectangles(whiteBrush, rects);
}
}
private void DrawHighContrastOutline(Rectangle rect, Graphics graphics)
{
using (Pen blackPen = new Pen(Color.Black))
{
graphics.DrawRectangle(blackPen, rect);
}
using (Pen whitePen = new Pen(Color.White))
{
whitePen.DashPattern = new float[] { 4, 4 };
graphics.DrawRectangle(whitePen, rect);
}
}
private void highlightButton_Click(object sender, EventArgs e)
{
highlight = !highlight;
if (highlight)
fillButton.Text = "No Highlight";
else
fillButton.Text = "Highlight";
spriteSheetViewer.Refresh();
}
private void zoomInButton_Click(object sender, EventArgs e)
{
zoomLevel++;
spriteSheetViewer.Refresh();
}
private void zoomOutButton_Click(object sender, EventArgs e)
{
if (zoomLevel > 1)
{
zoomLevel--;
spriteSheetViewer.Refresh();
}
}
private void spriteViewerPanel_Scroll(object sender, ScrollEventArgs e)
{
spriteSheetViewer.Refresh();
}
private void spriteXPosBox_ValueChanged(object sender, EventArgs e)
{
if (loadingSprite)
return;
UpdateSpriteBounds();
spriteSheetViewer.Refresh();
}
private void spriteYPosBox_ValueChanged(object sender, EventArgs e)
{
if (loadingSprite)
return;
UpdateSpriteBounds();
spriteSheetViewer.Refresh();
}
private void spriteWidthBox_ValueChanged(object sender, EventArgs e)
{
if (loadingSprite)
return;
UpdateSpriteBounds();
spriteSheetViewer.Refresh();
}
private void spriteHeightBox_ValueChanged(object sender, EventArgs e)
{
if (loadingSprite)
return;
UpdateSpriteBounds();
spriteSheetViewer.Refresh();
}
private void spriteNameBox_TextChanged(object sender, EventArgs e)
{
if (loadingSprite)
return;
currentSprite.Name = spriteNameBox.Text;
sprites.ResetBindings();
}
private void addSpriteButton_Click(object sender, EventArgs e)
{
sprites.Add(new Sprite(currentSprite.Name, currentSprite.Bounds));
}
private void removeSpriteButton_Click(object sender, EventArgs e)
{
if (spriteList.SelectedIndex > -1 && spriteList.SelectedIndex < sprites.Count)
sprites.RemoveAt(spriteList.SelectedIndex);
}
private void spriteList_SelectedValueChanged(object sender, EventArgs e)
{
if (spriteList.SelectedIndex > -1 && spriteList.SelectedIndex < sprites.Count)
{
currentSprite = sprites[spriteList.SelectedIndex];
LoadSpriteEditorValues();
spriteSheetViewer.Refresh();
}
}
private void saveMapButton_Click(object sender, EventArgs e)
{
if (saveMapDialogue.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
XmlSerializer mapSerializer = new XmlSerializer(typeof(List<Sprite>));
TextWriter mapWriter = new StreamWriter(saveMapDialogue.FileName);
var exportList = sprites.ToList();
mapSerializer.Serialize(mapWriter, exportList);
mapWriter.Close();
}
}
private void loadMapButton_Click(object sender, EventArgs e)
{
if(loadMapDialogue.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
XmlSerializer mapSerializer = new XmlSerializer(typeof(List<Sprite>));
TextReader mapReader = new StreamReader(loadMapDialogue.FileName);
sprites = new BindingList<Sprite>((List<Sprite>)mapSerializer.Deserialize(mapReader));
mapReader.Close();
spriteList.DataSource = sprites;
}
}
private void spriteSheetViewer_MouseMove(object sender, MouseEventArgs e)
{
if(spriteSheetViewer.Image == null)
return;
Point mousePosition = new Point(e.X, e.Y);
if (GetDrawingRect(currentSprite.Bounds).Contains(mousePosition))
{
Cursor = Cursors.SizeAll;
if (movingWithMouse)
{
newPosition = mousePosition;
newPosition.X /= zoomLevel;
newPosition.Y /= zoomLevel;
int differenceX = newPosition.X - oldPosition.X;
int differenceY = newPosition.Y - oldPosition.Y;
Console.WriteLine(differenceX + ", " + differenceY);
var newBounds = currentSprite.Bounds;
newBounds.X += differenceX;
newBounds.Y += differenceY;
currentSprite.Bounds = newBounds;
oldPosition = newPosition;
spriteSheetViewer.Refresh();
LoadSpriteEditorValues();
}
}
else
Cursor = Cursors.Default;
}
private void spriteSheetViewer_MouseDown(object sender, MouseEventArgs e)
{
if (spriteSheetViewer.Image == null)
return;
Point mousePosition = new Point(e.X, e.Y);
if (GetDrawingRect(currentSprite.Bounds).Contains(mousePosition))
{
movingWithMouse = true;
newPosition = mousePosition;
newPosition.X /= zoomLevel;
newPosition.Y /= zoomLevel;
oldPosition = newPosition;
}
}
private void spriteSheetViewer_MouseLeave(object sender, EventArgs e)
{
movingWithMouse = false;
Cursor = Cursors.Default;
}
private void spriteSheetViewer_MouseUp(object sender, MouseEventArgs e)
{
movingWithMouse = false;
}
}
}
+181
View File
@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="loadSpriteSheetDialogue.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="loadMapDialogue.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>204, 17</value>
</metadata>
<metadata name="saveMapDialogue.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>353, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="spriteSheetViewer.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
bGUAAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZE
sRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTs
AIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4
JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR
3xKxRoowlSviN+LYVA4zAwAUSWwXcFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQd
li7d1NqaQffkZKVwB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drawing.Drawing2D;
using System.Windows.Forms;
/// <summary>
/// Inherits from PictureBox; adds Interpolation Mode Setting
/// </summary>
namespace SpriteMapEditor
{
public class PictureBoxWithInterpolationMode : PictureBox
{
public InterpolationMode InterpolationMode { get; set; }
protected override void OnPaint(PaintEventArgs paintEventArgs)
{
paintEventArgs.Graphics.InterpolationMode = InterpolationMode;
base.OnPaint(paintEventArgs);
}
}
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SpriteMapEditor
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
@@ -0,0 +1,36 @@
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("SpriteMapEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SpriteMapEditor")]
[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("2af6999f-93f0-4096-9bc1-863cee5e7791")]
// 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")]
+73
View File
@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SpriteMapEditor.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SpriteMapEditor.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap transparentUI {
get {
object obj = ResourceManager.GetObject("transparentUI", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="transparentUI" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\transparentui.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
+30
View File
@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SpriteMapEditor.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+22
View File
@@ -0,0 +1,22 @@
using System.Drawing;
namespace SpriteMapEditor
{
public class Sprite
{
public string Name { get; set; }
public Rectangle Bounds { get; set; }
public Sprite()
{
Name = "unnamed";
Bounds = new Rectangle(1, 1, 8, 8);
}
public Sprite(string name, Rectangle bounds)
{
Name = name;
Bounds = bounds;
}
}
}
+92
View File
@@ -0,0 +1,92 @@
<?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>{2AF6999F-93F0-4096-9BC1-863CEE5E7791}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>SpriteMapEditor</RootNamespace>
<AssemblyName>SpriteMapEditor</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</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="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.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="PictureBoxWithInterpolationMode.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sprite.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\transparentUI.png" />
</ItemGroup>
<ItemGroup>
<Content Include="transparentUI.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB