summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-09-29 18:01:34 +0000
committerIan C <ianc@noddybox.co.uk>2018-09-29 18:01:34 +0000
commit8ed524392ae4b3b88ab5e9fafdce7620a0467623 (patch)
tree3e982bd04490063c3c98fb1c3cb8406030bab036
parentcd56676ac2b8757a31d01eb28b13691e350f9d8d (diff)
Initial version
-rw-r--r--MapEd.sln25
-rw-r--r--MapEd.tar.gzbin4309987 -> 0 bytes
-rw-r--r--MapEd/App.config6
-rw-r--r--MapEd/FileContents.cs19
-rw-r--r--MapEd/Form1.Designer.cs299
-rw-r--r--MapEd/Form1.cs217
-rw-r--r--MapEd/Form1.resx123
-rw-r--r--MapEd/LayoutPanel.cs18
-rw-r--r--MapEd/MapControl.Designer.cs60
-rw-r--r--MapEd/MapControl.cs837
-rw-r--r--MapEd/MapControl.resx123
-rw-r--r--MapEd/MapEd.csproj118
-rw-r--r--MapEd/NewForm.Designer.cs232
-rw-r--r--MapEd/NewForm.cs81
-rw-r--r--MapEd/NewForm.resx120
-rw-r--r--MapEd/Program.cs22
-rw-r--r--MapEd/Properties/AssemblyInfo.cs36
-rw-r--r--MapEd/Properties/Resources.Designer.cs71
-rw-r--r--MapEd/Properties/Resources.resx117
-rw-r--r--MapEd/Properties/Settings.Designer.cs30
-rw-r--r--MapEd/Properties/Settings.settings7
-rw-r--r--MapEd/TileSelector.Designer.cs63
-rw-r--r--MapEd/TileSelector.cs46
-rw-r--r--MapEd/TileSelector.resx120
-rw-r--r--MapEd/TileStrip.cs113
-rw-r--r--MapEd/packages.config4
26 files changed, 2907 insertions, 0 deletions
diff --git a/MapEd.sln b/MapEd.sln
new file mode 100644
index 0000000..4469663
--- /dev/null
+++ b/MapEd.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2026
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapEd", "MapEd\MapEd.csproj", "{C26307FC-4620-4962-9433-B527B9F5716A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C26307FC-4620-4962-9433-B527B9F5716A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C26307FC-4620-4962-9433-B527B9F5716A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C26307FC-4620-4962-9433-B527B9F5716A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C26307FC-4620-4962-9433-B527B9F5716A}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {59784048-BC25-40A4-9E53-746BDEAC5925}
+ EndGlobalSection
+EndGlobal
diff --git a/MapEd.tar.gz b/MapEd.tar.gz
deleted file mode 100644
index 70ed68f..0000000
--- a/MapEd.tar.gz
+++ /dev/null
Binary files differ
diff --git a/MapEd/App.config b/MapEd/App.config
new file mode 100644
index 0000000..fad249e
--- /dev/null
+++ b/MapEd/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+</configuration> \ No newline at end of file
diff --git a/MapEd/FileContents.cs b/MapEd/FileContents.cs
new file mode 100644
index 0000000..e9f6b9c
--- /dev/null
+++ b/MapEd/FileContents.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MapEd
+{
+ [Serializable]
+ public class FileContents
+ {
+ public string Strip;
+ public int Width;
+ public int Height;
+ public int TileSize;
+ public int[,] Map;
+ public int[,] Data;
+ }
+}
diff --git a/MapEd/Form1.Designer.cs b/MapEd/Form1.Designer.cs
new file mode 100644
index 0000000..81f3df5
--- /dev/null
+++ b/MapEd/Form1.Designer.cs
@@ -0,0 +1,299 @@
+namespace MapEd
+{
+ 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()
+ {
+ this.mainMenu = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.newMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.loadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveAsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.quitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.drawingMode = new System.Windows.Forms.ComboBox();
+ this.tileNumber = new System.Windows.Forms.NumericUpDown();
+ this.tilePreview = new System.Windows.Forms.PictureBox();
+ this.dataNumber = new System.Windows.Forms.NumericUpDown();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.tileMode = new System.Windows.Forms.RadioButton();
+ this.dataMode = new System.Windows.Forms.RadioButton();
+ this.panel = new MapEd.LayoutPanel();
+ this.map = new MapEd.MapControl();
+ this.mainMenu.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.tileNumber)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.tilePreview)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.dataNumber)).BeginInit();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // mainMenu
+ //
+ this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem});
+ this.mainMenu.Location = new System.Drawing.Point(0, 0);
+ this.mainMenu.Name = "mainMenu";
+ this.mainMenu.Size = new System.Drawing.Size(992, 24);
+ this.mainMenu.TabIndex = 0;
+ this.mainMenu.Text = "Main Menu";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.newMenuItem,
+ this.loadMenuItem,
+ this.saveAsMenuItem,
+ this.saveMenuItem,
+ this.quitMenuItem});
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem.Text = "File";
+ //
+ // newMenuItem
+ //
+ this.newMenuItem.Name = "newMenuItem";
+ this.newMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
+ this.newMenuItem.Size = new System.Drawing.Size(155, 22);
+ this.newMenuItem.Text = "New...";
+ this.newMenuItem.Click += new System.EventHandler(this.OnNew);
+ //
+ // loadMenuItem
+ //
+ this.loadMenuItem.Name = "loadMenuItem";
+ this.loadMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
+ this.loadMenuItem.Size = new System.Drawing.Size(155, 22);
+ this.loadMenuItem.Text = "Open...";
+ this.loadMenuItem.Click += new System.EventHandler(this.OnLoad);
+ //
+ // saveAsMenuItem
+ //
+ this.saveAsMenuItem.Enabled = false;
+ this.saveAsMenuItem.Name = "saveAsMenuItem";
+ this.saveAsMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12;
+ this.saveAsMenuItem.Size = new System.Drawing.Size(155, 22);
+ this.saveAsMenuItem.Text = "Save As...";
+ this.saveAsMenuItem.Click += new System.EventHandler(this.OnSaveAs);
+ //
+ // saveMenuItem
+ //
+ this.saveMenuItem.Enabled = false;
+ this.saveMenuItem.Name = "saveMenuItem";
+ this.saveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
+ this.saveMenuItem.Size = new System.Drawing.Size(155, 22);
+ this.saveMenuItem.Text = "Save";
+ this.saveMenuItem.Click += new System.EventHandler(this.OnSave);
+ //
+ // quitMenuItem
+ //
+ this.quitMenuItem.Name = "quitMenuItem";
+ this.quitMenuItem.Size = new System.Drawing.Size(155, 22);
+ this.quitMenuItem.Text = "Quit";
+ this.quitMenuItem.Click += new System.EventHandler(this.OnQuit);
+ //
+ // drawingMode
+ //
+ this.drawingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.drawingMode.Enabled = false;
+ this.drawingMode.FormattingEnabled = true;
+ this.drawingMode.Items.AddRange(new object[] {
+ "Plot",
+ "Line",
+ "Fill",
+ "Rectangle",
+ "Filled Rectangle",
+ "Circle",
+ "Filled Circle"});
+ this.drawingMode.Location = new System.Drawing.Point(13, 28);
+ this.drawingMode.Name = "drawingMode";
+ this.drawingMode.Size = new System.Drawing.Size(121, 21);
+ this.drawingMode.TabIndex = 1;
+ this.drawingMode.SelectedIndexChanged += new System.EventHandler(this.OnDrawingMode);
+ //
+ // tileNumber
+ //
+ this.tileNumber.Enabled = false;
+ this.tileNumber.Location = new System.Drawing.Point(173, 29);
+ this.tileNumber.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.tileNumber.Name = "tileNumber";
+ this.tileNumber.Size = new System.Drawing.Size(58, 20);
+ this.tileNumber.TabIndex = 2;
+ this.tileNumber.ValueChanged += new System.EventHandler(this.OnTileNumber);
+ //
+ // tilePreview
+ //
+ this.tilePreview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.tilePreview.Enabled = false;
+ this.tilePreview.Location = new System.Drawing.Point(237, 28);
+ this.tilePreview.Name = "tilePreview";
+ this.tilePreview.Size = new System.Drawing.Size(32, 32);
+ this.tilePreview.TabIndex = 3;
+ this.tilePreview.TabStop = false;
+ this.tilePreview.Click += new System.EventHandler(this.OnSelectTile);
+ //
+ // dataNumber
+ //
+ this.dataNumber.Enabled = false;
+ this.dataNumber.Location = new System.Drawing.Point(314, 29);
+ this.dataNumber.Maximum = new decimal(new int[] {
+ 1000000,
+ 0,
+ 0,
+ 0});
+ this.dataNumber.Minimum = new decimal(new int[] {
+ 1000000,
+ 0,
+ 0,
+ -2147483648});
+ this.dataNumber.Name = "dataNumber";
+ this.dataNumber.Size = new System.Drawing.Size(98, 20);
+ this.dataNumber.TabIndex = 5;
+ this.dataNumber.ValueChanged += new System.EventHandler(this.OnDataNumber);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(140, 31);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(27, 13);
+ this.label1.TabIndex = 6;
+ this.label1.Text = "Tile:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(275, 31);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(33, 13);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "Data:";
+ //
+ // tileMode
+ //
+ this.tileMode.AutoSize = true;
+ this.tileMode.Checked = true;
+ this.tileMode.Enabled = false;
+ this.tileMode.Location = new System.Drawing.Point(419, 31);
+ this.tileMode.Name = "tileMode";
+ this.tileMode.Size = new System.Drawing.Size(72, 17);
+ this.tileMode.TabIndex = 8;
+ this.tileMode.TabStop = true;
+ this.tileMode.Text = "Tile Mode";
+ this.tileMode.UseVisualStyleBackColor = true;
+ this.tileMode.Click += new System.EventHandler(this.OnDataOrTileMode);
+ //
+ // dataMode
+ //
+ this.dataMode.AutoSize = true;
+ this.dataMode.Enabled = false;
+ this.dataMode.Location = new System.Drawing.Point(498, 31);
+ this.dataMode.Name = "dataMode";
+ this.dataMode.Size = new System.Drawing.Size(78, 17);
+ this.dataMode.TabIndex = 9;
+ this.dataMode.TabStop = true;
+ this.dataMode.Text = "Data Mode";
+ this.dataMode.UseVisualStyleBackColor = true;
+ this.dataMode.Click += new System.EventHandler(this.OnDataOrTileMode);
+ //
+ // panel
+ //
+ this.panel.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.panel.AutoScroll = true;
+ this.panel.Controls.Add(this.map);
+ this.panel.Location = new System.Drawing.Point(12, 66);
+ this.panel.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(968, 336);
+ this.panel.TabIndex = 10;
+ //
+ // map
+ //
+ this.map.Font = new System.Drawing.Font("Arial Narrow", 5.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.map.Location = new System.Drawing.Point(2, 2);
+ this.map.MapDrawMode = MapEd.MapControl.DrawMode.Plot;
+ this.map.Margin = new System.Windows.Forms.Padding(2);
+ this.map.Name = "map";
+ this.map.Size = new System.Drawing.Size(480, 163);
+ this.map.TabIndex = 4;
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(992, 414);
+ this.Controls.Add(this.panel);
+ this.Controls.Add(this.dataMode);
+ this.Controls.Add(this.tileMode);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.dataNumber);
+ this.Controls.Add(this.tilePreview);
+ this.Controls.Add(this.tileNumber);
+ this.Controls.Add(this.drawingMode);
+ this.Controls.Add(this.mainMenu);
+ this.MainMenuStrip = this.mainMenu;
+ this.MinimumSize = new System.Drawing.Size(320, 200);
+ this.Name = "Form1";
+ this.Text = "MapEd";
+ this.mainMenu.ResumeLayout(false);
+ this.mainMenu.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.tileNumber)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.tilePreview)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.dataNumber)).EndInit();
+ this.panel.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip mainMenu;
+ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem newMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem loadMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem saveAsMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem saveMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem quitMenuItem;
+ private System.Windows.Forms.ComboBox drawingMode;
+ private System.Windows.Forms.NumericUpDown tileNumber;
+ private System.Windows.Forms.PictureBox tilePreview;
+ private System.Windows.Forms.NumericUpDown dataNumber;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.RadioButton tileMode;
+ private System.Windows.Forms.RadioButton dataMode;
+ private MapControl map;
+ private LayoutPanel panel;
+ }
+}
+
diff --git a/MapEd/Form1.cs b/MapEd/Form1.cs
new file mode 100644
index 0000000..c990bcc
--- /dev/null
+++ b/MapEd/Form1.cs
@@ -0,0 +1,217 @@
+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 Newtonsoft.Json;
+using System.IO;
+
+namespace MapEd
+{
+ public partial class Form1 : Form
+ {
+ private TileStrip tiles;
+ private string filename;
+
+ public Form1()
+ {
+ InitializeComponent();
+
+ drawingMode.SelectedIndex = 0;
+ }
+
+ private void OnQuit(object sender, EventArgs e)
+ {
+ if (MessageBox.Show("Quit", "Quit", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
+ {
+ this.Close();
+ }
+ }
+
+ private void EnableControls()
+ {
+ drawingMode.Enabled = true;
+ tileNumber.Enabled = true;
+ dataNumber.Enabled = true;
+ tileMode.Enabled = true;
+ dataMode.Enabled = true;
+ tilePreview.Enabled = true;
+ }
+
+ private void OnNew(object sender, EventArgs e)
+ {
+ try
+ {
+ NewForm newForm = new NewForm();
+
+ if (newForm.ShowDialog() == DialogResult.OK)
+ {
+ if (tiles != null)
+ {
+ tiles.Dispose();
+ tiles = null;
+ }
+
+ tiles = new TileStrip(newForm.TileMap, newForm.TileSize);
+
+ tileNumber.Maximum = tiles.Count - 1;
+ tileNumber.Value = 0;
+ OnTileNumber(tileNumber, new EventArgs());
+
+ Tuple<int, int> size = newForm.MapSize;
+
+ map.SetMap(size.Item2, size.Item1, tiles, newForm.TileSize);
+
+ saveMenuItem.Enabled = false;
+ saveAsMenuItem.Enabled = true;
+
+ EnableControls();
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void OnLoad(object sender, EventArgs e)
+ {
+ try
+ {
+ OpenFileDialog fsel = new OpenFileDialog();
+
+ fsel.Filter = "MapEd Files (*.maped)|*.maped|All Files (*.*)|*.*";
+
+ if (fsel.ShowDialog() == DialogResult.OK)
+ {
+ filename = fsel.FileName;
+
+ using(StreamReader file = File.OpenText(filename))
+ {
+ string json = file.ReadToEnd();
+ FileContents contents = JsonConvert.DeserializeObject<FileContents>(json);
+
+ if (tiles != null)
+ {
+ tiles.Dispose();
+ tiles = null;
+ }
+
+ tiles = new TileStrip(contents.Strip, contents.TileSize);
+
+ tileNumber.Maximum = tiles.Count - 1;
+ tileNumber.Value = 0;
+ OnTileNumber(tileNumber, new EventArgs());
+
+ map.SetMap(contents.Width, contents.Height, tiles, contents.TileSize);
+ map.SetMap(contents.Map);
+ map.SetData(contents.Data);
+
+ file.Close();
+ }
+ }
+
+ saveMenuItem.Enabled = true;
+ saveAsMenuItem.Enabled = true;
+ EnableControls();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ filename = null;
+ }
+ }
+
+ private void SaveMap()
+ {
+ FileContents contents = new FileContents();
+
+ contents.Strip = tiles.SourceFile;
+ contents.Width = map.MapWidth;
+ contents.Height = map.MapHeight;
+ contents.TileSize = map.TileSize;
+ contents.Map = map.MapTiles;
+ contents.Data = map.MapData;
+
+ string json = JsonConvert.SerializeObject(contents);
+
+ using (StreamWriter file = File.CreateText(filename))
+ {
+ file.Write(json);
+ file.Close();
+ }
+ }
+
+ private void OnSaveAs(object sender, EventArgs e)
+ {
+ try
+ {
+ SaveFileDialog fsel = new SaveFileDialog();
+ fsel.Filter = "MapEd Files (*.maped)|*.maped|All Files (*.*)|*.*";
+
+ if (fsel.ShowDialog() == DialogResult.OK)
+ {
+ filename = fsel.FileName;
+ SaveMap();
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void OnSave(object sender, EventArgs e)
+ {
+ try
+ {
+ if (!String.IsNullOrEmpty(filename))
+ {
+ SaveMap();
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void OnTileNumber(object sender, EventArgs e)
+ {
+ int no = (int)tileNumber.Value;
+
+ tilePreview.BackgroundImage = tiles.GetImage(no);
+ map.SetTileNumber(no);
+ }
+
+ private void OnDrawingMode(object sender, EventArgs e)
+ {
+ MapControl.DrawMode mode = (MapControl.DrawMode)drawingMode.SelectedIndex;
+ map.MapDrawMode = mode;
+ }
+
+ private void OnDataNumber(object sender, EventArgs e)
+ {
+ map.SetDataNumber((int)dataNumber.Value);
+ }
+
+ private void OnDataOrTileMode(object sender, EventArgs e)
+ {
+ map.SetDataMode(sender == dataMode);
+ }
+
+ private void OnSelectTile(object sender, EventArgs e)
+ {
+ TileSelector selector = new TileSelector(tiles);
+
+ if (selector.ShowDialog() == DialogResult.OK)
+ {
+ tileNumber.Value = selector.SelectedTile;
+ }
+ }
+ }
+}
diff --git a/MapEd/Form1.resx b/MapEd/Form1.resx
new file mode 100644
index 0000000..534ec4d
--- /dev/null
+++ b/MapEd/Form1.resx
@@ -0,0 +1,123 @@
+<?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="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/MapEd/LayoutPanel.cs b/MapEd/LayoutPanel.cs
new file mode 100644
index 0000000..1a763cd
--- /dev/null
+++ b/MapEd/LayoutPanel.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace MapEd
+{
+ class LayoutPanel : Panel
+ {
+ protected override Point ScrollToControl(Control activeControl)
+ {
+ return this.AutoScrollPosition;
+ }
+ }
+}
diff --git a/MapEd/MapControl.Designer.cs b/MapEd/MapControl.Designer.cs
new file mode 100644
index 0000000..068810d
--- /dev/null
+++ b/MapEd/MapControl.Designer.cs
@@ -0,0 +1,60 @@
+namespace MapEd
+{
+ partial class MapControl
+ {
+ /// <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 Component 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()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+ this.SuspendLayout();
+ //
+ // toolTip
+ //
+ this.toolTip.UseAnimation = false;
+ this.toolTip.UseFading = false;
+ //
+ // MapControl
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.Font = new System.Drawing.Font("Arial Narrow", 5.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.Name = "MapControl";
+ this.Size = new System.Drawing.Size(160, 108);
+ this.Paint += new System.Windows.Forms.PaintEventHandler(this.OnPaint);
+ this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnMouseDown);
+ this.MouseLeave += new System.EventHandler(this.OnMouseLeave);
+ this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove);
+ this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseUp);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ToolTip toolTip;
+ }
+}
diff --git a/MapEd/MapControl.cs b/MapEd/MapControl.cs
new file mode 100644
index 0000000..2acb8cb
--- /dev/null
+++ b/MapEd/MapControl.cs
@@ -0,0 +1,837 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace MapEd
+{
+ public partial class MapControl : UserControl
+ {
+ public enum DrawMode
+ {
+ Plot,
+ Line,
+ Fill,
+ Rect,
+ FillRect,
+ Circle,
+ FillCircle
+ };
+
+ private const int SCALE = 2;
+
+ private bool mapSet;
+ private int width;
+ private int height;
+ private int tileSize;
+ private int[,] map;
+ private int[,] data;
+ private TileStrip tiles;
+ private bool dataMode;
+ private int tileNumber;
+ private int dataNumber;
+
+ private int lastX;
+ private int lastY;
+
+ private int firstX;
+ private int firstY;
+
+ private DrawMode drawMode;
+
+ private Timer timer;
+ private bool timerDraw;
+ private bool timerColour;
+ private int timerX;
+ private int timerY;
+
+ public MapControl()
+ {
+ InitializeComponent();
+
+ mapSet = false;
+
+ timer = new Timer();
+ timer.Interval = 200;
+ timer.Tick += OnTimerTick;
+ timer.Enabled = true;
+ }
+
+ private void OnTimerTick(object sender, EventArgs e)
+ {
+ if (firstX != -1 && firstX != -1)
+ {
+ timerX = firstX;
+ timerY = firstY;
+
+ timerDraw = true;
+ timerColour = !timerColour;
+
+ if (timerColour)
+ {
+ DrawBlock(timerX, timerY, Brushes.White);
+ }
+ else
+ {
+ DrawBlock(timerX, timerY, Brushes.Black);
+ }
+ }
+
+ if (firstX == -1 && firstY == -1 && timerDraw)
+ {
+ if (dataMode)
+ {
+ DrawData(timerX, timerY, data[timerY,timerX]);
+ }
+ else
+ {
+ DrawCell(timerX, timerY, map[timerY,timerX]);
+ }
+
+ timerDraw = false;
+ }
+ }
+
+ public DrawMode MapDrawMode
+ {
+ get
+ {
+ return drawMode;
+ }
+
+ set
+ {
+ drawMode = value;
+ firstX = -1;
+ firstY = -1;
+ }
+ }
+
+ public void SetMap(int width, int height, TileStrip tiles, int tileSize)
+ {
+ this.width = width;
+ this.height = height;
+ this.tiles = tiles;
+ this.tileSize = tileSize;
+
+ map = new int[height, width];
+ data = new int[height, width];
+
+ Width = width * tileSize * SCALE;
+ Height = height * tileSize * SCALE;
+
+ lastX = -1;
+ lastY = -1;
+ firstX = -1;
+ firstY = -1;
+
+ mapSet = true;
+ RedrawMap();
+ }
+
+ public int MapWidth
+ {
+ get
+ {
+ return width;
+ }
+ }
+
+ public int MapHeight
+ {
+ get
+ {
+ return height;
+ }
+ }
+
+ public int TileSize
+ {
+ get
+ {
+ return tileSize;
+ }
+ }
+
+ public int[,] MapTiles
+ {
+ get
+ {
+ return map;
+ }
+ }
+
+ public int[,] MapData
+ {
+ get
+ {
+ return data;
+ }
+ }
+
+ public void SetTileNumber(int tile)
+ {
+ tileNumber = tile;
+ }
+
+ public void SetDataNumber(int data)
+ {
+ dataNumber = data;
+ }
+
+ public void SetDataMode(bool on)
+ {
+ dataMode = on;
+ RedrawMap();
+ }
+
+ public void SetMap(int[,] map)
+ {
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ this.map[y,x] = map[y,x];
+ }
+ }
+
+ RedrawMap();
+ }
+
+ public void SetData(int[,] data)
+ {
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ this.data[y,x] = data[y,x];
+ }
+ }
+
+ RedrawMap();
+ }
+
+ private void OnMouseMove(object sender, MouseEventArgs e)
+ {
+ if (!mapSet)
+ {
+ return;
+ }
+
+ int x = ScreenToMap(e.X);
+ int y = ScreenToMap(e.Y);
+
+ if (x < width && y < height && (x != lastX || y != lastY))
+ {
+ if (dataMode)
+ {
+ if (e.Button == MouseButtons.Left && drawMode == DrawMode.Plot)
+ {
+ data[y,x] = dataNumber;
+ }
+
+ if (lastX != -1 && lastY != -1)
+ {
+ DrawData(lastX, lastY, data[lastY,lastX]);
+ }
+
+ DrawData(x, y, dataNumber);
+ }
+ else
+ {
+ if (e.Button == MouseButtons.Left && drawMode == DrawMode.Plot)
+ {
+ map[y,x] = tileNumber;
+ }
+
+ if (lastX != -1 && lastY != -1)
+ {
+ DrawCell(lastX, lastY, map[lastY,lastX]);
+ }
+
+ DrawCell(x, y, tileNumber);
+ }
+
+ DrawSelection(x, y);
+
+ lastX = x;
+ lastY = y;
+
+ if (dataMode)
+ {
+ toolTip.Show(data[y,x].ToString(), this, 500);
+ }
+ }
+ }
+
+ private void OnMouseLeave(object sender, EventArgs e)
+ {
+ if (!mapSet)
+ {
+ return;
+ }
+
+ if (lastX != -1 && lastY != -1)
+ {
+ if (dataMode)
+ {
+ DrawData(lastX, lastY, data[lastY,lastX]);
+ }
+ else
+ {
+ DrawCell(lastX, lastY, map[lastY,lastX]);
+ }
+ }
+
+ }
+
+ private void OnMouseDown(object sender, MouseEventArgs e)
+ {
+ if (!mapSet)
+ {
+ return;
+ }
+
+ int x = ScreenToMap(e.X);
+ int y = ScreenToMap(e.Y);
+
+ if (x >= width || y >= height)
+ {
+ return;
+ }
+
+ switch(drawMode)
+ {
+ case DrawMode.Plot:
+ if (dataMode)
+ {
+ if (data[y,x] != dataNumber)
+ {
+ data[y,x] = dataNumber;
+ }
+ }
+ else
+ {
+ if (map[y,x] != tileNumber)
+ {
+ map[y,x] = tileNumber;
+ }
+ }
+ break;
+
+ case DrawMode.Line:
+ if (firstX == -1)
+ {
+ firstX = x;
+ firstY = y;
+ }
+ else
+ {
+ Line(x, y, firstX, firstY);
+ firstX = -1;
+ firstY = -1;
+ }
+ break;
+
+ case DrawMode.Fill:
+ Fill(x, y);
+ break;
+
+ case DrawMode.Rect:
+ if (firstX == -1)
+ {
+ firstX = x;
+ firstY = y;
+ }
+ else
+ {
+ DrawRect(x, y, firstX, firstY, false);
+ firstX = -1;
+ firstY = -1;
+ }
+ break;
+
+ case DrawMode.FillRect:
+ if (firstX == -1)
+ {
+ firstX = x;
+ firstY = y;
+ }
+ else
+ {
+ DrawRect(x, y, firstX, firstY, true);
+ firstX = -1;
+ firstY = -1;
+ }
+ break;
+
+ case DrawMode.Circle:
+ if (firstX == -1)
+ {
+ firstX = x;
+ firstY = y;
+ }
+ else
+ {
+ DrawCircle(firstX, firstY, x, y, false);
+ firstX = -1;
+ firstY = -1;
+ }
+ break;
+
+ case DrawMode.FillCircle:
+ if (firstX == -1)
+ {
+ firstX = x;
+ firstY = y;
+ }
+ else
+ {
+ DrawCircle(firstX, firstY, x, y, true);
+ firstX = -1;
+ firstY = -1;
+ }
+ break;
+ }
+ }
+
+ private void OnMouseUp(object sender, MouseEventArgs e)
+ {
+ if (!mapSet)
+ {
+ return;
+ }
+ }
+
+ private int ScreenToMap(int x)
+ {
+ return x / (tileSize * SCALE);
+ }
+
+ private bool XInRange(int x)
+ {
+ return x >=0 && x < width;
+ }
+
+ private bool YInRange(int y)
+ {
+ return y >=0 && y < height;
+ }
+
+ private void DrawCell(int x, int y, int tile)
+ {
+ using(Graphics g = CreateGraphics())
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.DrawImage(tiles.GetImage(tile), tx, ty, tileSize * SCALE, tileSize * SCALE);
+ }
+ }
+
+ private void DrawData(int x, int y, int data)
+ {
+ using(Graphics g = CreateGraphics())
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.DrawImage(tiles.GetImage(map[y,x]), tx, ty, tileSize * SCALE, tileSize * SCALE);
+ g.DrawString(data.ToString(), Font, Brushes.Magenta, tx, ty);
+ }
+ }
+
+ private void DrawRect(int x1, int y1, int x2, int y2, bool fill)
+ {
+ if (x1 > x2)
+ {
+ var t = x2;
+ x2 = x1;
+ x1 = t;
+ }
+
+ if (y1 > y2)
+ {
+ var t = y2;
+ y2 = y1;
+ y1 = t;
+ }
+
+ int x,y;
+
+ for(y = y1; y <= y2; y++)
+ {
+ for(x = x1; x <= x2; x++)
+ {
+ if (y == y1 || y == y2 || x == x1 | x == x2 | fill)
+ {
+ if (dataMode)
+ {
+ data[y,x] = dataNumber;
+ DrawData(x, y, dataNumber);
+ }
+ else
+ {
+ map[y,x] = tileNumber;
+ DrawCell(x, y, tileNumber);
+ }
+ }
+ }
+ }
+ }
+
+ private void DrawCircle(int x1, int y1, int x2, int y2, bool fill)
+ {
+ double radius;
+ double dx,dy;
+
+ dx = x2 - x1;
+ dy = y2 - y1;
+
+ radius = Math.Sqrt((dx * dx) + (dy * dy));
+
+ for(double a = 0; a < Math.PI ; a += Math.PI / 180.0)
+ {
+ double x,y;
+
+ x = Math.Sin(a) * radius;
+ y = Math.Cos(a) * radius;
+
+ int px1, px2, py;
+
+ px1 = (int)(x1 - x);
+ px2 = (int)(x1 + x);
+ py = (int)(y1 + y);
+
+ if (fill)
+ {
+ for( ; px1 <= px2; px1++)
+ {
+ if (XInRange(px1) && YInRange(py))
+ {
+ if (dataMode)
+ {
+ data[py, px1] = dataNumber;
+ DrawData(px1, py, dataNumber);
+ }
+ else
+ {
+ map[py, px1] = tileNumber;
+ DrawCell(px1, py, tileNumber);
+ }
+ }
+ }
+ }
+ else
+ {
+ if (XInRange(px1) && YInRange(py))
+ {
+ if (dataMode)
+ {
+ data[py, px1] = dataNumber;
+ DrawData(px1, py, dataNumber);
+ }
+ else
+ {
+ map[py, px1] = tileNumber;
+ DrawCell(px1, py, tileNumber);
+ }
+ }
+
+ if (XInRange(px2) && YInRange(py))
+ {
+ if (dataMode)
+ {
+ data[py, px2] = dataNumber;
+ DrawData(px2, py, dataNumber);
+ }
+ else
+ {
+ map[py, px2] = tileNumber;
+ DrawCell(px2, py, tileNumber);
+ }
+ }
+ }
+ }
+
+ }
+
+ private void Fill(int x, int y)
+ {
+ int back;
+
+ if (dataMode)
+ {
+ back = data[y,x];
+
+ if (back == dataNumber)
+ {
+ return;
+ }
+ }
+ else
+ {
+ back = map[y,x];
+
+ if (back == tileNumber)
+ {
+ return;
+ }
+ }
+
+ FloodFill(x, y, back);
+ }
+
+ private void FloodFill(int x, int y, int back)
+ {
+ if (x < 0 || x >= width || y < 0 || y >= height)
+ {
+ return;
+ }
+
+ if (dataMode)
+ {
+ if (data[y,x] != back)
+ {
+ return;
+ }
+
+ data[y, x] = dataNumber;
+ DrawData(x, y, dataNumber);
+ }
+ else
+ {
+ if (map[y,x] != back)
+ {
+ return;
+ }
+
+ map[y,x] = tileNumber;
+ DrawCell(x, y, tileNumber);
+ }
+
+ FloodFill(x + 1, y, back);
+ FloodFill(x - 1, y, back);
+ FloodFill(x, y + 1, back);
+ FloodFill(x, y - 1, back);
+ }
+
+ private void Line(int x1, int y1, int x2, int y2)
+ {
+ int dx = x2 - x1;
+ int dy = y2 - y1;
+
+ int ix = Math.Sign(dx);
+ int iy = Math.Sign(dy);
+
+ dx = Math.Abs(dx);
+ dy = Math.Abs(dy);
+
+ int incrE;
+ int incrNE;
+ int d;
+ bool ymode;
+
+ if (dy>dx)
+ {
+ ymode = true;
+ d = dx * 2 - dy;
+ incrE = dx * 2;
+ incrNE = (dx - dy) * 2;
+ }
+ else
+ {
+ ymode = false;
+ d = dy * 2 - dx;
+ incrE = dy * 2;
+ incrNE = (dy - dx) * 2;
+ }
+
+ int x = x1;
+ int y = y1;
+
+ if (dataMode)
+ {
+ data[y,x] = dataNumber;
+ DrawData(x, y, dataNumber);
+ }
+ else
+ {
+ map[y,x] = tileNumber;
+ DrawCell(x, y, tileNumber);
+ }
+
+ if (ymode)
+ {
+ while(y!=y2)
+ {
+ if (d<=0)
+ {
+ d+=incrE;
+ y+=iy;
+ }
+ else
+ {
+ d+=incrNE;
+ y+=iy;
+ x+=ix;
+ }
+
+ if (dataMode)
+ {
+ data[y,x] = dataNumber;
+ DrawData(x, y, dataNumber);
+ }
+ else
+ {
+ map[y,x] = tileNumber;
+ DrawCell(x, y, tileNumber);
+ }
+ }
+ }
+ else
+ {
+ while(x!=x2)
+ {
+ if (d<=0)
+ {
+ d+=incrE;
+ x+=ix;
+ }
+ else
+ {
+ d+=incrNE;
+ y+=iy;
+ x+=ix;
+ }
+
+ if (dataMode)
+ {
+ data[y,x] = dataNumber;
+ DrawData(x, y, dataNumber);
+ }
+ else
+ {
+ map[y,x] = tileNumber;
+ DrawCell(x, y, tileNumber);
+ }
+ }
+ }
+ }
+
+ private void RedrawMap()
+ {
+ using(Graphics g = CreateGraphics())
+ {
+ if (dataMode)
+ {
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.DrawImage(tiles.GetImage(map[y,x]), tx, ty, tileSize * SCALE, tileSize * SCALE);
+ g.DrawString(data[y,x].ToString(), Font, Brushes.Magenta, tx, ty);
+ }
+ }
+ }
+ else
+ {
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.DrawImage(tiles.GetImage(map[y,x]), tx, ty, tileSize * SCALE, tileSize * SCALE);
+ }
+ }
+ }
+ }
+ }
+
+ private void RedrawMap(int x1, int y1, int x2, int y2, Graphics g)
+ {
+ if (dataMode)
+ {
+ for(int y = y1; y <= y2; y++)
+ {
+ for(int x = x1; x <= x2; x++)
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.DrawImage(tiles.GetImage(map[y,x]), tx, ty, tileSize * SCALE, tileSize * SCALE);
+ g.DrawString(data[y,x].ToString(), Font, Brushes.Magenta, tx, ty);
+ }
+ }
+ }
+ else
+ {
+ for(int y = y1; y <= y2; y++)
+ {
+ for(int x = x1; x <= x2; x++)
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.DrawImage(tiles.GetImage(map[y,x]), tx, ty, tileSize * SCALE, tileSize * SCALE);
+ }
+ }
+ }
+ }
+
+ private void DrawSelection(int x, int y)
+ {
+ using(Graphics g = CreateGraphics())
+ {
+ int tx1 = x * tileSize * SCALE;
+ int ty1 = y * tileSize * SCALE;
+ int tx2 = tx1 + tileSize * SCALE - 1;
+ int ty2 = ty1 + tileSize * SCALE - 1;
+
+ g.DrawLine(Pens.White, tx1, ty1, tx2, ty1);
+ g.DrawLine(Pens.White, tx2, ty1, tx2, ty2);
+ g.DrawLine(Pens.White, tx2, ty2, tx1, ty2);
+ g.DrawLine(Pens.White, tx1, ty2, tx1, ty1);
+ }
+ }
+
+ private void DrawBlock(int x, int y, Brush b)
+ {
+ using(Graphics g = CreateGraphics())
+ {
+ int tx = x * tileSize * SCALE;
+ int ty = y * tileSize * SCALE;
+
+ g.FillRectangle(b, tx, ty, tileSize * SCALE, tileSize * SCALE);
+ }
+ }
+
+ private void OnPaint(object sender, PaintEventArgs e)
+ {
+ if (!mapSet)
+ {
+ return;
+ }
+
+ int x1,y1,x2,y2;
+
+ x1 = Math.Max(0, ScreenToMap(e.ClipRectangle.X));
+ y1 = Math.Max(0, ScreenToMap(e.ClipRectangle.Y));
+
+ x2 = Math.Min(width - 1, ScreenToMap(e.ClipRectangle.Right));
+ y2 = Math.Min(height -1, ScreenToMap(e.ClipRectangle.Bottom));
+
+ RedrawMap(x1,y1,x2,y2,e.Graphics);
+ }
+ }
+}
diff --git a/MapEd/MapControl.resx b/MapEd/MapControl.resx
new file mode 100644
index 0000000..1ca1e9b
--- /dev/null
+++ b/MapEd/MapControl.resx
@@ -0,0 +1,123 @@
+<?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="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/MapEd/MapEd.csproj b/MapEd/MapEd.csproj
new file mode 100644
index 0000000..8c61b42
--- /dev/null
+++ b/MapEd/MapEd.csproj
@@ -0,0 +1,118 @@
+<?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>{C26307FC-4620-4962-9433-B527B9F5716A}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <RootNamespace>MapEd</RootNamespace>
+ <AssemblyName>MapEd</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <Deterministic>true</Deterministic>
+ </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="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.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.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="FileContents.cs" />
+ <Compile Include="Form1.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Designer.cs">
+ <DependentUpon>Form1.cs</DependentUpon>
+ </Compile>
+ <Compile Include="LayoutPanel.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="MapControl.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="MapControl.Designer.cs">
+ <DependentUpon>MapControl.cs</DependentUpon>
+ </Compile>
+ <Compile Include="NewForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="NewForm.Designer.cs">
+ <DependentUpon>NewForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TileSelector.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="TileSelector.Designer.cs">
+ <DependentUpon>TileSelector.cs</DependentUpon>
+ </Compile>
+ <Compile Include="TileStrip.cs" />
+ <EmbeddedResource Include="Form1.resx">
+ <DependentUpon>Form1.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="MapControl.resx">
+ <DependentUpon>MapControl.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="NewForm.resx">
+ <DependentUpon>NewForm.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>
+ </Compile>
+ <EmbeddedResource Include="TileSelector.resx">
+ <DependentUpon>TileSelector.cs</DependentUpon>
+ </EmbeddedResource>
+ <None Include="packages.config" />
+ <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>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/MapEd/NewForm.Designer.cs b/MapEd/NewForm.Designer.cs
new file mode 100644
index 0000000..9c8c321
--- /dev/null
+++ b/MapEd/NewForm.Designer.cs
@@ -0,0 +1,232 @@
+namespace MapEd
+{
+ partial class NewForm
+ {
+ /// <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()
+ {
+ this.radioButton8x8 = new System.Windows.Forms.RadioButton();
+ this.label1 = new System.Windows.Forms.Label();
+ this.radioButton16x16 = new System.Windows.Forms.RadioButton();
+ this.label2 = new System.Windows.Forms.Label();
+ this.tilemap = new System.Windows.Forms.TextBox();
+ this.selectButton = new System.Windows.Forms.Button();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.okButton = new System.Windows.Forms.Button();
+ this.label3 = new System.Windows.Forms.Label();
+ this.mapWidth = new System.Windows.Forms.NumericUpDown();
+ this.mapHeight = new System.Windows.Forms.NumericUpDown();
+ this.label4 = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.mapWidth)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.mapHeight)).BeginInit();
+ this.SuspendLayout();
+ //
+ // radioButton8x8
+ //
+ this.radioButton8x8.AutoSize = true;
+ this.radioButton8x8.Checked = true;
+ this.radioButton8x8.Location = new System.Drawing.Point(12, 29);
+ this.radioButton8x8.Name = "radioButton8x8";
+ this.radioButton8x8.Size = new System.Drawing.Size(42, 17);
+ this.radioButton8x8.TabIndex = 0;
+ this.radioButton8x8.TabStop = true;
+ this.radioButton8x8.Text = "8x8";
+ this.radioButton8x8.UseVisualStyleBackColor = true;
+ this.radioButton8x8.Click += new System.EventHandler(this.On8x8);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(9, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(47, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Tile Size";
+ //
+ // radioButton16x16
+ //
+ this.radioButton16x16.AutoSize = true;
+ this.radioButton16x16.Location = new System.Drawing.Point(60, 29);
+ this.radioButton16x16.Name = "radioButton16x16";
+ this.radioButton16x16.Size = new System.Drawing.Size(54, 17);
+ this.radioButton16x16.TabIndex = 2;
+ this.radioButton16x16.Text = "16x16";
+ this.radioButton16x16.UseVisualStyleBackColor = true;
+ this.radioButton16x16.Click += new System.EventHandler(this.On16x16);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(9, 93);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(48, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "Tile Map";
+ //
+ // tilemap
+ //
+ this.tilemap.Location = new System.Drawing.Point(12, 109);
+ this.tilemap.Name = "tilemap";
+ this.tilemap.Size = new System.Drawing.Size(205, 20);
+ this.tilemap.TabIndex = 4;
+ //
+ // selectButton
+ //
+ this.selectButton.Location = new System.Drawing.Point(223, 109);
+ this.selectButton.Name = "selectButton";
+ this.selectButton.Size = new System.Drawing.Size(75, 23);
+ this.selectButton.TabIndex = 5;
+ this.selectButton.Text = "Select...";
+ this.selectButton.UseVisualStyleBackColor = true;
+ this.selectButton.Click += new System.EventHandler(this.OnSelect);
+ //
+ // cancelButton
+ //
+ this.cancelButton.Location = new System.Drawing.Point(225, 138);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(75, 23);
+ this.cancelButton.TabIndex = 6;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.OnCancel);
+ //
+ // okButton
+ //
+ this.okButton.Enabled = false;
+ this.okButton.Location = new System.Drawing.Point(144, 138);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(75, 23);
+ this.okButton.TabIndex = 7;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.OnOK);
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(13, 53);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(51, 13);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "Map Size";
+ //
+ // mapWidth
+ //
+ this.mapWidth.Location = new System.Drawing.Point(12, 70);
+ this.mapWidth.Maximum = new decimal(new int[] {
+ 256,
+ 0,
+ 0,
+ 0});
+ this.mapWidth.Minimum = new decimal(new int[] {
+ 32,
+ 0,
+ 0,
+ 0});
+ this.mapWidth.Name = "mapWidth";
+ this.mapWidth.Size = new System.Drawing.Size(52, 20);
+ this.mapWidth.TabIndex = 9;
+ this.mapWidth.Value = new decimal(new int[] {
+ 32,
+ 0,
+ 0,
+ 0});
+ //
+ // mapHeight
+ //
+ this.mapHeight.Location = new System.Drawing.Point(95, 70);
+ this.mapHeight.Maximum = new decimal(new int[] {
+ 256,
+ 0,
+ 0,
+ 0});
+ this.mapHeight.Minimum = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ this.mapHeight.Name = "mapHeight";
+ this.mapHeight.Size = new System.Drawing.Size(52, 20);
+ this.mapHeight.TabIndex = 10;
+ this.mapHeight.Value = new decimal(new int[] {
+ 32,
+ 0,
+ 0,
+ 0});
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(71, 72);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(18, 13);
+ this.label4.TabIndex = 11;
+ this.label4.Text = "by";
+ //
+ // NewForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(307, 171);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.mapHeight);
+ this.Controls.Add(this.mapWidth);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.okButton);
+ this.Controls.Add(this.cancelButton);
+ this.Controls.Add(this.selectButton);
+ this.Controls.Add(this.tilemap);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.radioButton16x16);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.radioButton8x8);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "NewForm";
+ this.Text = "New Map";
+ ((System.ComponentModel.ISupportInitialize)(this.mapWidth)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.mapHeight)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.RadioButton radioButton8x8;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.RadioButton radioButton16x16;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox tilemap;
+ private System.Windows.Forms.Button selectButton;
+ private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.NumericUpDown mapWidth;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.NumericUpDown mapHeight;
+ }
+} \ No newline at end of file
diff --git a/MapEd/NewForm.cs b/MapEd/NewForm.cs
new file mode 100644
index 0000000..ed3bab3
--- /dev/null
+++ b/MapEd/NewForm.cs
@@ -0,0 +1,81 @@
+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;
+
+namespace MapEd
+{
+ public partial class NewForm : Form
+ {
+ private int tileSize = 8;
+
+ public NewForm()
+ {
+ InitializeComponent();
+ }
+
+ public int TileSize
+ {
+ get
+ {
+ return tileSize;
+ }
+ }
+
+ public Tuple<int, int> MapSize
+ {
+ get
+ {
+ return new Tuple<int, int>((int)mapHeight.Value, (int)mapWidth.Value);
+ }
+ }
+
+ public string TileMap
+ {
+ get
+ {
+ return tilemap.Text;
+ }
+ }
+
+ private void OnSelect(object sender, EventArgs e)
+ {
+ OpenFileDialog fsel = new OpenFileDialog();
+
+ fsel.Filter = "PNG Files (*.png)|*.png|All Files (*.*)|*.*";
+
+ if (fsel.ShowDialog() == DialogResult.OK)
+ {
+ tilemap.Text = fsel.FileName;
+ okButton.Enabled = true;
+ }
+ }
+
+ private void OnCancel(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void OnOK(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void On8x8(object sender, EventArgs e)
+ {
+ tileSize = 8;
+ }
+
+ private void On16x16(object sender, EventArgs e)
+ {
+ tileSize = 16;
+ }
+ }
+}
diff --git a/MapEd/NewForm.resx b/MapEd/NewForm.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/MapEd/NewForm.resx
@@ -0,0 +1,120 @@
+<?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>
+</root> \ No newline at end of file
diff --git a/MapEd/Program.cs b/MapEd/Program.cs
new file mode 100644
index 0000000..27f27c4
--- /dev/null
+++ b/MapEd/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace MapEd
+{
+ 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());
+ }
+ }
+}
diff --git a/MapEd/Properties/AssemblyInfo.cs b/MapEd/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..008186c
--- /dev/null
+++ b/MapEd/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("MapEd")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("MapEd")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 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("c26307fc-4620-4962-9433-b527b9f5716a")]
+
+// 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/MapEd/Properties/Resources.Designer.cs b/MapEd/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..748e068
--- /dev/null
+++ b/MapEd/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <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 MapEd.Properties
+{
+
+
+ /// <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", "4.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 ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MapEd.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;
+ }
+ }
+ }
+}
diff --git a/MapEd/Properties/Resources.resx b/MapEd/Properties/Resources.resx
new file mode 100644
index 0000000..ffecec8
--- /dev/null
+++ b/MapEd/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </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" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/MapEd/Properties/Settings.Designer.cs b/MapEd/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..adb5345
--- /dev/null
+++ b/MapEd/Properties/Settings.Designer.cs
@@ -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 MapEd.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/MapEd/Properties/Settings.settings b/MapEd/Properties/Settings.settings
new file mode 100644
index 0000000..abf36c5
--- /dev/null
+++ b/MapEd/Properties/Settings.settings
@@ -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>
diff --git a/MapEd/TileSelector.Designer.cs b/MapEd/TileSelector.Designer.cs
new file mode 100644
index 0000000..4d3a5a0
--- /dev/null
+++ b/MapEd/TileSelector.Designer.cs
@@ -0,0 +1,63 @@
+namespace MapEd
+{
+ partial class TileSelector
+ {
+ /// <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()
+ {
+ this.listView = new System.Windows.Forms.ListView();
+ this.SuspendLayout();
+ //
+ // listView
+ //
+ this.listView.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.listView.Location = new System.Drawing.Point(13, 13);
+ this.listView.Name = "listView";
+ this.listView.Size = new System.Drawing.Size(337, 126);
+ this.listView.TabIndex = 0;
+ this.listView.UseCompatibleStateImageBehavior = false;
+ this.listView.View = System.Windows.Forms.View.SmallIcon;
+ this.listView.DoubleClick += new System.EventHandler(this.OnDoubleClick);
+ //
+ // TileSelector
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(362, 151);
+ this.Controls.Add(this.listView);
+ this.Name = "TileSelector";
+ this.Text = "TileSelector";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ListView listView;
+ }
+} \ No newline at end of file
diff --git a/MapEd/TileSelector.cs b/MapEd/TileSelector.cs
new file mode 100644
index 0000000..a21561e
--- /dev/null
+++ b/MapEd/TileSelector.cs
@@ -0,0 +1,46 @@
+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;
+
+namespace MapEd
+{
+ public partial class TileSelector : Form
+ {
+ private int selected;
+
+ public TileSelector(TileStrip tiles)
+ {
+ InitializeComponent();
+
+ listView.SmallImageList = new ImageList();
+
+ listView.SmallImageList.Images.AddRange(tiles.Images);
+
+ for(int f = 0 ; f < tiles.Count ; f++)
+ {
+ listView.Items.Add(string.Empty, f);
+ }
+ }
+
+ public int SelectedTile
+ {
+ get
+ {
+ return selected;
+ }
+ }
+
+ private void OnDoubleClick(object sender, EventArgs e)
+ {
+ selected = listView.SelectedIndices[0];
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ }
+}
diff --git a/MapEd/TileSelector.resx b/MapEd/TileSelector.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/MapEd/TileSelector.resx
@@ -0,0 +1,120 @@
+<?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>
+</root> \ No newline at end of file
diff --git a/MapEd/TileStrip.cs b/MapEd/TileStrip.cs
new file mode 100644
index 0000000..ac77188
--- /dev/null
+++ b/MapEd/TileStrip.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MapEd
+{
+ public class TileStrip : IDisposable
+ {
+ private bool disposedValue = false;
+ private string filename;
+ private Image image;
+ private Bitmap[] bitmaps;
+ private Image[] images;
+
+ public TileStrip(string path, int size)
+ {
+ filename = path;
+ image = Image.FromFile(path);
+ bitmaps = new Bitmap[image.Width / size];
+ images = new Image[bitmaps.Length];
+ Bitmap bmp = new Bitmap(image);
+
+ for(int f = 0; f < bitmaps.Length; f++)
+ {
+ bitmaps[f] = bmp.Clone(new Rectangle(f*size, 0, size, size), System.Drawing.Imaging.PixelFormat.DontCare);
+ images[f] = Image.FromHbitmap(bitmaps[f].GetHbitmap());
+ }
+
+ bmp.Dispose();
+ }
+
+ public Image Strip
+ {
+ get
+ {
+ return image;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return bitmaps.Length;
+ }
+ }
+
+ public Bitmap GetBitmap(int no)
+ {
+ return bitmaps[no];
+ }
+
+ public Image GetImage(int no)
+ {
+ return images[no];
+ }
+
+ public string SourceFile
+ {
+ get
+ {
+ return filename;
+ }
+ }
+
+ public Image[] Images
+ {
+ get
+ {
+ return images;
+ }
+ }
+
+ public Bitmap[] Bitmaps
+ {
+ get
+ {
+ return bitmaps;
+ }
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ image.Dispose();
+
+ foreach(Bitmap b in bitmaps)
+ {
+ b.Dispose();
+ }
+
+ foreach(Image i in images)
+ {
+ i.Dispose();
+ }
+ }
+
+ disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ }
+}
diff --git a/MapEd/packages.config b/MapEd/packages.config
new file mode 100644
index 0000000..ea50f86
--- /dev/null
+++ b/MapEd/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
+</packages> \ No newline at end of file