diff --git a/Civ6IconCreator/Civ6IconCreator/App.config b/Civ6IconCreator/Civ6IconCreator/App.config
index 12d60b8..c78b9b5 100644
--- a/Civ6IconCreator/Civ6IconCreator/App.config
+++ b/Civ6IconCreator/Civ6IconCreator/App.config
@@ -16,6 +16,12 @@
+
+ False
+
+
+ False
+
\ No newline at end of file
diff --git a/Civ6IconCreator/Civ6IconCreator/Civ6IconCreator.csproj b/Civ6IconCreator/Civ6IconCreator/Civ6IconCreator.csproj
index 5f903c0..ba84f2b 100644
--- a/Civ6IconCreator/Civ6IconCreator/Civ6IconCreator.csproj
+++ b/Civ6IconCreator/Civ6IconCreator/Civ6IconCreator.csproj
@@ -214,7 +214,9 @@
PreserveNewest
-
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Civ6IconCreator/Civ6IconCreator/Form1.Designer.cs b/Civ6IconCreator/Civ6IconCreator/Form1.Designer.cs
index e197d21..f537783 100644
--- a/Civ6IconCreator/Civ6IconCreator/Form1.Designer.cs
+++ b/Civ6IconCreator/Civ6IconCreator/Form1.Designer.cs
@@ -55,6 +55,8 @@ private void InitializeComponent()
this.sedDirDialog = new System.Windows.Forms.OpenFileDialog();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
+ this.checkBoxDirectX10 = new System.Windows.Forms.CheckBox();
+ this.checkBoxNoGPU = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -272,12 +274,14 @@ private void InitializeComponent()
//
// tabPage2
//
+ this.tabPage2.Controls.Add(this.checkBoxNoGPU);
+ this.tabPage2.Controls.Add(this.checkBoxDirectX10);
this.tabPage2.Controls.Add(this.label4);
this.tabPage2.Controls.Add(this.ResetButton);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(629, 353);
+ this.tabPage2.Size = new System.Drawing.Size(628, 353);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "設定";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -323,6 +327,28 @@ private void InitializeComponent()
this.toolStripStatusLabel1.Size = new System.Drawing.Size(151, 17);
this.toolStripStatusLabel1.Text = "アプリケーションを起動しました。";
//
+ // checkBoxDirectX10
+ //
+ this.checkBoxDirectX10.AutoSize = true;
+ this.checkBoxDirectX10.Location = new System.Drawing.Point(10, 40);
+ this.checkBoxDirectX10.Name = "checkBoxDirectX10";
+ this.checkBoxDirectX10.Size = new System.Drawing.Size(126, 16);
+ this.checkBoxDirectX10.TabIndex = 5;
+ this.checkBoxDirectX10.Text = "DirectX10互換モード";
+ this.checkBoxDirectX10.UseVisualStyleBackColor = true;
+ this.checkBoxDirectX10.CheckedChanged += new System.EventHandler(this.checkBoxDirectX10_CheckedChanged);
+ //
+ // checkBoxNoGPU
+ //
+ this.checkBoxNoGPU.AutoSize = true;
+ this.checkBoxNoGPU.Location = new System.Drawing.Point(10, 63);
+ this.checkBoxNoGPU.Name = "checkBoxNoGPU";
+ this.checkBoxNoGPU.Size = new System.Drawing.Size(109, 16);
+ this.checkBoxNoGPU.TabIndex = 6;
+ this.checkBoxNoGPU.Text = "GPUを使用しない";
+ this.checkBoxNoGPU.UseVisualStyleBackColor = true;
+ this.checkBoxNoGPU.CheckedChanged += new System.EventHandler(this.checkBoxNoGPU_CheckedChanged);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -375,6 +401,8 @@ private void InitializeComponent()
private System.Windows.Forms.Button ResetButton;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
+ private System.Windows.Forms.CheckBox checkBoxDirectX10;
+ private System.Windows.Forms.CheckBox checkBoxNoGPU;
}
}
diff --git a/Civ6IconCreator/Civ6IconCreator/Form1.cs b/Civ6IconCreator/Civ6IconCreator/Form1.cs
index aa41e45..8e00189 100644
--- a/Civ6IconCreator/Civ6IconCreator/Form1.cs
+++ b/Civ6IconCreator/Civ6IconCreator/Form1.cs
@@ -16,11 +16,12 @@ namespace Civ6IconCreator
{
public partial class Form1 : Form
{
- //グローバル変数定義
+ //Form内共通変数、定数
string outputDirName;
string inputFilePath;
string texConvPath;
string sedPath;
+
int[] sizesLeaders = new int[] {256, 80,64,55,50,45,32};
int[] sizesCivilizations = new int[] {256, 80,64,50,48,45,44,36,30,22};
int[] sizesUnitFlags = new int[] {256, 80,50,38,32,22};
@@ -29,6 +30,7 @@ public partial class Form1 : Form
int[] sizesDistricts = new int[] {256,128,80,50,38,32,22};
int[] sizesImprovements = new int[] {256, 80,50,38};
+ //コンストラクタ
public Form1()
{
InitializeComponent();
@@ -70,8 +72,13 @@ public Form1()
outputTextBox.Text = "";
outputDirDialog.SelectedPath = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
}
+ //DirectX10互換モード
+ checkBoxDirectX10.Checked = Properties.Settings.Default.checkedDX10;
+
+ //GPU使用有無
+ checkBoxNoGPU.Checked = Properties.Settings.Default.checkedNoGPU;
- //外部アプリケーションは直下にあるものとして処理する
+ //外部アプリケーションは直下にあるものとして設定する
texConvPath = System.Windows.Forms.Application.StartupPath + @"\texconv.exe";
sedPath = System.Windows.Forms.Application.StartupPath + @"\onigsed.exe";
@@ -84,6 +91,13 @@ public Form1()
#endif
}
+ //========================================
+ // イベント
+ //========================================
+ //====================
+ // メイン
+ //====================
+ //Inputの開くボタンが押されたとき
private void inputButton_Click(object sender, EventArgs e)
{
//Inputの画像を開くボタン
@@ -124,9 +138,9 @@ private void inputButton_Click(object sender, EventArgs e)
}
}
+ //Outputの開くボタンが押されたとき
private void outputButton_Click(object sender, EventArgs e)
{
- //Optput先を開くボタン
if (DialogResult.OK == outputDirDialog.ShowDialog())
{
outputDirName = outputDirDialog.SelectedPath;
@@ -143,10 +157,9 @@ private void outputButton_Click(object sender, EventArgs e)
}
}
+ //生成ボタンが押されたとき
private void generateButton_Click(object sender, EventArgs e)
{
- //Generate
-
//チェックされてるものに合わせてDDS変換とTex生成を実施する
if (radioButton1.Checked) {
_generateDDS(sizesLeaders);
@@ -183,28 +196,78 @@ private void generateButton_Click(object sender, EventArgs e)
_generateTex("Improvements", sizesImprovements);
toolStripStatusLabel1.Text = "変換完了(Improvements)";
};
+ }
+
+ //====================
+ // オプション
+ //====================
+ //記憶場所消去のボタンが押されたとき
+ private void ResetButton_Click(object sender, EventArgs e)
+ {
+ inputFilePath = "";
+ outputDirName = "";
+ inputTextBox.Text = "";
+ outputTextBox.Text = "";
+ Properties.Settings.Default.inputFile = "";
+ Properties.Settings.Default.outputDirName = "";
+ Properties.Settings.Default.Save();
+
+ toolStripStatusLabel1.Text = "ディレクトリの記憶情報を消去しました。";
+ }
+
+ //DirectX互換モードのチェックが変わったとき
+ private void checkBoxDirectX10_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.checkedDX10 = checkBoxDirectX10.Checked;
+ Properties.Settings.Default.Save();
+ }
+ //GPUを使用しないのチェックが変わったとき
+ private void checkBoxNoGPU_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.checkedNoGPU = checkBoxNoGPU.Checked;
+ Properties.Settings.Default.Save();
}
+ //========================================
+ // 内部関数
+ //========================================
//DDS変換関数(texconvに丸投げ)
private void _generateDDS(int[] sizes)
{
+ string optDx10 = "";
+ string optNoGPU = "";
+
+ //DirectX10互換モードの有無
+ if (checkBoxDirectX10.Checked)
+ {
+ optDx10 = "-dx10 ";
+ }
+ //GPU使用の有無
+ if (checkBoxNoGPU.Checked)
+ {
+ optNoGPU = "-nogpu ";
+ }
+
foreach (int imgSize in sizes)
{
//PNGからDDSに変換
- var app = new ProcessStartInfo();
- app.FileName = texConvPath;
- app.Arguments = " -y -f R8G8B8A8_UNORM -if BOX -w " + imgSize + " -h " + imgSize + " -m 1 -sx " + imgSize + " -o \"" + outputDirName + "\" \""+ inputFilePath + "\"";
- app.WorkingDirectory = System.IO.Path.GetDirectoryName(texConvPath);
- app.CreateNoWindow = true;
- app.RedirectStandardOutput = true;
- app.UseShellExecute = false;
+ var app = new ProcessStartInfo
+ {
+ FileName = texConvPath,
+ Arguments = " -y -f R8G8B8A8_UNORM " + optDx10 + optNoGPU + "-if BOX -w " + imgSize + " -h " + imgSize + " -m 1 -sx " + imgSize + " -o \"" + outputDirName + "\" \"" + inputFilePath + "\"",
+ WorkingDirectory = System.IO.Path.GetDirectoryName(texConvPath),
+ CreateNoWindow = true,
+ RedirectStandardOutput = true,
+ UseShellExecute = false
+ };
#if DEBUG
File.AppendAllText("debug.log", app.FileName + @" " + app.Arguments + "\r\n");
Process p = Process.Start(app);
string output = p.StandardOutput.ReadToEnd(); // 標準出力の読み取り
output = output.Replace("\r\r\n", "\n"); // 改行コードの修正
+
File.AppendAllText("debug.log", output);
#else
Process.Start(app);
@@ -239,20 +302,12 @@ private void _generateTex(string type, int[] sizes)
File.AppendAllText("debug.log", app.FileName + @" " + app.Arguments + "\r\n");
#endif
string output = p.StandardOutput.ReadToEnd(); // 標準出力の読み取り
+#if DEBUG
+ File.AppendAllText("debug.log", "========================================\r\n");
+ File.AppendAllText("debug.log", output+"\r\n");
+#endif
File.WriteAllText(outputPath, output);
}
}
-
- private void ResetButton_Click(object sender, EventArgs e)
- {
- //記憶場所消去ボタン
- inputFilePath = "";
- outputDirName = "";
- inputTextBox.Text = "";
- outputTextBox.Text = "";
- Properties.Settings.Default.inputFile = "";
- Properties.Settings.Default.outputDirName = "";
- Properties.Settings.Default.Save();
- }
}
}
diff --git a/Civ6IconCreator/Civ6IconCreator/Properties/Settings.Designer.cs b/Civ6IconCreator/Civ6IconCreator/Properties/Settings.Designer.cs
index 9d75de3..5fb72fb 100644
--- a/Civ6IconCreator/Civ6IconCreator/Properties/Settings.Designer.cs
+++ b/Civ6IconCreator/Civ6IconCreator/Properties/Settings.Designer.cs
@@ -46,5 +46,29 @@ public string outputDirName {
this["outputDirName"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool checkedDX10 {
+ get {
+ return ((bool)(this["checkedDX10"]));
+ }
+ set {
+ this["checkedDX10"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool checkedNoGPU {
+ get {
+ return ((bool)(this["checkedNoGPU"]));
+ }
+ set {
+ this["checkedNoGPU"] = value;
+ }
+ }
}
}
diff --git a/Civ6IconCreator/Civ6IconCreator/Properties/Settings.settings b/Civ6IconCreator/Civ6IconCreator/Properties/Settings.settings
index b063372..9982740 100644
--- a/Civ6IconCreator/Civ6IconCreator/Properties/Settings.settings
+++ b/Civ6IconCreator/Civ6IconCreator/Properties/Settings.settings
@@ -8,5 +8,11 @@
+
+ False
+
+
+ False
+
\ No newline at end of file