private void LoadGrid(object sender, EventArgs e) { if (tabControl1.SelectedIndex != 1) { return; } Maker.Custom.SPRITE_SIZE = Int32.Parse(textCustomSize.Text); if (GetTileset().TilesetName() == Maker.Custom.NAME && Maker.Custom.SPRITE_SIZE == 0) { MessageBox.Show(Vocab.GetText("sizeIsZeroErrorMsg")); return; } Image img = Image.FromFile(filepath); pictureBoxPreview.Image = null; try { gridInp = new TilesetEditorIntput(GetTileset(), inputPanel, img, pictureBoxPreview); SetOutputGrid(null, null); } catch (ConvertException ex) { MessageBox.Show(ex.Message); } }
private bool EmulateEditor(string inputResPath, string outResPath, ITileset inputTileset, ITileset outputTileset) { Bitmap tile = BitmapFromResourceStream(inputResPath); Bitmap imgOut = BitmapFromResourceStream(outResPath); editorInput = new TilesetEditorIntput(inputTileset, null, tile, null); editorOutput = new TilesetEditorOutput(outputTileset, null, editorInput); editorInput.SetSelectedImage(0); for (int i = 0; i < 10; i++) // Number of SpriteModes { editorInput.UpdateSelectedImage(((SpriteMode)i)); editorOutput.SetGridImage(i, editorInput.selectedImage); } editorOutput.SetGridImage(-1, editorInput.selectedImage); return(ImageEditor.IsEqual(imgOut, editorOutput.TilesToTileset())); }