diff --git a/PuzzSwap.sln b/PuzzSwap.sln index d5a764c..4cef469 100644 --- a/PuzzSwap.sln +++ b/PuzzSwap.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationGenerator", "Anima EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO", "QURO\QURO.csproj", "{4581E0C8-B14A-454D-9A7B-52D37535E7E9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpriteMapEditor", "SpriteMapEditor\SpriteMapEditor.csproj", "{2AF6999F-93F0-4096-9BC1-863CEE5E7791}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution 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}.Release|Any CPU.ActiveCfg = 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 GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SpriteMapEditor/App.config b/SpriteMapEditor/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/SpriteMapEditor/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SpriteMapEditor/Form1.Designer.cs b/SpriteMapEditor/Form1.Designer.cs new file mode 100644 index 0000000..1ca0cb4 --- /dev/null +++ b/SpriteMapEditor/Form1.Designer.cs @@ -0,0 +1,442 @@ +namespace SpriteMapEditor +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} + diff --git a/SpriteMapEditor/Form1.cs b/SpriteMapEditor/Form1.cs new file mode 100644 index 0000000..b4c548c --- /dev/null +++ b/SpriteMapEditor/Form1.cs @@ -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 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 { 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)); + 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)); + TextReader mapReader = new StreamReader(loadMapDialogue.FileName); + + sprites = new BindingList((List)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; + } + } +} diff --git a/SpriteMapEditor/Form1.resx b/SpriteMapEditor/Form1.resx new file mode 100644 index 0000000..5e4d66a --- /dev/null +++ b/SpriteMapEditor/Form1.resx @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 204, 17 + + + 353, 17 + + + + + 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 + + + \ No newline at end of file diff --git a/SpriteMapEditor/PictureBoxWithInterpolationMode.cs b/SpriteMapEditor/PictureBoxWithInterpolationMode.cs new file mode 100644 index 0000000..29249f7 --- /dev/null +++ b/SpriteMapEditor/PictureBoxWithInterpolationMode.cs @@ -0,0 +1,20 @@ +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +/// +/// Inherits from PictureBox; adds Interpolation Mode Setting +/// + +namespace SpriteMapEditor +{ + public class PictureBoxWithInterpolationMode : PictureBox + { + public InterpolationMode InterpolationMode { get; set; } + + protected override void OnPaint(PaintEventArgs paintEventArgs) + { + paintEventArgs.Graphics.InterpolationMode = InterpolationMode; + base.OnPaint(paintEventArgs); + } + } +} diff --git a/SpriteMapEditor/Program.cs b/SpriteMapEditor/Program.cs new file mode 100644 index 0000000..52b809f --- /dev/null +++ b/SpriteMapEditor/Program.cs @@ -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 + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/SpriteMapEditor/Properties/AssemblyInfo.cs b/SpriteMapEditor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b8f3557 --- /dev/null +++ b/SpriteMapEditor/Properties/AssemblyInfo.cs @@ -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")] diff --git a/SpriteMapEditor/Properties/Resources.Designer.cs b/SpriteMapEditor/Properties/Resources.Designer.cs new file mode 100644 index 0000000..5d6ac28 --- /dev/null +++ b/SpriteMapEditor/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace SpriteMapEditor.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap transparentUI { + get { + object obj = ResourceManager.GetObject("transparentUI", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/SpriteMapEditor/Properties/Resources.resx b/SpriteMapEditor/Properties/Resources.resx new file mode 100644 index 0000000..2b94a9d --- /dev/null +++ b/SpriteMapEditor/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\transparentui.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/SpriteMapEditor/Properties/Settings.Designer.cs b/SpriteMapEditor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..069c748 --- /dev/null +++ b/SpriteMapEditor/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/SpriteMapEditor/Properties/Settings.settings b/SpriteMapEditor/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/SpriteMapEditor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SpriteMapEditor/Resources/transparentUI.png b/SpriteMapEditor/Resources/transparentUI.png new file mode 100644 index 0000000..eb68dbf Binary files /dev/null and b/SpriteMapEditor/Resources/transparentUI.png differ diff --git a/SpriteMapEditor/Sprite.cs b/SpriteMapEditor/Sprite.cs new file mode 100644 index 0000000..c7ee740 --- /dev/null +++ b/SpriteMapEditor/Sprite.cs @@ -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; + } + } +} diff --git a/SpriteMapEditor/SpriteMapEditor.csproj b/SpriteMapEditor/SpriteMapEditor.csproj new file mode 100644 index 0000000..7452dd3 --- /dev/null +++ b/SpriteMapEditor/SpriteMapEditor.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {2AF6999F-93F0-4096-9BC1-863CEE5E7791} + WinExe + SpriteMapEditor + SpriteMapEditor + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + Component + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/SpriteMapEditor/transparentUI.png b/SpriteMapEditor/transparentUI.png new file mode 100644 index 0000000..eb68dbf Binary files /dev/null and b/SpriteMapEditor/transparentUI.png differ