private byte ChangeByte(byte v, int tileCol, PlayFieldColor currentColor) { int value; switch (currentColor) { case PlayFieldColor.COLBK: value = 0; break; case PlayFieldColor.COLPF0: value = 1; break; case PlayFieldColor.COLPF1: value = 2; break; case PlayFieldColor.COLPF2: case PlayFieldColor.COLPF3: value = 3; break; default: throw new ArgumentException(); } value = value << (2 * (3 - tileCol)); int mask = 0xFF ^ (0x3 << (2 * (3 - tileCol))); return((byte)((v & mask) | value)); }
private void HandleButtonClick(PlayFieldColor color) { FormAtariColorPicker FormAtariColorPicker = new FormAtariColorPicker(ReturnAtariPFColors.GetColor(color)); if (FormAtariColorPicker.ShowDialog() == DialogResult.OK && FormAtariColorPicker.CurrentColor.HasValue) { ReturnAtariPFColors.SetColor(color, FormAtariColorPicker.CurrentColor.Value); UpdateColors(); } }
private void SelectColor(PlayFieldColor pfColor) { MessageBoxButtons buttons = MessageBoxButtons.YesNo; String title = "Change Display Mode"; if (PlayFieldColor.COLPF2.Equals(pfColor) && CellType.High.Equals(cellType)) { DialogResult result = MessageBox.Show("COLPF2 is only available in 'Low Char Display' mode. Switch to this mode?", title, buttons); if (result == DialogResult.No) { radioButtonColpf3.Checked = true; radioButtonColpf3.Focus(); } else { Change(CellType.Low, false); currentColor = pfColor; } } else if (PlayFieldColor.COLPF3.Equals(pfColor) && CellType.Low.Equals(cellType)) { DialogResult result = MessageBox.Show("COLPF3 is only available in 'High Char Display' mode. Switch to this mode?", title, buttons); if (result == DialogResult.No) { radioButtonColpf2.Checked = true; radioButtonColpf2.Focus(); } else { Change(CellType.High, false); currentColor = pfColor; } } else { currentColor = pfColor; } }