StyleCop clean TilesetBuilder

adapt Makefile after TilesetBuilder file renamings

remove dead TilesetBuilder code
This commit is contained in:
Matthias Mailänder
2013-08-03 19:30:36 +02:00
parent 59b700fcde
commit 4603f0bbf6
9 changed files with 704 additions and 728 deletions

View File

@@ -194,15 +194,15 @@ tsbuild_TARGET = OpenRA.TilesetBuilder.exe
tsbuild_KIND = winexe tsbuild_KIND = winexe
tsbuild_DEPS = $(fileformats_TARGET) $(game_TARGET) tsbuild_DEPS = $(fileformats_TARGET) $(game_TARGET)
tsbuild_LIBS = $(COMMON_LIBS) $(tsbuild_DEPS) System.Windows.Forms.dll tsbuild_LIBS = $(COMMON_LIBS) $(tsbuild_DEPS) System.Windows.Forms.dll
tsbuild_EXTRA = -resource:OpenRA.TilesetBuilder.frmBuilder.resources -resource:OpenRA.TilesetBuilder.frmNew.resources -resource:OpenRA.TilesetBuilder.Surface.resources tsbuild_EXTRA = -resource:OpenRA.TilesetBuilder.FormBuilder.resources -resource:OpenRA.TilesetBuilder.FormNew.resources -resource:OpenRA.TilesetBuilder.Surface.resources
PROGRAMS += tsbuild PROGRAMS += tsbuild
OpenRA.TilesetBuilder.frmBuilder.resources: OpenRA.TilesetBuilder.FormBuilder.resources:
resgen2 OpenRA.TilesetBuilder/frmBuilder.resx OpenRA.TilesetBuilder.frmBuilder.resources 1> /dev/null resgen2 OpenRA.TilesetBuilder/FormBuilder.resx OpenRA.TilesetBuilder.FormBuilder.resources 1> /dev/null
OpenRA.TilesetBuilder.frmNew.resources: OpenRA.TilesetBuilder.FormNew.resources:
resgen2 OpenRA.TilesetBuilder/frmNew.resx OpenRA.TilesetBuilder.frmNew.resources 1> /dev/null resgen2 OpenRA.TilesetBuilder/frmNew.resx OpenRA.TilesetBuilder.FormNew.resources 1> /dev/null
OpenRA.TilesetBuilder.Surface.resources: OpenRA.TilesetBuilder.Surface.resources:
resgen2 OpenRA.TilesetBuilder/Surface.resx OpenRA.TilesetBuilder.Surface.resources 1> /dev/null resgen2 OpenRA.TilesetBuilder/Surface.resx OpenRA.TilesetBuilder.Surface.resources 1> /dev/null
tsbuild: OpenRA.TilesetBuilder.frmBuilder.resources OpenRA.TilesetBuilder.frmNew.resources OpenRA.TilesetBuilder.Surface.resources $(tsbuild_TARGET) tsbuild: OpenRA.TilesetBuilder.FormBuilder.resources OpenRA.TilesetBuilder.FormNew.resources OpenRA.TilesetBuilder.Surface.resources $(tsbuild_TARGET)
##### Launchers / Utilities ##### ##### Launchers / Utilities #####

View File

@@ -1,368 +1,367 @@
namespace OpenRA.TilesetBuilder namespace OpenRA.TilesetBuilder
{ {
partial class frmBuilder partial class FormBuilder
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing);
} base.Dispose(disposing);
}
#region Windows Form Designer generated code
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify /// <summary>
/// the contents of this method with the code editor. /// Required method for Designer support - do not modify
/// </summary> /// the contents of this method with the code editor.
private void InitializeComponent() /// </summary>
{ private void InitializeComponent()
this.components = new System.ComponentModel.Container(); {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmBuilder)); this.components = new System.ComponentModel.Container();
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBuilder));
this.panel1 = new System.Windows.Forms.Panel(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
this.imageList = new System.Windows.Forms.ImageList(this.components); this.panel1 = new System.Windows.Forms.Panel();
this.tsTerrainTypes = new System.Windows.Forms.ToolStrip(); this.ImageList = new System.Windows.Forms.ImageList(this.components);
this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel(); this.terrainTypes = new System.Windows.Forms.ToolStrip();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel();
this.toolStripLabel4 = new System.Windows.Forms.ToolStripLabel(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.txtTilesetName = new System.Windows.Forms.ToolStripTextBox(); this.toolStripLabel4 = new System.Windows.Forms.ToolStripLabel();
this.toolStripLabel5 = new System.Windows.Forms.ToolStripLabel(); this.txtTilesetName = new System.Windows.Forms.ToolStripTextBox();
this.txtID = new System.Windows.Forms.ToolStripTextBox(); this.toolStripLabel5 = new System.Windows.Forms.ToolStripLabel();
this.lblExt = new System.Windows.Forms.ToolStripLabel(); this.txtID = new System.Windows.Forms.ToolStripTextBox();
this.txtExt = new System.Windows.Forms.ToolStripTextBox(); this.lblExt = new System.Windows.Forms.ToolStripLabel();
this.toolStripLabel6 = new System.Windows.Forms.ToolStripLabel(); this.txtExt = new System.Windows.Forms.ToolStripTextBox();
this.txtPal = new System.Windows.Forms.ToolStripTextBox(); this.toolStripLabel6 = new System.Windows.Forms.ToolStripLabel();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.txtPal = new System.Windows.Forms.ToolStripTextBox();
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton15 = new System.Windows.Forms.ToolStripButton(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton15 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton14 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton16 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton14 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButton16 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.surface1 = new OpenRA.TilesetBuilder.Surface(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.toolStripContainer1.ContentPanel.SuspendLayout(); this.surface1 = new OpenRA.TilesetBuilder.Surface();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
this.panel1.SuspendLayout(); this.toolStripContainer1.SuspendLayout();
this.tsTerrainTypes.SuspendLayout(); this.panel1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.terrainTypes.SuspendLayout();
this.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// toolStripContainer1
//
//
// toolStripContainer1.ContentPanel
//
this.toolStripContainer1.ContentPanel.Controls.Add(this.panel1);
this.toolStripContainer1.ContentPanel.Controls.Add(this.terrainTypes);
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(908, 571);
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
this.toolStripContainer1.Name = "toolStripContainer1";
this.toolStripContainer1.Size = new System.Drawing.Size(908, 596);
this.toolStripContainer1.TabIndex = 0;
this.toolStripContainer1.Text = "toolStripContainer1";
//
// toolStripContainer1.TopToolStripPanel
//
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1);
this.toolStripContainer1.TopToolStripPanel.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
// //
// toolStripContainer1 // panel1
// //
// this.panel1.AutoScroll = true;
// toolStripContainer1.ContentPanel this.panel1.BackColor = System.Drawing.Color.Black;
//
this.toolStripContainer1.ContentPanel.Controls.Add(this.panel1);
this.toolStripContainer1.ContentPanel.Controls.Add(this.tsTerrainTypes);
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(908, 571);
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
this.toolStripContainer1.Name = "toolStripContainer1";
this.toolStripContainer1.Size = new System.Drawing.Size(908, 596);
this.toolStripContainer1.TabIndex = 0;
this.toolStripContainer1.Text = "toolStripContainer1";
//
// toolStripContainer1.TopToolStripPanel
//
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1);
this.toolStripContainer1.TopToolStripPanel.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
this.toolStripContainer1.TopToolStripPanel.Click += new System.EventHandler(this.toolStripContainer1_TopToolStripPanel_Click);
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.BackColor = System.Drawing.Color.Black;
this.panel1.Controls.Add(this.surface1); this.panel1.Controls.Add(this.surface1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(788, 571); this.panel1.Size = new System.Drawing.Size(788, 571);
this.panel1.TabIndex = 3; this.panel1.TabIndex = 3;
// //
// imageList // imageList
// //
this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); this.ImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
this.imageList.TransparentColor = System.Drawing.Color.Transparent; this.ImageList.TransparentColor = System.Drawing.Color.Transparent;
this.imageList.Images.SetKeyName(0, "clear.png"); this.ImageList.Images.SetKeyName(0, "clear.png");
this.imageList.Images.SetKeyName(1, "water.png"); this.ImageList.Images.SetKeyName(1, "water.png");
this.imageList.Images.SetKeyName(2, "road.png"); this.ImageList.Images.SetKeyName(2, "road.png");
this.imageList.Images.SetKeyName(3, "rock.png"); this.ImageList.Images.SetKeyName(3, "rock.png");
this.imageList.Images.SetKeyName(4, "river.png"); this.ImageList.Images.SetKeyName(4, "river.png");
this.imageList.Images.SetKeyName(5, "rough.png"); this.ImageList.Images.SetKeyName(5, "rough.png");
this.imageList.Images.SetKeyName(6, "wall.png"); this.ImageList.Images.SetKeyName(6, "wall.png");
this.imageList.Images.SetKeyName(7, "beach.png"); this.ImageList.Images.SetKeyName(7, "beach.png");
this.imageList.Images.SetKeyName(8, "tree.png"); this.ImageList.Images.SetKeyName(8, "tree.png");
this.imageList.Images.SetKeyName(9, "tiberium.png"); this.ImageList.Images.SetKeyName(9, "tiberium.png");
// //
// tsTerrainTypes // tsTerrainTypes
// //
this.tsTerrainTypes.AutoSize = false; this.terrainTypes.AutoSize = false;
this.tsTerrainTypes.Dock = System.Windows.Forms.DockStyle.Right; this.terrainTypes.Dock = System.Windows.Forms.DockStyle.Right;
this.tsTerrainTypes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.terrainTypes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripLabel3, this.toolStripLabel3,
this.toolStripSeparator3, this.toolStripSeparator3,
this.toolStripLabel4, this.toolStripLabel4,
this.txtTilesetName, this.txtTilesetName,
this.toolStripLabel5, this.toolStripLabel5,
this.txtID, this.txtID,
this.lblExt, this.lblExt,
this.txtExt, this.txtExt,
this.toolStripLabel6, this.toolStripLabel6,
this.txtPal, this.txtPal,
this.toolStripSeparator5, this.toolStripSeparator5,
this.toolStripLabel2, this.toolStripLabel2,
this.toolStripSeparator4, this.toolStripSeparator4,
this.toolStripButton1}); this.toolStripButton1});
this.tsTerrainTypes.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow; this.terrainTypes.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow;
this.tsTerrainTypes.Location = new System.Drawing.Point(788, 0); this.terrainTypes.Location = new System.Drawing.Point(788, 0);
this.tsTerrainTypes.Name = "tsTerrainTypes"; this.terrainTypes.Name = "tsTerrainTypes";
this.tsTerrainTypes.Size = new System.Drawing.Size(120, 571); this.terrainTypes.Size = new System.Drawing.Size(120, 571);
this.tsTerrainTypes.TabIndex = 1; this.terrainTypes.TabIndex = 1;
this.tsTerrainTypes.Text = "toolStrip3"; this.terrainTypes.Text = "toolStrip3";
// //
// toolStripLabel3 // toolStripLabel3
// //
this.toolStripLabel3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.toolStripLabel3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
this.toolStripLabel3.Name = "toolStripLabel3"; this.toolStripLabel3.Name = "toolStripLabel3";
this.toolStripLabel3.Size = new System.Drawing.Size(118, 13); this.toolStripLabel3.Size = new System.Drawing.Size(118, 13);
this.toolStripLabel3.Text = "Tileset setup"; this.toolStripLabel3.Text = "Tileset setup";
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(118, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(118, 6);
// //
// toolStripLabel4 // toolStripLabel4
// //
this.toolStripLabel4.Name = "toolStripLabel4"; this.toolStripLabel4.Name = "toolStripLabel4";
this.toolStripLabel4.Size = new System.Drawing.Size(118, 13); this.toolStripLabel4.Size = new System.Drawing.Size(118, 13);
this.toolStripLabel4.Text = "Tileset name:"; this.toolStripLabel4.Text = "Tileset name:";
// //
// txtTilesetName // txtTilesetName
// //
this.txtTilesetName.MaxLength = 32; this.txtTilesetName.MaxLength = 32;
this.txtTilesetName.Name = "txtTilesetName"; this.txtTilesetName.Name = "txtTilesetName";
this.txtTilesetName.Size = new System.Drawing.Size(116, 21); this.txtTilesetName.Size = new System.Drawing.Size(116, 21);
this.txtTilesetName.Text = "Temperat"; this.txtTilesetName.Text = "Temperat";
this.txtTilesetName.TextChanged += new System.EventHandler(this.txtTilesetName_TextChanged); this.txtTilesetName.TextChanged += new System.EventHandler(this.TilesetNameChanged);
// //
// toolStripLabel5 // toolStripLabel5
// //
this.toolStripLabel5.Name = "toolStripLabel5"; this.toolStripLabel5.Name = "toolStripLabel5";
this.toolStripLabel5.Size = new System.Drawing.Size(118, 13); this.toolStripLabel5.Size = new System.Drawing.Size(118, 13);
this.toolStripLabel5.Text = "Tileset ID:"; this.toolStripLabel5.Text = "Tileset ID:";
// //
// txtID // txtID
// //
this.txtID.Name = "txtID"; this.txtID.Name = "txtID";
this.txtID.ReadOnly = true; this.txtID.ReadOnly = true;
this.txtID.Size = new System.Drawing.Size(116, 21); this.txtID.Size = new System.Drawing.Size(116, 21);
this.txtID.Text = "TEMPERAT"; this.txtID.Text = "TEMPERAT";
// //
// lblExt // lblExt
// //
this.lblExt.Name = "lblExt"; this.lblExt.Name = "lblExt";
this.lblExt.Size = new System.Drawing.Size(118, 13); this.lblExt.Size = new System.Drawing.Size(118, 13);
this.lblExt.Text = "Extensions:"; this.lblExt.Text = "Extensions:";
// //
// txtExt // txtExt
// //
this.txtExt.Name = "txtExt"; this.txtExt.Name = "txtExt";
this.txtExt.ReadOnly = true; this.txtExt.ReadOnly = true;
this.txtExt.Size = new System.Drawing.Size(116, 21); this.txtExt.Size = new System.Drawing.Size(116, 21);
this.txtExt.Text = ".tem,.shp"; this.txtExt.Text = ".tem,.shp";
// //
// toolStripLabel6 // toolStripLabel6
// //
this.toolStripLabel6.Name = "toolStripLabel6"; this.toolStripLabel6.Name = "toolStripLabel6";
this.toolStripLabel6.Size = new System.Drawing.Size(118, 13); this.toolStripLabel6.Size = new System.Drawing.Size(118, 13);
this.toolStripLabel6.Text = "Palette:"; this.toolStripLabel6.Text = "Palette:";
// //
// txtPal // txtPal
// //
this.txtPal.Name = "txtPal"; this.txtPal.Name = "txtPal";
this.txtPal.ReadOnly = true; this.txtPal.ReadOnly = true;
this.txtPal.Size = new System.Drawing.Size(116, 21); this.txtPal.Size = new System.Drawing.Size(116, 21);
this.txtPal.Text = "temperat.pal"; this.txtPal.Text = "temperat.pal";
// //
// toolStripSeparator5 // toolStripSeparator5
// //
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(118, 6); this.toolStripSeparator5.Size = new System.Drawing.Size(118, 6);
// //
// toolStripLabel2 // toolStripLabel2
// //
this.toolStripLabel2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.toolStripLabel2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
this.toolStripLabel2.Name = "toolStripLabel2"; this.toolStripLabel2.Name = "toolStripLabel2";
this.toolStripLabel2.Size = new System.Drawing.Size(118, 13); this.toolStripLabel2.Size = new System.Drawing.Size(118, 13);
this.toolStripLabel2.Text = "Terrain type"; this.toolStripLabel2.Text = "Terrain type";
// //
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(118, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(118, 6);
// //
// toolStripButton1 // toolStripButton1
// //
this.toolStripButton1.Checked = true; this.toolStripButton1.Checked = true;
this.toolStripButton1.CheckState = System.Windows.Forms.CheckState.Checked; this.toolStripButton1.CheckState = System.Windows.Forms.CheckState.Checked;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1"; this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(118, 20); this.toolStripButton1.Size = new System.Drawing.Size(118, 20);
this.toolStripButton1.Text = "Template Tool"; this.toolStripButton1.Text = "Template Tool";
this.toolStripButton1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.toolStripButton1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.toolStripButton1.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); this.toolStripButton1.Click += new System.EventHandler(this.TerrainTypeSelectorClicked);
// //
// toolStrip1 // toolStrip1
// //
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton15, this.toolStripButton15,
this.toolStripButton2, this.toolStripButton2,
this.toolStripButton14, this.toolStripButton14,
this.toolStripButton16, this.toolStripButton16,
this.toolStripSeparator1, this.toolStripSeparator1,
this.toolStripButton3}); this.toolStripButton3});
this.toolStrip1.Location = new System.Drawing.Point(3, 0); this.toolStrip1.Location = new System.Drawing.Point(3, 0);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(275, 25); this.toolStrip1.Size = new System.Drawing.Size(275, 25);
this.toolStrip1.TabIndex = 0; this.toolStrip1.TabIndex = 0;
// //
// toolStripButton15 // toolStripButton15
// //
this.toolStripButton15.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton15.Image"))); this.toolStripButton15.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton15.Image")));
this.toolStripButton15.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton15.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton15.Name = "toolStripButton15"; this.toolStripButton15.Name = "toolStripButton15";
this.toolStripButton15.Size = new System.Drawing.Size(48, 22); this.toolStripButton15.Size = new System.Drawing.Size(48, 22);
this.toolStripButton15.Text = "New"; this.toolStripButton15.Text = "New";
this.toolStripButton15.ToolTipText = "Create new tileset"; this.toolStripButton15.ToolTipText = "Create new tileset";
this.toolStripButton15.Click += new System.EventHandler(this.toolStripButton15_Click); this.toolStripButton15.Click += new System.EventHandler(this.NewTilesetButton);
// //
// toolStripButton2 // toolStripButton2
// //
this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton2.Name = "toolStripButton2"; this.toolStripButton2.Name = "toolStripButton2";
this.toolStripButton2.Size = new System.Drawing.Size(51, 22); this.toolStripButton2.Size = new System.Drawing.Size(51, 22);
this.toolStripButton2.Text = "Save"; this.toolStripButton2.Text = "Save";
this.toolStripButton2.ToolTipText = "Save Template definitions to file (*.tsx)"; this.toolStripButton2.ToolTipText = "Save Template definitions to file (*.tsx)";
this.toolStripButton2.Click += new System.EventHandler(this.SaveClicked); this.toolStripButton2.Click += new System.EventHandler(this.SaveClicked);
// //
// toolStripButton14 // toolStripButton14
// //
this.toolStripButton14.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton14.Image"))); this.toolStripButton14.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton14.Image")));
this.toolStripButton14.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton14.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton14.Name = "toolStripButton14"; this.toolStripButton14.Name = "toolStripButton14";
this.toolStripButton14.Size = new System.Drawing.Size(59, 22); this.toolStripButton14.Size = new System.Drawing.Size(59, 22);
this.toolStripButton14.Text = "Export"; this.toolStripButton14.Text = "Export";
this.toolStripButton14.ToolTipText = "Export defined Templates to files"; this.toolStripButton14.ToolTipText = "Export defined Templates to files";
this.toolStripButton14.Click += new System.EventHandler(this.ExportClicked); this.toolStripButton14.Click += new System.EventHandler(this.ExportClicked);
// //
// toolStripButton16 // toolStripButton16
// //
this.toolStripButton16.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton14.Image"))); this.toolStripButton16.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton14.Image")));
this.toolStripButton16.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton16.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton16.Name = "toolStripButton16"; this.toolStripButton16.Name = "toolStripButton16";
this.toolStripButton16.Size = new System.Drawing.Size(65, 22); this.toolStripButton16.Size = new System.Drawing.Size(65, 22);
this.toolStripButton16.Text = "Dump"; this.toolStripButton16.Text = "Dump";
this.toolStripButton16.ToolTipText = "Dump Template ID to tile number mapping to console"; this.toolStripButton16.ToolTipText = "Dump Template ID to tile number mapping to console";
this.toolStripButton16.Click += new System.EventHandler(this.Export2Clicked); this.toolStripButton16.Click += new System.EventHandler(this.Export2Clicked);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
// //
// toolStripButton3 // toolStripButton3
// //
this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image")));
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton3.Name = "toolStripButton3"; this.toolStripButton3.Name = "toolStripButton3";
this.toolStripButton3.Size = new System.Drawing.Size(70, 22); this.toolStripButton3.Size = new System.Drawing.Size(70, 22);
this.toolStripButton3.Text = "Overlays"; this.toolStripButton3.Text = "Overlays";
this.toolStripButton3.ToolTipText = "Show/hide terrain type overlays"; this.toolStripButton3.ToolTipText = "Show/hide terrain type overlays";
this.toolStripButton3.CheckOnClick = true; this.toolStripButton3.CheckOnClick = true;
this.toolStripButton3.Click += new System.EventHandler(this.ShowOverlaysClicked); this.toolStripButton3.Click += new System.EventHandler(this.ShowOverlaysClicked);
// //
// surface1 // surface1
// //
this.surface1.BackColor = System.Drawing.Color.Black; this.surface1.BackColor = System.Drawing.Color.Black;
this.surface1.ImagesList = this.imageList; this.surface1.ImagesList = this.ImageList;
this.surface1.Location = new System.Drawing.Point(0, 0); this.surface1.Location = new System.Drawing.Point(0, 0);
this.surface1.Name = "surface1"; this.surface1.Name = "surface1";
this.surface1.ShowTerrainTypes = this.toolStripButton3.Checked; this.surface1.ShowTerrainTypes = this.toolStripButton3.Checked;
this.surface1.Size = new System.Drawing.Size(653, 454); this.surface1.Size = new System.Drawing.Size(653, 454);
this.surface1.TabIndex = 2; this.surface1.TabIndex = 2;
this.surface1.Text = "surface1"; this.surface1.Text = "surface1";
// //
// frmBuilder // frmBuilder
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(908, 596); this.ClientSize = new System.Drawing.Size(908, 596);
this.Controls.Add(this.toolStripContainer1); this.Controls.Add(this.toolStripContainer1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmBuilder"; this.Name = "frmBuilder";
this.Text = "Tileset Builder 2"; this.Text = "Tileset Builder 2";
this.toolStripContainer1.ContentPanel.ResumeLayout(false); this.toolStripContainer1.ContentPanel.ResumeLayout(false);
this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false); this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
this.toolStripContainer1.TopToolStripPanel.PerformLayout(); this.toolStripContainer1.TopToolStripPanel.PerformLayout();
this.toolStripContainer1.ResumeLayout(false); this.toolStripContainer1.ResumeLayout(false);
this.toolStripContainer1.PerformLayout(); this.toolStripContainer1.PerformLayout();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.tsTerrainTypes.ResumeLayout(false); this.terrainTypes.ResumeLayout(false);
this.tsTerrainTypes.PerformLayout(); this.terrainTypes.PerformLayout();
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.ToolStripContainer toolStripContainer1; private System.Windows.Forms.ToolStripContainer toolStripContainer1;
private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton2; private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton toolStripButton3; private System.Windows.Forms.ToolStripButton toolStripButton3;
private System.Windows.Forms.ToolStripButton toolStripButton14; private System.Windows.Forms.ToolStripButton toolStripButton14;
private System.Windows.Forms.ToolStripButton toolStripButton15; private System.Windows.Forms.ToolStripButton toolStripButton15;
private System.Windows.Forms.ToolStripButton toolStripButton16; private System.Windows.Forms.ToolStripButton toolStripButton16;
public System.Windows.Forms.ImageList imageList; public System.Windows.Forms.ImageList ImageList;
private System.Windows.Forms.ToolStrip tsTerrainTypes; private System.Windows.Forms.ToolStrip terrainTypes;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private Surface surface1; private Surface surface1;
private System.Windows.Forms.ToolStripLabel toolStripLabel2; private System.Windows.Forms.ToolStripLabel toolStripLabel2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripButton toolStripButton1; private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripLabel toolStripLabel3; private System.Windows.Forms.ToolStripLabel toolStripLabel3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripLabel toolStripLabel4; private System.Windows.Forms.ToolStripLabel toolStripLabel4;
private System.Windows.Forms.ToolStripTextBox txtTilesetName; private System.Windows.Forms.ToolStripTextBox txtTilesetName;
private System.Windows.Forms.ToolStripLabel toolStripLabel5; private System.Windows.Forms.ToolStripLabel toolStripLabel5;
private System.Windows.Forms.ToolStripTextBox txtID; private System.Windows.Forms.ToolStripTextBox txtID;
private System.Windows.Forms.ToolStripLabel lblExt; private System.Windows.Forms.ToolStripLabel lblExt;
private System.Windows.Forms.ToolStripTextBox txtExt; private System.Windows.Forms.ToolStripTextBox txtExt;
private System.Windows.Forms.ToolStripLabel toolStripLabel6; private System.Windows.Forms.ToolStripLabel toolStripLabel6;
private System.Windows.Forms.ToolStripTextBox txtPal; private System.Windows.Forms.ToolStripTextBox txtPal;
} }
} }

View File

@@ -14,19 +14,19 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Runtime.InteropServices;
using OpenRA.FileFormats; using OpenRA.FileFormats;
namespace OpenRA.TilesetBuilder namespace OpenRA.TilesetBuilder
{ {
public partial class frmBuilder : Form public partial class FormBuilder : Form
{ {
string srcfile; string srcfile;
int size; int size;
public TerrainTypeInfo[] TerrainType; public TerrainTypeInfo[] TerrainType;
public Palette tpal; public Palette TerrainPalette;
public bool PaletteFromImage = true; public bool PaletteFromImage = true;
public string PaletteFile = ""; public string PaletteFile = "";
public string ImageFile = ""; public string ImageFile = "";
@@ -40,13 +40,13 @@ namespace OpenRA.TilesetBuilder
public void CreateNewTileset() public void CreateNewTileset()
{ {
this.Show(); this.Show();
using (var fNew = new frmNew { }) using (var formNew = new FormNew { })
if (DialogResult.OK == fNew.ShowDialog()) if (DialogResult.OK == formNew.ShowDialog())
{ {
PaletteFromImage = fNew.PaletteFromImage; PaletteFromImage = formNew.PaletteFromImage;
PaletteFile = fNew.PaletteFile; PaletteFile = formNew.PaletteFile;
ImageFile = fNew.ImageFile; ImageFile = formNew.ImageFile;
TileSize = fNew.TileSize; TileSize = formNew.TileSize;
srcfile = ImageFile; srcfile = ImageFile;
this.size = TileSize; this.size = TileSize;
@@ -56,12 +56,12 @@ namespace OpenRA.TilesetBuilder
Bitmap rbitmap = fbitmap.Clone(new Rectangle(0, 0, fbitmap.Width, fbitmap.Height), Bitmap rbitmap = fbitmap.Clone(new Rectangle(0, 0, fbitmap.Width, fbitmap.Height),
fbitmap.PixelFormat); fbitmap.PixelFormat);
int[] ShadowIndex = { }; int[] shadowIndex = { };
if (!PaletteFromImage) if (!PaletteFromImage)
{ {
tpal = Palette.Load(PaletteFile, ShadowIndex); TerrainPalette = Palette.Load(PaletteFile, shadowIndex);
rbitmap.Palette = tpal.AsSystemPalette(); rbitmap.Palette = TerrainPalette.AsSystemPalette();
} }
surface1.Image = (Bitmap)rbitmap; surface1.Image = (Bitmap)rbitmap;
@@ -75,18 +75,18 @@ namespace OpenRA.TilesetBuilder
} }
} }
public frmBuilder(string src, string tsize, bool AutoExport, string OutputDir) public FormBuilder(string src, string tsize, bool autoExport, string outputDir)
{ {
InitializeComponent(); InitializeComponent();
Dictionary<string, TerrainTypeInfo> DefTerrain = new Dictionary<string, TerrainTypeInfo>(); Dictionary<string, TerrainTypeInfo> terrainDefinition = new Dictionary<string, TerrainTypeInfo>();
int size = int.Parse(tsize); int size = int.Parse(tsize);
var yaml = MiniYaml.DictFromFile("OpenRA.TilesetBuilder/defaults.yaml"); var yaml = MiniYaml.DictFromFile("OpenRA.TilesetBuilder/defaults.yaml");
DefTerrain = yaml["Terrain"].NodesDict.Values.Select(y => new TerrainTypeInfo(y)).ToDictionary(t => t.Type); terrainDefinition = yaml["Terrain"].NodesDict.Values.Select(y => new TerrainTypeInfo(y)).ToDictionary(t => t.Type);
int i = 0; int i = 0;
surface1.icon = new Bitmap[DefTerrain.Keys.Count]; surface1.Icon = new Bitmap[terrainDefinition.Keys.Count];
TerrainType = new TerrainTypeInfo[DefTerrain.Keys.Count]; TerrainType = new TerrainTypeInfo[terrainDefinition.Keys.Count];
var title = this.Text; var title = this.Text;
surface1.UpdateMouseTilePosition += (x, y, tileNr) => surface1.UpdateMouseTilePosition += (x, y, tileNr) =>
@@ -95,29 +95,30 @@ namespace OpenRA.TilesetBuilder
}; };
surface1.Enabled = false; surface1.Enabled = false;
foreach (var deftype in DefTerrain) foreach (var deftype in terrainDefinition)
{ {
Bitmap icon = new Bitmap(16, 16); var icon = new Bitmap(16, 16);
int x, y;
// Loop through the images pixels to reset color. // Loop through the images pixels to reset color.
for (x = 0; x < icon.Width; x++) for (var x = 0; x < icon.Width; x++)
{ {
for (y = 0; y < icon.Height; y++) for (var y = 0; y < icon.Height; y++)
{ {
Color newColor = deftype.Value.Color; Color newColor = deftype.Value.Color;
icon.SetPixel(x, y, newColor); icon.SetPixel(x, y, newColor);
} }
} }
surface1.icon[i] = icon;
surface1.Icon[i] = icon;
TerrainType[i] = deftype.Value; TerrainType[i] = deftype.Value;
ToolStripButton TerrainTypeButton = new ToolStripButton(deftype.Key, icon, TerrainTypeSelectorClicked); var terrainTypeButton = new ToolStripButton(deftype.Key, icon, TerrainTypeSelectorClicked);
TerrainTypeButton.ToolTipText = deftype.Key; terrainTypeButton.ToolTipText = deftype.Key;
TerrainTypeButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; terrainTypeButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
TerrainTypeButton.Tag = i.ToString(); terrainTypeButton.Tag = i.ToString();
TerrainTypeButton.ImageAlign = ContentAlignment.MiddleLeft; terrainTypeButton.ImageAlign = ContentAlignment.MiddleLeft;
i++; i++;
tsTerrainTypes.Items.Add(TerrainTypeButton); terrainTypes.Items.Add(terrainTypeButton);
} }
if (src.Length > 0) if (src.Length > 0)
@@ -139,9 +140,9 @@ namespace OpenRA.TilesetBuilder
CreateNewTileset(); CreateNewTileset();
} }
if (AutoExport) if (autoExport)
{ {
Export(OutputDir); Export(outputDir);
Application.Exit(); Application.Exit();
} }
} }
@@ -173,7 +174,7 @@ namespace OpenRA.TilesetBuilder
public void Save() public void Save()
{ {
using (var w = XmlWriter.Create(Path.ChangeExtension(srcfile,"tsx"), using (var w = XmlWriter.Create(Path.ChangeExtension(srcfile, "tsx"),
new XmlWriterSettings { Indent = true, IndentChars = " " })) new XmlWriterSettings { Indent = true, IndentChars = " " }))
{ {
var tilesetName = txtTilesetName.Text; var tilesetName = txtTilesetName.Text;
@@ -187,8 +188,8 @@ namespace OpenRA.TilesetBuilder
w.WriteAttributeString("value", tilesetName); w.WriteAttributeString("value", tilesetName);
w.WriteEndElement(); w.WriteEndElement();
for( var i = 0; i <= surface1.TerrainTypes.GetUpperBound(0); i++ ) for (var i = 0; i <= surface1.TerrainTypes.GetUpperBound(0); i++)
for( var j = 0; j <= surface1.TerrainTypes.GetUpperBound(1); j++ ) for (var j = 0; j <= surface1.TerrainTypes.GetUpperBound(1); j++)
if (surface1.TerrainTypes[i, j] != 0) if (surface1.TerrainTypes[i, j] != 0)
{ {
w.WriteStartElement("terrain"); w.WriteStartElement("terrain");
@@ -254,15 +255,15 @@ namespace OpenRA.TilesetBuilder
string ExportTemplate(Template t, int n, string suffix, string dir) string ExportTemplate(Template t, int n, string suffix, string dir)
{ {
var TileSize = size; var tileSize = size;
var filename = Path.Combine(dir, "{0}{1:00}{2}".F(txtTilesetName.Text, n, suffix)); var filename = Path.Combine(dir, "{0}{1:00}{2}".F(txtTilesetName.Text, n, suffix));
var totalTiles = t.Width * t.Height; var totalTiles = t.Width * t.Height;
var ms = new MemoryStream(); var ms = new MemoryStream();
using (var bw = new BinaryWriter(ms)) using (var bw = new BinaryWriter(ms))
{ {
bw.Write((ushort)TileSize); bw.Write((ushort)tileSize);
bw.Write((ushort)TileSize); bw.Write((ushort)tileSize);
bw.Write((uint)totalTiles); bw.Write((uint)totalTiles);
bw.Write((ushort)t.Width); bw.Write((ushort)t.Width);
bw.Write((ushort)t.Height); bw.Write((ushort)t.Height);
@@ -290,16 +291,15 @@ namespace OpenRA.TilesetBuilder
{ {
if (t.Cells.ContainsKey(new int2(u + t.Left, v + t.Top))) if (t.Cells.ContainsKey(new int2(u + t.Left, v + t.Top)))
{ {
byte* q = p + data.Stride * TileSize * (v + t.Top) + TileSize * (u + t.Left); byte* q = p + data.Stride * tileSize * (v + t.Top) + tileSize * (u + t.Left);
for (var j = 0; j < TileSize; j++) for (var j = 0; j < tileSize; j++)
for (var i = 0; i < TileSize; i++) for (var i = 0; i < tileSize; i++)
{ {
bw.Write(q[i + j * data.Stride]); bw.Write(q[i + j * data.Stride]);
} }
} }
else else
for (var x = 0; x < TileSize * TileSize; x++) for (var x = 0; x < tileSize * tileSize; x++)
bw.Write((byte)0); /* TODO: don't fill with air */ bw.Write((byte)0); /* TODO: don't fill with air */
} }
} }
@@ -317,7 +317,7 @@ namespace OpenRA.TilesetBuilder
bw.Flush(); bw.Flush();
var flagsStart = ms.Position; var flagsStart = ms.Position;
for (var x = 0; x < totalTiles; x++ ) for (var x = 0; x < totalTiles; x++)
bw.Write((byte)0); bw.Write((byte)0);
bw.Flush(); bw.Flush();
@@ -334,12 +334,13 @@ namespace OpenRA.TilesetBuilder
File.WriteAllBytes(filename, bytes); File.WriteAllBytes(filename, bytes);
} }
return filename; return filename;
} }
public void Export (string OutputDir) public void Export(string outputDir)
{ {
var dir = Path.Combine(Path.GetDirectoryName(srcfile), Platform.SupportDir+OutputDir); var dir = Path.Combine(Path.GetDirectoryName(srcfile), Platform.SupportDir + outputDir);
Directory.CreateDirectory(dir); Directory.CreateDirectory(dir);
var tilesetName = txtTilesetName.Text; var tilesetName = txtTilesetName.Text;
var tilesetID = txtID.Text; var tilesetID = txtID.Text;
@@ -350,30 +351,24 @@ namespace OpenRA.TilesetBuilder
if (tilesetID.Length < 1) { tilesetID = "TEMPERAT"; } if (tilesetID.Length < 1) { tilesetID = "TEMPERAT"; }
if (tilesetPalette.Length < 1) { tilesetPalette = "temperat"; } if (tilesetPalette.Length < 1) { tilesetPalette = "temperat"; }
if (tilesetExt.Length < 1) { tilesetExt = ".tem,.shp"; } if (tilesetExt.Length < 1) { tilesetExt = ".tem,.shp"; }
// Create a Tileset definition // Create a Tileset definition
// TODO: Pull this info from the GUI // TODO: Pull this info from the GUI
var tilesetFile = ""; var tilesetFile = "";
//var mixFile = "";
tilesetFile = tilesetName.ToLower(); tilesetFile = tilesetName.ToLower();
if (tilesetFile.Length < 8) if (tilesetFile.Length < 8)
{
tilesetFile = tilesetName.ToLower() + ".yaml"; tilesetFile = tilesetName.ToLower() + ".yaml";
//mixFile = tilesetName.ToLower() + ".mix";
}
else else
{
tilesetFile = tilesetName.ToLower().Substring(0, 8) + ".yaml"; tilesetFile = tilesetName.ToLower().Substring(0, 8) + ".yaml";
//mixFile = tilesetName.ToLower().Substring(0, 8) + ".mix";
}
string[] Ext = tilesetExt.Split(','); var ext = tilesetExt.Split(',');
var tileset = new TileSet() var tileset = new TileSet()
{ {
Name = tilesetName, Name = tilesetName,
Id = tilesetID.ToUpper(), Id = tilesetID.ToUpper(),
TileSize = size, TileSize = size,
Palette = tilesetPalette.ToLower(), Palette = tilesetPalette.ToLower(),
Extensions = new string[] { Ext[0], Ext[1] } Extensions = new string[] { ext[0], ext[1] }
}; };
// List of files to add to the mix file // List of files to add to the mix file
@@ -401,14 +396,14 @@ namespace OpenRA.TilesetBuilder
{ {
Id = cur, Id = cur,
Image = "{0}{1:00}".F(txtTilesetName.Text, cur), Image = "{0}{1:00}".F(txtTilesetName.Text, cur),
Size = new int2(tp.Width,tp.Height), Size = new int2(tp.Width, tp.Height),
}; };
foreach (var t in tp.Cells) foreach (var t in tp.Cells)
{ {
string ttype = "Clear"; string ttype = "Clear";
ttype = TerrainType[surface1.TerrainTypes[t.Key.X, t.Key.Y]].Type; ttype = TerrainType[surface1.TerrainTypes[t.Key.X, t.Key.Y]].Type;
var idx = ((t.Key.X - tp.Left) + tp.Width * (t.Key.Y - tp.Top)); var idx = (t.Key.X - tp.Left) + tp.Width * (t.Key.Y - tp.Top);
template.Tiles.Add((byte)idx, ttype); template.Tiles.Add((byte)idx, ttype);
} }
@@ -417,13 +412,6 @@ namespace OpenRA.TilesetBuilder
} }
tileset.Save(Path.Combine(dir, tilesetFile)); tileset.Save(Path.Combine(dir, tilesetFile));
//throw new NotImplementedException("NotI");
//PackageWriter.CreateMix(Path.Combine(dir, mixFile),fileList);
// Cleanup
//foreach (var file in fileList)
//File.Delete(file);
Console.WriteLine("Finished export"); Console.WriteLine("Finished export");
} }
@@ -437,7 +425,7 @@ namespace OpenRA.TilesetBuilder
{ {
foreach (var t in tp.Cells) foreach (var t in tp.Cells)
{ {
var idx = ((t.Key.X - tp.Left) + tp.Width * (t.Key.Y - tp.Top)); var idx = (t.Key.X - tp.Left) + tp.Width * (t.Key.Y - tp.Top);
// TemplateID CellID tilenr TemplateW TemplateH XinTilesPNG YinTilesPNG // TemplateID CellID tilenr TemplateW TemplateH XinTilesPNG YinTilesPNG
Console.WriteLine("{0} {1} {2} {3} {4} {5} {6}", Console.WriteLine("{0} {1} {2} {3} {4} {5} {6}",
@@ -447,8 +435,7 @@ namespace OpenRA.TilesetBuilder
tp.Width, tp.Width,
tp.Height, tp.Height,
t.Key.X, t.Key.X,
t.Key.Y t.Key.Y);
);
} }
cur++; cur++;
@@ -457,23 +444,14 @@ namespace OpenRA.TilesetBuilder
Console.WriteLine("# end\n"); Console.WriteLine("# end\n");
} }
private void toolStripContainer1_TopToolStripPanel_Click(object sender, EventArgs e) private void TilesetNameChanged(object sender, EventArgs e)
{
}
private void surface1_Click(object sender, EventArgs e)
{
}
private void txtTilesetName_TextChanged(object sender, EventArgs e)
{ {
var tilesetFile = txtTilesetName.Text; var tilesetFile = txtTilesetName.Text;
if (tilesetFile.Length > 8) if (tilesetFile.Length > 8)
{ {
tilesetFile = tilesetFile.ToLower().Substring(0, 8); tilesetFile = tilesetFile.ToLower().Substring(0, 8);
} }
txtID.Text = tilesetFile.ToUpper(); txtID.Text = tilesetFile.ToUpper();
txtPal.Text = tilesetFile.ToLower() + ".pal"; txtPal.Text = tilesetFile.ToLower() + ".pal";
if (tilesetFile.Length < 3) if (tilesetFile.Length < 3)
@@ -486,7 +464,7 @@ namespace OpenRA.TilesetBuilder
} }
} }
private void toolStripButton15_Click(object sender, EventArgs e) private void NewTilesetButton(object sender, EventArgs e)
{ {
CreateNewTileset(); CreateNewTileset();
} }

View File

@@ -1,228 +1,229 @@
namespace OpenRA.TilesetBuilder namespace OpenRA.TilesetBuilder
{ {
partial class frmNew partial class FormNew
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing);
} base.Dispose(disposing);
}
#region Windows Form Designer generated code
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify /// <summary>
/// the contents of this method with the code editor. /// Required method for Designer support - do not modify
/// </summary> /// the contents of this method with the code editor.
private void InitializeComponent() /// </summary>
{ private void InitializeComponent()
this.numSize = new System.Windows.Forms.NumericUpDown(); {
this.label1 = new System.Windows.Forms.Label(); this.numSize = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.txtPal = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label();
this.btnPalBrowse = new System.Windows.Forms.Button(); this.txtPal = new System.Windows.Forms.TextBox();
this.chkUsePalFromImage = new System.Windows.Forms.CheckBox(); this.btnPalBrowse = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); this.chkUsePalFromImage = new System.Windows.Forms.CheckBox();
this.imgImage = new System.Windows.Forms.PictureBox(); this.label3 = new System.Windows.Forms.Label();
this.btnImgBrowse = new System.Windows.Forms.Button(); this.imgImage = new System.Windows.Forms.PictureBox();
this.txtImage = new System.Windows.Forms.TextBox(); this.btnImgBrowse = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button(); this.txtImage = new System.Windows.Forms.TextBox();
this.btnOk = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.numSize)).BeginInit(); this.btnOk = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.imgImage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numSize)).BeginInit();
this.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.imgImage)).BeginInit();
// this.SuspendLayout();
// numSize //
// // numSize
this.numSize.Location = new System.Drawing.Point(66, 6); //
this.numSize.Maximum = new decimal(new int[] { this.numSize.Location = new System.Drawing.Point(66, 6);
264, this.numSize.Maximum = new decimal(new int[] {
0, 264,
0, 0,
0}); 0,
this.numSize.Minimum = new decimal(new int[] { 0});
24, this.numSize.Minimum = new decimal(new int[] {
0, 24,
0, 0,
0}); 0,
this.numSize.Name = "numSize"; 0});
this.numSize.Size = new System.Drawing.Size(49, 20); this.numSize.Name = "numSize";
this.numSize.TabIndex = 0; this.numSize.Size = new System.Drawing.Size(49, 20);
this.numSize.Value = new decimal(new int[] { this.numSize.TabIndex = 0;
24, this.numSize.Value = new decimal(new int[] {
0, 24,
0, 0,
0}); 0,
this.numSize.ValueChanged += new System.EventHandler(this.numSize_ValueChanged); 0});
// this.numSize.ValueChanged += new System.EventHandler(this.NumSizeValueChanged);
// label1 //
// // label1
this.label1.AutoSize = true; //
this.label1.Location = new System.Drawing.Point(12, 9); this.label1.AutoSize = true;
this.label1.Name = "label1"; this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Size = new System.Drawing.Size(48, 13); this.label1.Name = "label1";
this.label1.TabIndex = 1; this.label1.Size = new System.Drawing.Size(48, 13);
this.label1.Text = "Tile size:"; this.label1.TabIndex = 1;
// this.label1.Text = "Tile size:";
// label2 //
// // label2
this.label2.AutoSize = true; //
this.label2.Location = new System.Drawing.Point(12, 34); this.label2.AutoSize = true;
this.label2.Name = "label2"; this.label2.Location = new System.Drawing.Point(12, 34);
this.label2.Size = new System.Drawing.Size(43, 13); this.label2.Name = "label2";
this.label2.TabIndex = 2; this.label2.Size = new System.Drawing.Size(43, 13);
this.label2.Text = "Palette:"; this.label2.TabIndex = 2;
// this.label2.Text = "Palette:";
// txtPal //
// // txtPal
this.txtPal.Location = new System.Drawing.Point(15, 52); //
this.txtPal.Name = "txtPal"; this.txtPal.Location = new System.Drawing.Point(15, 52);
this.txtPal.ReadOnly = true; this.txtPal.Name = "txtPal";
this.txtPal.Size = new System.Drawing.Size(267, 20); this.txtPal.ReadOnly = true;
this.txtPal.TabIndex = 3; this.txtPal.Size = new System.Drawing.Size(267, 20);
// this.txtPal.TabIndex = 3;
// btnPalBrowse //
// // btnPalBrowse
this.btnPalBrowse.Enabled = false; //
this.btnPalBrowse.Location = new System.Drawing.Point(288, 50); this.btnPalBrowse.Enabled = false;
this.btnPalBrowse.Name = "btnPalBrowse"; this.btnPalBrowse.Location = new System.Drawing.Point(288, 50);
this.btnPalBrowse.Size = new System.Drawing.Size(26, 23); this.btnPalBrowse.Name = "btnPalBrowse";
this.btnPalBrowse.TabIndex = 4; this.btnPalBrowse.Size = new System.Drawing.Size(26, 23);
this.btnPalBrowse.Text = "..."; this.btnPalBrowse.TabIndex = 4;
this.btnPalBrowse.UseVisualStyleBackColor = true; this.btnPalBrowse.Text = "...";
this.btnPalBrowse.Click += new System.EventHandler(this.btnPalBrowse_Click); this.btnPalBrowse.UseVisualStyleBackColor = true;
// this.btnPalBrowse.Click += new System.EventHandler(this.PaletteBrowseClick);
// chkUsePalFromImage //
// // chkUsePalFromImage
this.chkUsePalFromImage.AutoSize = true; //
this.chkUsePalFromImage.Checked = true; this.chkUsePalFromImage.AutoSize = true;
this.chkUsePalFromImage.CheckState = System.Windows.Forms.CheckState.Checked; this.chkUsePalFromImage.Checked = true;
this.chkUsePalFromImage.Location = new System.Drawing.Point(66, 34); this.chkUsePalFromImage.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUsePalFromImage.Name = "chkUsePalFromImage"; this.chkUsePalFromImage.Location = new System.Drawing.Point(66, 34);
this.chkUsePalFromImage.Size = new System.Drawing.Size(134, 17); this.chkUsePalFromImage.Name = "chkUsePalFromImage";
this.chkUsePalFromImage.TabIndex = 5; this.chkUsePalFromImage.Size = new System.Drawing.Size(134, 17);
this.chkUsePalFromImage.Text = "Use palette from image"; this.chkUsePalFromImage.TabIndex = 5;
this.chkUsePalFromImage.UseVisualStyleBackColor = true; this.chkUsePalFromImage.Text = "Use palette from image";
this.chkUsePalFromImage.CheckedChanged += new System.EventHandler(this.chkUsePalFromImage_CheckedChanged); this.chkUsePalFromImage.UseVisualStyleBackColor = true;
// this.chkUsePalFromImage.CheckedChanged += new System.EventHandler(this.UsePaletteFromImageCheckedChanged);
// label3 //
// // label3
this.label3.AutoSize = true; //
this.label3.Location = new System.Drawing.Point(12, 75); this.label3.AutoSize = true;
this.label3.Name = "label3"; this.label3.Location = new System.Drawing.Point(12, 75);
this.label3.Size = new System.Drawing.Size(39, 13); this.label3.Name = "label3";
this.label3.TabIndex = 6; this.label3.Size = new System.Drawing.Size(39, 13);
this.label3.Text = "Image:"; this.label3.TabIndex = 6;
// this.label3.Text = "Image:";
// imgImage //
// // imgImage
this.imgImage.BackColor = System.Drawing.Color.Black; //
this.imgImage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.imgImage.BackColor = System.Drawing.Color.Black;
this.imgImage.Location = new System.Drawing.Point(15, 120); this.imgImage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.imgImage.Name = "imgImage"; this.imgImage.Location = new System.Drawing.Point(15, 120);
this.imgImage.Size = new System.Drawing.Size(299, 219); this.imgImage.Name = "imgImage";
this.imgImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.imgImage.Size = new System.Drawing.Size(299, 219);
this.imgImage.TabIndex = 7; this.imgImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.imgImage.TabStop = false; this.imgImage.TabIndex = 7;
// this.imgImage.TabStop = false;
// btnImgBrowse //
// // btnImgBrowse
this.btnImgBrowse.Location = new System.Drawing.Point(288, 91); //
this.btnImgBrowse.Name = "btnImgBrowse"; this.btnImgBrowse.Location = new System.Drawing.Point(288, 91);
this.btnImgBrowse.Size = new System.Drawing.Size(26, 23); this.btnImgBrowse.Name = "btnImgBrowse";
this.btnImgBrowse.TabIndex = 9; this.btnImgBrowse.Size = new System.Drawing.Size(26, 23);
this.btnImgBrowse.Text = "..."; this.btnImgBrowse.TabIndex = 9;
this.btnImgBrowse.UseVisualStyleBackColor = true; this.btnImgBrowse.Text = "...";
this.btnImgBrowse.Click += new System.EventHandler(this.btnImgBrowse_Click); this.btnImgBrowse.UseVisualStyleBackColor = true;
// this.btnImgBrowse.Click += new System.EventHandler(this.ImageBrowseClick);
// txtImage //
// // txtImage
this.txtImage.Location = new System.Drawing.Point(15, 91); //
this.txtImage.Name = "txtImage"; this.txtImage.Location = new System.Drawing.Point(15, 91);
this.txtImage.ReadOnly = true; this.txtImage.Name = "txtImage";
this.txtImage.Size = new System.Drawing.Size(267, 20); this.txtImage.ReadOnly = true;
this.txtImage.TabIndex = 8; this.txtImage.Size = new System.Drawing.Size(267, 20);
// this.txtImage.TabIndex = 8;
// btnCancel //
// // btnCancel
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; //
this.btnCancel.Location = new System.Drawing.Point(239, 345); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Name = "btnCancel"; this.btnCancel.Location = new System.Drawing.Point(239, 345);
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 10; this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.Text = "Cancel"; this.btnCancel.TabIndex = 10;
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.UseVisualStyleBackColor = true;
// this.btnCancel.Click += new System.EventHandler(this.CancelButtonClick);
// btnOk //
// // btnOk
this.btnOk.Location = new System.Drawing.Point(158, 345); //
this.btnOk.Name = "btnOk"; this.btnOk.Location = new System.Drawing.Point(158, 345);
this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnOk.Name = "btnOk";
this.btnOk.TabIndex = 11; this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.Text = "OK"; this.btnOk.TabIndex = 11;
this.btnOk.UseVisualStyleBackColor = true; this.btnOk.Text = "OK";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click); this.btnOk.UseVisualStyleBackColor = true;
// this.btnOk.Click += new System.EventHandler(this.OkButtonClick);
// frmNew //
// // frmNew
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.CancelButton = this.btnCancel; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(329, 378); this.CancelButton = this.btnCancel;
this.Controls.Add(this.btnOk); this.ClientSize = new System.Drawing.Size(329, 378);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnImgBrowse); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.txtImage); this.Controls.Add(this.btnImgBrowse);
this.Controls.Add(this.imgImage); this.Controls.Add(this.txtImage);
this.Controls.Add(this.label3); this.Controls.Add(this.imgImage);
this.Controls.Add(this.chkUsePalFromImage); this.Controls.Add(this.label3);
this.Controls.Add(this.btnPalBrowse); this.Controls.Add(this.chkUsePalFromImage);
this.Controls.Add(this.txtPal); this.Controls.Add(this.btnPalBrowse);
this.Controls.Add(this.label2); this.Controls.Add(this.txtPal);
this.Controls.Add(this.label1); this.Controls.Add(this.label2);
this.Controls.Add(this.numSize); this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Controls.Add(this.numSize);
this.MaximizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MinimizeBox = false; this.MaximizeBox = false;
this.Name = "frmNew"; this.MinimizeBox = false;
this.ShowIcon = false; this.Name = "frmNew";
this.ShowInTaskbar = false; this.ShowIcon = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "New Tileset"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
((System.ComponentModel.ISupportInitialize)(this.numSize)).EndInit(); this.Text = "New Tileset";
((System.ComponentModel.ISupportInitialize)(this.imgImage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numSize)).EndInit();
this.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.imgImage)).EndInit();
this.PerformLayout(); this.ResumeLayout(false);
this.PerformLayout();
}
}
#endregion
#endregion
private System.Windows.Forms.NumericUpDown numSize;
private System.Windows.Forms.Label label1; private System.Windows.Forms.NumericUpDown numSize;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtPal; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnPalBrowse; private System.Windows.Forms.TextBox txtPal;
private System.Windows.Forms.CheckBox chkUsePalFromImage; private System.Windows.Forms.Button btnPalBrowse;
private System.Windows.Forms.Label label3; private System.Windows.Forms.CheckBox chkUsePalFromImage;
private System.Windows.Forms.PictureBox imgImage; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnImgBrowse; private System.Windows.Forms.PictureBox imgImage;
private System.Windows.Forms.TextBox txtImage; private System.Windows.Forms.Button btnImgBrowse;
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.TextBox txtImage;
private System.Windows.Forms.Button btnOk; private System.Windows.Forms.Button btnCancel;
} private System.Windows.Forms.Button btnOk;
}
} }

View File

@@ -8,24 +8,24 @@ using System.Windows.Forms;
namespace OpenRA.TilesetBuilder namespace OpenRA.TilesetBuilder
{ {
public partial class frmNew : Form public partial class FormNew : Form
{ {
public bool PaletteFromImage = true; public bool PaletteFromImage = true;
public string PaletteFile = ""; public string PaletteFile = "";
public string ImageFile = ""; public string ImageFile = "";
public int TileSize = 24; public int TileSize = 24;
public frmNew() public FormNew()
{ {
InitializeComponent(); InitializeComponent();
} }
private void btnCancel_Click(object sender, EventArgs e) private void CancelButtonClick(object sender, EventArgs e)
{ {
Close(); Close();
} }
private void btnOk_Click(object sender, EventArgs e) private void OkButtonClick(object sender, EventArgs e)
{ {
if (!PaletteFromImage) if (!PaletteFromImage)
{ {
@@ -34,6 +34,7 @@ namespace OpenRA.TilesetBuilder
MessageBox.Show("No palette specified", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show("No palette specified", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
} }
if (ImageFile.Length < 5) if (ImageFile.Length < 5)
{ {
MessageBox.Show("No image selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("No image selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -45,7 +46,7 @@ namespace OpenRA.TilesetBuilder
} }
} }
private void chkUsePalFromImage_CheckedChanged(object sender, EventArgs e) private void UsePaletteFromImageCheckedChanged(object sender, EventArgs e)
{ {
if (chkUsePalFromImage.Checked) if (chkUsePalFromImage.Checked)
{ {
@@ -59,7 +60,7 @@ namespace OpenRA.TilesetBuilder
} }
} }
private void btnPalBrowse_Click(object sender, EventArgs e) private void PaletteBrowseClick(object sender, EventArgs e)
{ {
using (var ofd = new OpenFileDialog { Filter = "C&C Palette (*.pal)|*.pal" }) using (var ofd = new OpenFileDialog { Filter = "C&C Palette (*.pal)|*.pal" })
if (DialogResult.OK == ofd.ShowDialog()) if (DialogResult.OK == ofd.ShowDialog())
@@ -69,7 +70,7 @@ namespace OpenRA.TilesetBuilder
} }
} }
private void btnImgBrowse_Click(object sender, EventArgs e) private void ImageBrowseClick(object sender, EventArgs e)
{ {
using (var ofd = new OpenFileDialog { Filter = "8bit Image (*.png,*.pcx,*.bmp)|*.png;*.pcx;*.bmp" }) using (var ofd = new OpenFileDialog { Filter = "8bit Image (*.png,*.pcx,*.bmp)|*.png;*.pcx;*.bmp" })
if (DialogResult.OK == ofd.ShowDialog()) if (DialogResult.OK == ofd.ShowDialog())
@@ -80,7 +81,7 @@ namespace OpenRA.TilesetBuilder
} }
} }
private void numSize_ValueChanged(object sender, EventArgs e) private void NumSizeValueChanged(object sender, EventArgs e)
{ {
TileSize = (int)numSize.Value; TileSize = (int)numSize.Value;
} }

View File

@@ -74,25 +74,9 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="frmBuilder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmBuilder.Designer.cs">
<DependentUpon>frmBuilder.cs</DependentUpon>
</Compile>
<Compile Include="frmNew.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmNew.Designer.cs">
<DependentUpon>frmNew.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmBuilder.resx">
<DependentUpon>frmBuilder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmNew.resx"> <EmbeddedResource Include="frmNew.resx">
<DependentUpon>frmNew.cs</DependentUpon> <DependentUpon>FormNew.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
@@ -120,6 +104,21 @@
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Template.cs" /> <Compile Include="Template.cs" />
<Compile Include="FormBuilder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormBuilder.Designer.cs">
<DependentUpon>FormBuilder.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FormBuilder.resx">
<DependentUpon>FormBuilder.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="FormNew.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormNew.Designer.cs">
<DependentUpon>FormNew.cs</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -21,17 +21,17 @@ namespace OpenRA.TilesetBuilder
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
//Console.WriteLine("{0} {1} {2} {3}",args[0], args[1], args[2], args[3]);
if (args.Length < 1) if (args.Length < 1)
{ {
Application.Run(new frmBuilder("", "0", false, "Tilesets")); Application.Run(new FormBuilder("", "0", false, "Tilesets"));
} }
else else
{ {
if (args.Contains("--export")) if (args.Contains("--export"))
Application.Run(new frmBuilder(args[0], args[1], true, args[3])); Application.Run(new FormBuilder(args[0], args[1], true, args[3]));
else else
Application.Run(new frmBuilder(args[0], args[1], false, "Tilesets")); Application.Run(new FormBuilder(args[0], args[1], false, "Tilesets"));
} }
} }
} }

View File

@@ -9,31 +9,29 @@ namespace OpenRA.TilesetBuilder
class Surface : Control class Surface : Control
{ {
public Bitmap Image; public Bitmap Image;
private ImageList ImagesListControl;
public int[,] TerrainTypes; public int[,] TerrainTypes;
public List<Template> Templates = new List<Template>(); public List<Template> Templates = new List<Template>();
private bool bShowTerrainTypes;
public string InputMode; public string InputMode;
public Bitmap[] icon; public Bitmap[] Icon;
public int TileSize; public int TileSize;
public int TilesPerRow; public int TilesPerRow;
//private System.ComponentModel.IContainer components;
public event Action<int, int, int> UpdateMouseTilePosition = (x, y, t) => { }; public event Action<int, int, int> UpdateMouseTilePosition = (x, y, t) => { };
Template CurrentTemplate; Template currentTemplate;
ImageList imagesListControl;
bool showTerrainTypes;
public bool ShowTerrainTypes public bool ShowTerrainTypes
{ {
get { return bShowTerrainTypes; } get { return showTerrainTypes; }
set { bShowTerrainTypes = value; } set { showTerrainTypes = value; }
} }
public ImageList ImagesList public ImageList ImagesList
{ {
get { return ImagesListControl; } get { return imagesListControl; }
set { ImagesListControl = value; } set { imagesListControl = value; }
} }
public Surface() public Surface()
@@ -60,12 +58,12 @@ namespace OpenRA.TilesetBuilder
for (var j = 0; j <= TerrainTypes.GetUpperBound(1); j++) for (var j = 0; j <= TerrainTypes.GetUpperBound(1); j++)
if (TerrainTypes[i, j] != 0) if (TerrainTypes[i, j] != 0)
{ {
//e.Graphics.FillRectangle(Brushes.Black, TileSize * i + 8, TileSize * j + 8, 16, 16); ////e.Graphics.FillRectangle(Brushes.Black, TileSize * i + 8, TileSize * j + 8, 16, 16);
e.Graphics.DrawImage(icon[TerrainTypes[i, j]], TileSize * i + 8, TileSize * j + 8, 16, 16); e.Graphics.DrawImage(Icon[TerrainTypes[i, j]], TileSize * i + 8, TileSize * j + 8, 16, 16);
//e.Graphics.DrawString(TerrainTypes[i, j].ToString(), ////e.Graphics.DrawString(TerrainTypes[i, j].ToString(),
//Font, Brushes.LimeGreen, TileSize * i + 10, TileSize * j + 10); ////Font, Brushes.LimeGreen, TileSize * i + 10, TileSize * j + 10);
} }
} }
@@ -76,7 +74,7 @@ namespace OpenRA.TilesetBuilder
foreach (var c in t.Cells.Keys) foreach (var c in t.Cells.Keys)
{ {
if (CurrentTemplate == t) if (currentTemplate == t)
e.Graphics.FillRectangle(currentBrush, TileSize * c.X, TileSize * c.Y, TileSize, TileSize); e.Graphics.FillRectangle(currentBrush, TileSize * c.X, TileSize * c.Y, TileSize, TileSize);
if (!t.Cells.ContainsKey(c + new int2(-1, 0))) if (!t.Cells.ContainsKey(c + new int2(-1, 0)))
@@ -99,9 +97,9 @@ namespace OpenRA.TilesetBuilder
{ {
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
CurrentTemplate = Templates.FirstOrDefault(t => t.Cells.ContainsKey(pos)); currentTemplate = Templates.FirstOrDefault(t => t.Cells.ContainsKey(pos));
if (CurrentTemplate == null) if (currentTemplate == null)
Templates.Add(CurrentTemplate = new Template { Cells = new Dictionary<int2, bool> { { pos, true } } }); Templates.Add(currentTemplate = new Template { Cells = new Dictionary<int2, bool> { { pos, true } } });
Invalidate(); Invalidate();
} }
@@ -109,7 +107,7 @@ namespace OpenRA.TilesetBuilder
if (e.Button == MouseButtons.Right) if (e.Button == MouseButtons.Right)
{ {
Templates.RemoveAll(t => t.Cells.ContainsKey(pos)); Templates.RemoveAll(t => t.Cells.ContainsKey(pos));
CurrentTemplate = null; currentTemplate = null;
Invalidate(); Invalidate();
} }
} }
@@ -126,11 +124,11 @@ namespace OpenRA.TilesetBuilder
if (InputMode == null) if (InputMode == null)
{ {
if (e.Button == MouseButtons.Left && CurrentTemplate != null) if (e.Button == MouseButtons.Left && currentTemplate != null)
{ {
if (!CurrentTemplate.Cells.ContainsKey(pos)) if (!currentTemplate.Cells.ContainsKey(pos))
{ {
CurrentTemplate.Cells[pos] = true; currentTemplate.Cells[pos] = true;
Invalidate(); Invalidate();
} }
} }