private void glovesPalettePictureBox_DoubleClick(object sender, EventArgs e) { var mouseE = e as MouseEventArgs; var x = mouseE.X / paletteSquareSize; var y = mouseE.Y / paletteSquareSize; if (x >= 2 || y >= 1) { // clicked outside palette area (control is too big) return; } ColorDialog colorDialog = new ColorDialog(); colorDialog.Color = currentSprite.GlovePalette[x]; if (colorDialog.ShowDialog() == DialogResult.OK) { currentSprite.GlovePalette[x] = colorDialog.Color; } BuildPalette(paletteComboBox.SelectedIndex); if (this.ActiveMdiChild != null) { SpriteForm activeChild = (SpriteForm)this.ActiveMdiChild; activeChild.UpdateForm(); } }
private void palettePictureBox_DoubleClick(object sender, EventArgs e) { var mouseE = e as MouseEventArgs; var x = mouseE.X / paletteSquareSize; var y = mouseE.Y / paletteSquareSize; if (x >= 8 || y >= 2) { // clicked outside palette area (control is too big) return; } SpriteLibrary.Palette palette = null; switch (paletteComboBox.SelectedIndex) { case 0: palette = currentSprite.GreenMailPalette; break; case 1: palette = currentSprite.BlueMailPalette; break; case 2: palette = currentSprite.RedMailPalette; break; case 3: palette = currentSprite.BunnyPalette; break; default: return; } int index = x + y * 8; ColorDialog colorDialog = new ColorDialog(); colorDialog.Color = palette[index]; if (colorDialog.ShowDialog() == DialogResult.OK) { palette[index] = colorDialog.Color; } BuildPalette(paletteComboBox.SelectedIndex); if (this.ActiveMdiChild != null) { SpriteForm activeChild = (SpriteForm)this.ActiveMdiChild; activeChild.UpdateForm(); } }
private void importGraphicsGalePaletteToolStripMenuItem_Click(object sender, EventArgs e) { SpriteForm activeChild = (SpriteForm)this.ActiveMdiChild; if (activeChild != null) { try { string filename = activeChild.Filename; // new file, or old format file need to show save box OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Graphics Gale Palette File (*.pal)|*.pal|All Files (*.*)|*.*"; ofd.Title = "Select a Graphics Gale Palette File"; var result = ofd.ShowDialog(); if (result != DialogResult.OK) { return; } filename = ofd.FileName; var pal = SpriteLibrary.GraphicsGalePalette.BuildSpritePaletteColorsFromStringArray(File.ReadAllLines(filename)); if (pal.Length < 60) { MessageBox.Show("Palette is not long enough. Character Sprites require at least 60 entries.", "Error"); return; } activeChild.loadedSprite.SetPalette(pal); activeChild.UpdateForm(); UpdateCurrentSprite(activeChild.loadedSprite); } catch (Exception ex) { logger.Error(ex); MessageBox.Show(OopsMessage, "Error"); } } }
private void clearPNGPaletteTileToolStripMenuItem_Click(object sender, EventArgs e) { if (currentSprite == null) { return; } var empty = new byte[32]; var pixels = currentSprite.PixelData; Array.Copy(empty, 0, pixels, 0x7000 - 32, 32); currentSprite.PixelData = pixels; if (this.ActiveMdiChild != null) { SpriteForm activeChild = (SpriteForm)this.ActiveMdiChild; activeChild.UpdateForm(); } }