private void btnBlendDst_Click(object sender, EventArgs e) { EBlendFactor eBlendFactor = (EBlendFactor)Enum.Parse(typeof(EBlendFactor), btnBlendDst.Text); GLBlendFactorForm form = new GLBlendFactorForm(); form.setGlBendFactor(eBlendFactor); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { btnBlendDst.Text = form.getGlBendFactor().ToString(); if (btnBlendSrc.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_SRC_ALPHA) && btnBlendDst.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_ONE_MINUS_SRC_ALPHA)) { btnBlendNormal.Font = new Font(btnBlendNormal.Font, FontStyle.Bold); btnBlendToAdd.Font = new Font(btnBlendToAdd.Font, FontStyle.Regular); } else if (btnBlendSrc.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_SRC_ALPHA) && btnBlendDst.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_ONE)) { btnBlendToAdd.Font = new Font(btnBlendToAdd.Font, FontStyle.Bold); btnBlendNormal.Font = new Font(btnBlendNormal.Font, FontStyle.Regular); } else { btnBlendToAdd.Font = new Font(btnBlendToAdd.Font, FontStyle.Regular); btnBlendNormal.Font = new Font(btnBlendNormal.Font, FontStyle.Regular); } updateTitle(true); } }
internal static int transGlBlendFactor(EBlendFactor e) { switch (e) { case EBlendFactor.GL_ZERO: return(0x0); case EBlendFactor.GL_ONE: return(0x1); case EBlendFactor.GL_SRC_COLOR: return(0x0300); case EBlendFactor.GL_ONE_MINUS_SRC_COLOR: return(0x0301); case EBlendFactor.GL_SRC_ALPHA: return(0x0302); case EBlendFactor.GL_ONE_MINUS_SRC_ALPHA: return(0x0303); case EBlendFactor.GL_DST_ALPHA: return(0x0304); case EBlendFactor.GL_ONE_MINUS_DST_ALPHA: return(0x0305); case EBlendFactor.GL_DST_COLOR: return(0x0306); case EBlendFactor.GL_ONE_MINUS_DST_COLOR: return(0x0307); case EBlendFactor.GL_SRC_ALPHA_SATURATE: return(0x0308); default: throw new Exception("" + e); } }
internal void setGlBendFactor(EBlendFactor e) { foreach (RadioButton rb in rbs) { if (rb.Text != Enum.GetName(typeof(EBlendFactor), e)) { continue; } rb.Checked = true; selected = e; return; } }
private void onCheckedChanged(object sender, EventArgs e) { selected = (EBlendFactor)Enum.Parse(typeof(EBlendFactor), ((RadioButton)sender).Text); }