diff --git a/src/KleiLib/KleiLib.csproj b/src/KleiLib/KleiLib.csproj
index 6496681..73ef857 100644
--- a/src/KleiLib/KleiLib.csproj
+++ b/src/KleiLib/KleiLib.csproj
@@ -21,7 +21,7 @@
DEBUG;TRACE
prompt
4
- x86
+ AnyCPU
pdbonly
diff --git a/src/TEXTool/MainForm.Designer.cs b/src/TEXTool/MainForm.Designer.cs
index e1c97ea..73e466a 100644
--- a/src/TEXTool/MainForm.Designer.cs
+++ b/src/TEXTool/MainForm.Designer.cs
@@ -56,6 +56,14 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
+ this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.formatToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.sizeToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.mipmapsToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.platformToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.textureTypeToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.imageBox = new Cyotek.Windows.Forms.ImageBox();
this.mainToolStrip = new System.Windows.Forms.ToolStrip();
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
this.saveToolStripButton = new System.Windows.Forms.ToolStripButton();
@@ -67,19 +75,118 @@ private void InitializeComponent()
this.zoomLevelToolStripComboBox = new System.Windows.Forms.ToolStripComboBox();
this.infoToolStripButton = new System.Windows.Forms.ToolStripButton();
this.versionToolStripLabel = new System.Windows.Forms.ToolStripLabel();
- this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.formatToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
- this.sizeToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
- this.mipmapsToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
- this.platformToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
- this.imageBox = new Cyotek.Windows.Forms.ImageBox();
- this.textureTypeToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
- this.mainToolStrip.SuspendLayout();
+ this.atlasElementsToolStrip = new System.Windows.Forms.ToolStrip();
+ this.atlasElementsToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+ this.atlasElementsCountToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementsCountIntToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
+ this.atlasElementsTitleToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementsListToolStripComboBox = new System.Windows.Forms.ToolStripComboBox();
+ this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
+ this.atlasElementBorderColorToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementBorderColors = new System.Windows.Forms.ToolStripComboBox();
+ this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
+ this.atlasElementWidthToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementWidthToolStrip = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementHeightToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementHeightToolStrip = new System.Windows.Forms.ToolStripLabel();
+ this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
+ this.atlasElementXToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementXToolStrip = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementYToolStripLabel = new System.Windows.Forms.ToolStripLabel();
+ this.atlasElementYToolStrip = new System.Windows.Forms.ToolStripLabel();
+ this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
+ this.toolStripContainer1.ContentPanel.SuspendLayout();
+ this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
+ this.toolStripContainer1.SuspendLayout();
this.statusStrip1.SuspendLayout();
+ this.mainToolStrip.SuspendLayout();
+ this.atlasElementsToolStrip.SuspendLayout();
this.SuspendLayout();
//
+ // toolStripContainer1
+ //
+ //
+ // toolStripContainer1.BottomToolStripPanel
+ //
+ this.toolStripContainer1.BottomToolStripPanel.Controls.Add(this.statusStrip1);
+ //
+ // toolStripContainer1.ContentPanel
+ //
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.imageBox);
+ this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(781, 345);
+ 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(781, 417);
+ this.toolStripContainer1.TabIndex = 2;
+ this.toolStripContainer1.Text = "toolStripContainer1";
+ //
+ // toolStripContainer1.TopToolStripPanel
+ //
+ this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.mainToolStrip);
+ this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.atlasElementsToolStrip);
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Dock = System.Windows.Forms.DockStyle.None;
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.formatToolStripStatusLabel,
+ this.sizeToolStripStatusLabel,
+ this.mipmapsToolStripStatusLabel,
+ this.platformToolStripStatusLabel,
+ this.textureTypeToolStripStatusLabel});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 0);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(781, 22);
+ this.statusStrip1.TabIndex = 2;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // formatToolStripStatusLabel
+ //
+ this.formatToolStripStatusLabel.Name = "formatToolStripStatusLabel";
+ this.formatToolStripStatusLabel.Size = new System.Drawing.Size(41, 17);
+ this.formatToolStripStatusLabel.Text = "Format";
+ //
+ // sizeToolStripStatusLabel
+ //
+ this.sizeToolStripStatusLabel.Name = "sizeToolStripStatusLabel";
+ this.sizeToolStripStatusLabel.Size = new System.Drawing.Size(26, 17);
+ this.sizeToolStripStatusLabel.Text = "Size";
+ //
+ // mipmapsToolStripStatusLabel
+ //
+ this.mipmapsToolStripStatusLabel.Name = "mipmapsToolStripStatusLabel";
+ this.mipmapsToolStripStatusLabel.Size = new System.Drawing.Size(48, 17);
+ this.mipmapsToolStripStatusLabel.Text = "Mipmaps";
+ //
+ // platformToolStripStatusLabel
+ //
+ this.platformToolStripStatusLabel.Name = "platformToolStripStatusLabel";
+ this.platformToolStripStatusLabel.Size = new System.Drawing.Size(47, 17);
+ this.platformToolStripStatusLabel.Text = "Platform";
+ //
+ // textureTypeToolStripStatusLabel
+ //
+ this.textureTypeToolStripStatusLabel.Name = "textureTypeToolStripStatusLabel";
+ this.textureTypeToolStripStatusLabel.Size = new System.Drawing.Size(49, 17);
+ this.textureTypeToolStripStatusLabel.Text = "TexType";
+ //
+ // imageBox
+ //
+ this.imageBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.imageBox.Location = new System.Drawing.Point(0, 0);
+ this.imageBox.Name = "imageBox";
+ this.imageBox.Size = new System.Drawing.Size(781, 345);
+ this.imageBox.TabIndex = 3;
+ this.imageBox.ZoomChanged += new System.EventHandler(this.imageBox_ZoomChanged);
+ this.imageBox.ZoomLevelsChanged += new System.EventHandler(this.imageBox_ZoomLevelsChanged);
+ this.imageBox.Paint += new System.Windows.Forms.PaintEventHandler(this.imageBox_Paint);
+ //
// mainToolStrip
//
+ this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripButton,
this.saveToolStripButton,
@@ -93,8 +200,9 @@ private void InitializeComponent()
this.versionToolStripLabel});
this.mainToolStrip.Location = new System.Drawing.Point(0, 0);
this.mainToolStrip.Name = "mainToolStrip";
- this.mainToolStrip.Size = new System.Drawing.Size(694, 25);
- this.mainToolStrip.TabIndex = 0;
+ this.mainToolStrip.Size = new System.Drawing.Size(781, 25);
+ this.mainToolStrip.Stretch = true;
+ this.mainToolStrip.TabIndex = 1;
//
// openToolStripButton
//
@@ -160,6 +268,7 @@ private void InitializeComponent()
//
this.zoomLevelToolStripComboBox.Name = "zoomLevelToolStripComboBox";
this.zoomLevelToolStripComboBox.Size = new System.Drawing.Size(121, 25);
+ this.zoomLevelToolStripComboBox.SelectedIndexChanged += new System.EventHandler(this.zoomLevelToolStripComboBox_SelectedIndexChanged);
//
// infoToolStripButton
//
@@ -176,85 +285,192 @@ private void InitializeComponent()
//
this.versionToolStripLabel.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.versionToolStripLabel.Name = "versionToolStripLabel";
- this.versionToolStripLabel.Size = new System.Drawing.Size(46, 22);
+ this.versionToolStripLabel.Size = new System.Drawing.Size(42, 22);
this.versionToolStripLabel.Text = "Version";
//
- // statusStrip1
+ // atlasElementsToolStrip
//
- this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.formatToolStripStatusLabel,
- this.sizeToolStripStatusLabel,
- this.mipmapsToolStripStatusLabel,
- this.platformToolStripStatusLabel,
- this.textureTypeToolStripStatusLabel});
- this.statusStrip1.Location = new System.Drawing.Point(0, 395);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(694, 22);
- this.statusStrip1.TabIndex = 1;
- this.statusStrip1.Text = "statusStrip1";
+ this.atlasElementsToolStrip.Dock = System.Windows.Forms.DockStyle.None;
+ this.atlasElementsToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.atlasElementsToolStripLabel,
+ this.toolStripSeparator2,
+ this.atlasElementsCountToolStripLabel,
+ this.atlasElementsCountIntToolStripLabel,
+ this.toolStripSeparator3,
+ this.atlasElementsTitleToolStripLabel,
+ this.atlasElementsListToolStripComboBox,
+ this.toolStripSeparator4,
+ this.atlasElementBorderColorToolStripLabel,
+ this.atlasElementBorderColors,
+ this.toolStripSeparator7,
+ this.atlasElementWidthToolStripLabel,
+ this.atlasElementWidthToolStrip,
+ this.atlasElementHeightToolStripLabel,
+ this.atlasElementHeightToolStrip,
+ this.toolStripSeparator5,
+ this.atlasElementXToolStripLabel,
+ this.atlasElementXToolStrip,
+ this.atlasElementYToolStripLabel,
+ this.atlasElementYToolStrip});
+ this.atlasElementsToolStrip.Location = new System.Drawing.Point(0, 25);
+ this.atlasElementsToolStrip.Name = "atlasElementsToolStrip";
+ this.atlasElementsToolStrip.Size = new System.Drawing.Size(781, 25);
+ this.atlasElementsToolStrip.Stretch = true;
+ this.atlasElementsToolStrip.TabIndex = 2;
//
- // formatToolStripStatusLabel
+ // atlasElementsToolStripLabel
//
- this.formatToolStripStatusLabel.Name = "formatToolStripStatusLabel";
- this.formatToolStripStatusLabel.Size = new System.Drawing.Size(45, 17);
- this.formatToolStripStatusLabel.Text = "Format";
+ this.atlasElementsToolStripLabel.Name = "atlasElementsToolStripLabel";
+ this.atlasElementsToolStripLabel.Size = new System.Drawing.Size(81, 22);
+ this.atlasElementsToolStripLabel.Text = "Atlas Elements:";
//
- // sizeToolStripStatusLabel
+ // toolStripSeparator2
//
- this.sizeToolStripStatusLabel.Name = "sizeToolStripStatusLabel";
- this.sizeToolStripStatusLabel.Size = new System.Drawing.Size(27, 17);
- this.sizeToolStripStatusLabel.Text = "Size";
+ this.toolStripSeparator2.Name = "toolStripSeparator2";
+ this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
- // mipmapsToolStripStatusLabel
+ // atlasElementsCountToolStripLabel
//
- this.mipmapsToolStripStatusLabel.Name = "mipmapsToolStripStatusLabel";
- this.mipmapsToolStripStatusLabel.Size = new System.Drawing.Size(57, 17);
- this.mipmapsToolStripStatusLabel.Text = "Mipmaps";
+ this.atlasElementsCountToolStripLabel.Name = "atlasElementsCountToolStripLabel";
+ this.atlasElementsCountToolStripLabel.Size = new System.Drawing.Size(40, 22);
+ this.atlasElementsCountToolStripLabel.Text = "Count:";
//
- // platformToolStripStatusLabel
+ // atlasElementsCountIntToolStripLabel
//
- this.platformToolStripStatusLabel.Name = "platformToolStripStatusLabel";
- this.platformToolStripStatusLabel.Size = new System.Drawing.Size(53, 17);
- this.platformToolStripStatusLabel.Text = "Platform";
+ this.atlasElementsCountIntToolStripLabel.Name = "atlasElementsCountIntToolStripLabel";
+ this.atlasElementsCountIntToolStripLabel.Size = new System.Drawing.Size(13, 22);
+ this.atlasElementsCountIntToolStripLabel.Text = "0";
//
- // imageBox
+ // toolStripSeparator3
//
- this.imageBox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.imageBox.Location = new System.Drawing.Point(0, 25);
- this.imageBox.Name = "imageBox";
- this.imageBox.Size = new System.Drawing.Size(694, 370);
- this.imageBox.TabIndex = 2;
- this.imageBox.ZoomChanged += new System.EventHandler(this.imageBox1_ZoomChanged);
- this.imageBox.ZoomLevelsChanged += new System.EventHandler(this.imageBox1_ZoomLevelsChanged);
+ this.toolStripSeparator3.Name = "toolStripSeparator3";
+ this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
- // textureTypeToolStripStatusLabel
+ // atlasElementsTitleToolStripLabel
//
- this.textureTypeToolStripStatusLabel.Name = "textureTypeToolStripStatusLabel";
- this.textureTypeToolStripStatusLabel.Size = new System.Drawing.Size(51, 17);
- this.textureTypeToolStripStatusLabel.Text = "TexType";
+ this.atlasElementsTitleToolStripLabel.Name = "atlasElementsTitleToolStripLabel";
+ this.atlasElementsTitleToolStripLabel.Size = new System.Drawing.Size(54, 22);
+ this.atlasElementsTitleToolStripLabel.Text = "Elements:";
+ //
+ // atlasElementsListToolStripComboBox
+ //
+ this.atlasElementsListToolStripComboBox.Enabled = false;
+ this.atlasElementsListToolStripComboBox.Name = "atlasElementsListToolStripComboBox";
+ this.atlasElementsListToolStripComboBox.Size = new System.Drawing.Size(121, 25);
+ this.atlasElementsListToolStripComboBox.SelectedIndexChanged += new System.EventHandler(this.atlasElementsListToolStripComboBox_SelectedIndexChanged);
+ //
+ // toolStripSeparator4
+ //
+ this.toolStripSeparator4.Name = "toolStripSeparator4";
+ this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
+ //
+ // atlasElementBorderColorToolStripLabel
+ //
+ this.atlasElementBorderColorToolStripLabel.Name = "atlasElementBorderColorToolStripLabel";
+ this.atlasElementBorderColorToolStripLabel.Size = new System.Drawing.Size(69, 22);
+ this.atlasElementBorderColorToolStripLabel.Text = "Border color:";
+ //
+ // atlasElementBorderColors
+ //
+ this.atlasElementBorderColors.Enabled = false;
+ this.atlasElementBorderColors.Name = "atlasElementBorderColors";
+ this.atlasElementBorderColors.Size = new System.Drawing.Size(121, 25);
+ this.atlasElementBorderColors.SelectedIndexChanged += new System.EventHandler(this.atlasElementBorderColors_SelectedIndexChanged);
+ //
+ // toolStripSeparator7
+ //
+ this.toolStripSeparator7.Name = "toolStripSeparator7";
+ this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25);
+ //
+ // atlasElementWidthToolStripLabel
+ //
+ this.atlasElementWidthToolStripLabel.Name = "atlasElementWidthToolStripLabel";
+ this.atlasElementWidthToolStripLabel.Size = new System.Drawing.Size(39, 22);
+ this.atlasElementWidthToolStripLabel.Text = "Width:";
+ //
+ // atlasElementWidthToolStrip
+ //
+ this.atlasElementWidthToolStrip.Name = "atlasElementWidthToolStrip";
+ this.atlasElementWidthToolStrip.Size = new System.Drawing.Size(13, 22);
+ this.atlasElementWidthToolStrip.Text = "0";
+ //
+ // atlasElementHeightToolStripLabel
+ //
+ this.atlasElementHeightToolStripLabel.Name = "atlasElementHeightToolStripLabel";
+ this.atlasElementHeightToolStripLabel.Size = new System.Drawing.Size(42, 22);
+ this.atlasElementHeightToolStripLabel.Text = "Height:";
+ //
+ // atlasElementHeightToolStrip
+ //
+ this.atlasElementHeightToolStrip.Name = "atlasElementHeightToolStrip";
+ this.atlasElementHeightToolStrip.Size = new System.Drawing.Size(13, 22);
+ this.atlasElementHeightToolStrip.Text = "0";
+ //
+ // toolStripSeparator5
+ //
+ this.toolStripSeparator5.Name = "toolStripSeparator5";
+ this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
+ //
+ // atlasElementXToolStripLabel
+ //
+ this.atlasElementXToolStripLabel.Name = "atlasElementXToolStripLabel";
+ this.atlasElementXToolStripLabel.Size = new System.Drawing.Size(17, 22);
+ this.atlasElementXToolStripLabel.Text = "X:";
+ //
+ // atlasElementXToolStrip
+ //
+ this.atlasElementXToolStrip.Name = "atlasElementXToolStrip";
+ this.atlasElementXToolStrip.Size = new System.Drawing.Size(13, 22);
+ this.atlasElementXToolStrip.Text = "0";
+ //
+ // atlasElementYToolStripLabel
+ //
+ this.atlasElementYToolStripLabel.Name = "atlasElementYToolStripLabel";
+ this.atlasElementYToolStripLabel.Size = new System.Drawing.Size(17, 22);
+ this.atlasElementYToolStripLabel.Text = "Y:";
+ //
+ // atlasElementYToolStrip
+ //
+ this.atlasElementYToolStrip.Name = "atlasElementYToolStrip";
+ this.atlasElementYToolStrip.Size = new System.Drawing.Size(13, 22);
+ this.atlasElementYToolStrip.Text = "0";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(694, 417);
- this.Controls.Add(this.imageBox);
- this.Controls.Add(this.statusStrip1);
- this.Controls.Add(this.mainToolStrip);
+ this.ClientSize = new System.Drawing.Size(781, 417);
+ this.Controls.Add(this.toolStripContainer1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainForm";
this.Text = "KleiStudio - TEXTool";
- this.mainToolStrip.ResumeLayout(false);
- this.mainToolStrip.PerformLayout();
+ this.toolStripContainer1.BottomToolStripPanel.ResumeLayout(false);
+ this.toolStripContainer1.BottomToolStripPanel.PerformLayout();
+ this.toolStripContainer1.ContentPanel.ResumeLayout(false);
+ this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
+ this.toolStripContainer1.TopToolStripPanel.PerformLayout();
+ this.toolStripContainer1.ResumeLayout(false);
+ this.toolStripContainer1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
+ this.mainToolStrip.ResumeLayout(false);
+ this.mainToolStrip.PerformLayout();
+ this.atlasElementsToolStrip.ResumeLayout(false);
+ this.atlasElementsToolStrip.PerformLayout();
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
+ private System.Windows.Forms.ToolStripContainer toolStripContainer1;
+ private System.Windows.Forms.StatusStrip statusStrip1;
+ private System.Windows.Forms.ToolStripStatusLabel formatToolStripStatusLabel;
+ private System.Windows.Forms.ToolStripStatusLabel sizeToolStripStatusLabel;
+ private System.Windows.Forms.ToolStripStatusLabel mipmapsToolStripStatusLabel;
+ private System.Windows.Forms.ToolStripStatusLabel platformToolStripStatusLabel;
+ private System.Windows.Forms.ToolStripStatusLabel textureTypeToolStripStatusLabel;
+ private Cyotek.Windows.Forms.ImageBox imageBox;
private System.Windows.Forms.ToolStrip mainToolStrip;
private System.Windows.Forms.ToolStripButton openToolStripButton;
private System.Windows.Forms.ToolStripButton saveToolStripButton;
@@ -264,15 +480,30 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripButton zoomOutToolStripButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripComboBox zoomLevelToolStripComboBox;
- private System.Windows.Forms.StatusStrip statusStrip1;
- private Cyotek.Windows.Forms.ImageBox imageBox;
private System.Windows.Forms.ToolStripButton infoToolStripButton;
private System.Windows.Forms.ToolStripLabel versionToolStripLabel;
- private System.Windows.Forms.ToolStripStatusLabel formatToolStripStatusLabel;
- private System.Windows.Forms.ToolStripStatusLabel sizeToolStripStatusLabel;
- private System.Windows.Forms.ToolStripStatusLabel mipmapsToolStripStatusLabel;
- private System.Windows.Forms.ToolStripStatusLabel platformToolStripStatusLabel;
- private System.Windows.Forms.ToolStripStatusLabel textureTypeToolStripStatusLabel;
+ private System.Windows.Forms.ToolStrip atlasElementsToolStrip;
+ private System.Windows.Forms.ToolStripLabel atlasElementsToolStripLabel;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
+ private System.Windows.Forms.ToolStripLabel atlasElementsCountToolStripLabel;
+ private System.Windows.Forms.ToolStripLabel atlasElementsCountIntToolStripLabel;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
+ private System.Windows.Forms.ToolStripLabel atlasElementsTitleToolStripLabel;
+ private System.Windows.Forms.ToolStripComboBox atlasElementsListToolStripComboBox;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
+ private System.Windows.Forms.ToolStripLabel atlasElementWidthToolStripLabel;
+ private System.Windows.Forms.ToolStripLabel atlasElementWidthToolStrip;
+ private System.Windows.Forms.ToolStripLabel atlasElementHeightToolStripLabel;
+ private System.Windows.Forms.ToolStripLabel atlasElementHeightToolStrip;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
+ private System.Windows.Forms.ToolStripLabel atlasElementXToolStripLabel;
+ private System.Windows.Forms.ToolStripLabel atlasElementXToolStrip;
+ private System.Windows.Forms.ToolStripLabel atlasElementYToolStripLabel;
+ private System.Windows.Forms.ToolStripLabel atlasElementYToolStrip;
+ private System.Windows.Forms.ToolStripLabel atlasElementBorderColorToolStripLabel;
+ private System.Windows.Forms.ToolStripComboBox atlasElementBorderColors;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
+
}
}
\ No newline at end of file
diff --git a/src/TEXTool/MainForm.cs b/src/TEXTool/MainForm.cs
index 8247692..829788b 100644
--- a/src/TEXTool/MainForm.cs
+++ b/src/TEXTool/MainForm.cs
@@ -29,11 +29,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Reflection;
using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
namespace TEXTool
{
public partial class MainForm : Form
{
public TEXTool Tool;
+ GraphicsPath graphicsPath;
+ float offsetX = 0, offsetY = 0, scaleX = 1, scaleY = 1;
public MainForm()
{
@@ -44,12 +49,41 @@ public MainForm()
InitializeComponent();
FillZoomLevelComboBox();
versionToolStripLabel.Text = string.Format("Version: {0}", Assembly.GetEntryAssembly().GetName().Version);
+
+ foreach (PropertyInfo prop in typeof(Color).GetProperties())
+ {
+ if (prop.PropertyType.FullName == "System.Drawing.Color")
+ {
+ atlasElementBorderColors.ComboBox.Items.Add(prop.Name);
+ }
+ }
+ atlasElementBorderColors.ComboBox.SelectedItem = "Black";
+
+ atlasElementsListToolStripComboBox.ComboBox.DisplayMember = "Name";
}
#region
void tool_FileRawImage(object sender, FileRawImageEventArgs e)
{
+ atlasElementsCountIntToolStripLabel.Text = e.AtlasElements.Count.ToString();
+ atlasElementsListToolStripComboBox.ComboBox.SelectedIndex = -1;
+ atlasElementsListToolStripComboBox.ComboBox.Items.Clear();
+
+ graphicsPath = null;
+ atlasElementsListToolStripComboBox.Enabled = atlasElementBorderColors.Enabled = false;
+ atlasElementWidthToolStrip.Text = atlasElementHeightToolStrip.Text = atlasElementXToolStrip.Text = atlasElementYToolStrip.Text = "0";
+
+ if (e.AtlasElements.Count > 0)
+ {
+ graphicsPath = new GraphicsPath();
+ atlasElementsListToolStripComboBox.Enabled = atlasElementBorderColors.Enabled = true;
+ foreach (KleiTextureAtlasElement el in e.AtlasElements)
+ {
+ atlasElementsListToolStripComboBox.Items.Add(el);
+ }
+ }
+
imageBox.Image = e.Image;
zoomLevelToolStripComboBox.Text = string.Format("{0}%", imageBox.Zoom);
}
@@ -144,12 +178,12 @@ private void infoToolStripButton_Click(object sender, EventArgs e)
#region Misc Form Event Handlers
- private void imageBox1_ZoomLevelsChanged(object sender, EventArgs e)
+ private void imageBox_ZoomLevelsChanged(object sender, EventArgs e)
{
FillZoomLevelComboBox();
}
- private void imageBox1_ZoomChanged(object sender, EventArgs e)
+ private void imageBox_ZoomChanged(object sender, EventArgs e)
{
zoomLevelToolStripComboBox.Text = string.Format("{0}%", imageBox.Zoom);
}
@@ -181,5 +215,92 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
}
#endregion
+
+ #region Dev Custom Functions
+
+ private void DrawRectangle(KleiTextureAtlasElement element)
+ {
+ int x, y, width, height;
+ x = element.ImgHmin;
+ y = element.ImgVmin;
+
+ /* INVERT THE Y-AXIS */
+ if (element.ImgVmin > element.ImgVmax)
+ {
+ y = element.ImgVmax;
+ }
+
+ width = element.ImgHmax - element.ImgHmin;
+ height = Math.Abs(element.ImgVmax - element.ImgVmin);
+
+ graphicsPath = new GraphicsPath();
+ graphicsPath.AddRectangle(new Rectangle(x, y, width, height));
+
+ atlasElementWidthToolStrip.Text = width.ToString();
+ atlasElementHeightToolStrip.Text = height.ToString();
+ atlasElementXToolStrip.Text = x.ToString();
+ atlasElementYToolStrip.Text = y.ToString();
+
+ imageBox.Invalidate();
+ }
+
+ #endregion
+
+ #region Dev Event Handlers
+
+ private void zoomLevelToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (imageBox.Image != null)
+ {
+ int z = int.Parse(zoomLevelToolStripComboBox.SelectedItem.ToString().Replace("%", ""));
+ imageBox.Zoom = z;
+ }
+ }
+
+ private void atlasElementsListToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ var element = (KleiTextureAtlasElement)atlasElementsListToolStripComboBox.ComboBox.SelectedItem;
+ if (element != null)
+ {
+ DrawRectangle(element);
+ }
+ }
+
+ private void atlasElementBorderColors_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (graphicsPath != null)
+ {
+ imageBox.Refresh();
+ }
+ }
+
+ private void imageBox_Paint(object sender, PaintEventArgs e)
+ {
+ if (graphicsPath != null)
+ {
+ scaleX = imageBox.Zoom / 100f;
+ scaleY = imageBox.Zoom / 100f;
+ offsetX = ((imageBox.ClientSize.Width - imageBox.PreferredSize.Width) / 2f);
+ offsetY = ((imageBox.ClientSize.Height - imageBox.PreferredSize.Height) / 2f);
+
+ if (offsetX < 0)
+ {
+ offsetX = -imageBox.HorizontalScroll.Value;
+ }
+ if (offsetY < 0)
+ {
+ offsetY = -imageBox.VerticalScroll.Value;
+ }
+
+ e.Graphics.TranslateTransform(offsetX, offsetY);
+ e.Graphics.ScaleTransform(scaleX, scaleY);
+
+ Color color = Color.FromName(atlasElementBorderColors.ComboBox.SelectedItem.ToString());
+ Pen pen = new Pen(new SolidBrush(color), 5f);
+ e.Graphics.DrawPath(pen, graphicsPath);
+ }
+ }
+
+ #endregion
}
}
diff --git a/src/TEXTool/MainForm.resx b/src/TEXTool/MainForm.resx
index d9af9fa..86d6964 100644
--- a/src/TEXTool/MainForm.resx
+++ b/src/TEXTool/MainForm.resx
@@ -117,11 +117,14 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 375, 17
+
- 17, 17
+ 255, 17
-
- 145, 17
+
+ 485, 17
diff --git a/src/TEXTool/Properties/AssemblyInfo.cs b/src/TEXTool/Properties/AssemblyInfo.cs
index 0e6d631..d2d9487 100644
--- a/src/TEXTool/Properties/AssemblyInfo.cs
+++ b/src/TEXTool/Properties/AssemblyInfo.cs
@@ -40,5 +40,5 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
[assembly: Guid("76bbf4d2-c278-4dae-a48c-18f660bc6e61")]
-[assembly: AssemblyVersion("1.3.0.0")]
+[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/TEXTool/TEXTool.cs b/src/TEXTool/TEXTool.cs
index c160553..5627497 100644
--- a/src/TEXTool/TEXTool.cs
+++ b/src/TEXTool/TEXTool.cs
@@ -33,8 +33,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using KleiLib;
using SquishNET;
+using System.Collections.Generic;
+using System.Xml;
+
namespace TEXTool
{
+ public class KleiTextureAtlasElement
+ {
+ public string Name { get; set; }
+ public int ImgHmin { get; set; }
+ public int ImgHmax { get; set; }
+ public int ImgVmin { get; set; }
+ public int ImgVmax { get; set; }
+
+ public KleiTextureAtlasElement(string name, int u1, int u2, int v1, int v2)
+ {
+ this.Name = name;
+ this.ImgHmin = u1;
+ this.ImgHmax = u2;
+ this.ImgVmin = v1;
+ this.ImgVmax = v2;
+ }
+ }
+
public class FileOpenedEventArgs : EventArgs
{
public string FileName { get; set; }
@@ -53,10 +74,12 @@ public FileOpenedEventArgs(string filename) {
public class FileRawImageEventArgs : EventArgs
{
public Bitmap Image { get; set; }
+ public List AtlasElements { get; set; }
- public FileRawImageEventArgs(Bitmap image)
+ public FileRawImageEventArgs(Bitmap image, List elements)
{
this.Image = image;
+ this.AtlasElements = elements;
}
}
@@ -151,6 +174,18 @@ public void OpenFile(string filename, Stream stream)
throw new Exception("Unknown pixel format?");
}
+ string atlasExt = "xml";
+ FileInfo fileInfo = new FileInfo(filename);
+ string fileDir = fileInfo.DirectoryName;
+ string fileNameWithoutExt = fileInfo.Name.Replace(fileInfo.Extension, "");
+ string atlasDataPath = fileDir + @"\" + fileNameWithoutExt + "." + atlasExt;
+ List atlasElements = new List();
+
+ if (File.Exists(atlasDataPath))
+ {
+ atlasElements = ReadAtlasData(atlasDataPath, mipmap.Width, mipmap.Height);
+ }
+
var imgReader = new BinaryReader(new MemoryStream(argbData));
Bitmap pt = new Bitmap((int)mipmap.Width, (int)mipmap.Height);
@@ -169,9 +204,62 @@ public void OpenFile(string filename, Stream stream)
CurrentFileRaw = pt;
- OnRawImage(new FileRawImageEventArgs(pt));
+ OnRawImage(new FileRawImageEventArgs(pt, atlasElements));
+ }
+
+ private List ReadAtlasData(string path, int mipmapWidth, int mipmapHeight)
+ {
+ var AtlasElements = new List();
+ try
+ {
+ XmlDocument xDoc = new XmlDocument();
+ xDoc.Load(path);
+
+ XmlNode xNodeElements = xDoc.SelectSingleNode("Atlas/Elements");
+ foreach (XmlNode xChild in xNodeElements.ChildNodes)
+ {
+ string name = xChild.Attributes.GetNamedItem("name").Value;
+ double u1 = Convert.ToDouble(xChild.Attributes.GetNamedItem("u1").Value.Replace(".", ","));
+ double u2 = Convert.ToDouble(xChild.Attributes.GetNamedItem("u2").Value.Replace(".", ","));
+
+ /* !!! IMPORTANT TIP !!!
+ * You may need to invert the y-axis depending on the software you use to check your pixel coordinates.
+ * Some image softwares count from the bottom left corner and others from the top left corner.
+ * The former can be used as-is because the game uses the same format.
+ * But if your software counts pixels starting from the upper left corner, you should not use them directly.
+ * Instead, subtract your resulting coordinates them from 1.
+ * E.g. if your y-coordinate is 0.3, you would use 0.7 (1 – 0.3).
+ * ONLY for Y-coordinates.
+ */
+
+ /* NORMAL THE Y-AXIS */
+ double v1 = Convert.ToDouble(xChild.Attributes.GetNamedItem("v1").Value.Replace(".", ","));
+ double v2 = Convert.ToDouble(xChild.Attributes.GetNamedItem("v2").Value.Replace(".", ","));
+
+ /* INVERT THE Y-AXIS */
+ v1 = 1 - v1;
+ v2 = 1 - v2;
+
+ int imgHmin, imgHmax, imgVmin, imgVmax;
+ double margin = 0.5;
+ imgHmin = Convert.ToInt16(u1 * mipmapWidth - margin);
+ imgHmax = Convert.ToInt16(u2 * mipmapWidth - margin);
+ imgVmin = Convert.ToInt16(v1 * mipmapHeight - margin);
+ imgVmax = Convert.ToInt16(v2 * mipmapHeight - margin);
+
+ AtlasElements.Add(new KleiTextureAtlasElement(name, imgHmin, imgHmax, imgVmin, imgVmax));
+ }
+ }
+ catch (Exception e)
+ {
+ AtlasElements.Clear();
+ Console.WriteLine(e.Message);
+ }
+ return AtlasElements;
}
+
+
public void SaveFile(string FilePath)
{
CurrentFileRaw.Save(FilePath);