private void button5_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SprType newSprType = SprType.VP_PARALLEL_UPRIGHT; if (radioButton1.Checked) { newSprType = SprType.VP_PARALLEL_UPRIGHT; } else if (radioButton2.Checked) { newSprType = SprType.FACING_UPRIGHT; } else if (radioButton3.Checked) { newSprType = SprType.VP_PARALLEL; } else if (radioButton4.Checked) { newSprType = SprType.ORIENTED; } else if (radioButton5.Checked) { newSprType = SprType.VP_PARALLEL_ORIENTED; } SprTextFormat newTextFormat = SprTextFormat.SPR_NORMAL; if (radioButton6.Checked) { newTextFormat = SprTextFormat.SPR_NORMAL; } else if (radioButton7.Checked) { newTextFormat = SprTextFormat.SPR_ADDITIVE; } else if (radioButton8.Checked) { newTextFormat = SprTextFormat.SPR_INDEXALPHA; } else if (radioButton9.Checked) { newTextFormat = SprTextFormat.SPR_ALPHTEST; } SpriteLoader.CreateSpriteFile(saveFileDialog1.FileName, GetInputFilenames(), newSprType, newTextFormat, (int)numericUpDown1.Value - 1); if (MessageBox.Show("Sprite file created! Open it now in viewer?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { if (openFileNow != null) { openFileNow(saveFileDialog1.FileName); } } this.Close(); } }
private void buttonSaveSprite_Click(object sender, EventArgs e) { if (saveSpriteFileDialog.ShowDialog() == DialogResult.OK) { progBar.Show(); progLbl.Show(); buttonSaveSprite.Enabled = false; tabControl1.Enabled = false; try { string[] filenames = GetInputFilenames(); string savePath = saveSpriteFileDialog.FileName; SprType spriteType = GetSelectedSpriteType(); SprTextFormat spriteFormat = GetSelectedSpriteFormat(); int paletteIndex = (int)inputPaletteIndex.Value - 1; Thread thCreator = new Thread((o) => { SpriteLoader.CreateSpriteFile(savePath, filenames, spriteType, spriteFormat, paletteIndex); }); thCreator.Start(); while (thCreator.IsAlive) { Thread.Sleep(10); Application.DoEvents(); } progBar.Hide(); progLbl.Hide(); if (MessageBox.Show("Sprite file created! Open it now in viewer?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { openFileNow(saveSpriteFileDialog.FileName); } } finally { Close(); } } }