private void ColorChooserPaint(object sender, PaintEventArgs e) { // Depending on the circumstances, force a repaint // of the color wheel passing different information. switch (changeType) { case ChangeStyle.HSV: myColorWheel.Draw(e.Graphics, hsv); break; case ChangeStyle.MouseMove: case ChangeStyle.None: myColorWheel.Draw(e.Graphics, selectedPoint); break; case ChangeStyle.RGB: myColorWheel.Draw(e.Graphics, argb); break; } }
/// <summary> /// Draw this Option at the given position on the screen /// </summary> public void Draw(SpriteBatch b, Vector2 pos) { int left = (int)pos.X; int top = (int)pos.Y; IClickableMenu.drawTextureBox(b, Game1.menuTexture, new Rectangle(0, 256, 60, 60), left + colorBoxOffset, top, colorBoxOuterSize, colorBoxOuterSize, Color.White, 1f, false); var colorBox = new Rectangle(left + colorBoxOffset + colorBoxBorder, top + colorBoxBorder, colorBoxInnerSize, colorBoxInnerSize); b.Draw(checkerboard, colorBox, Color.White); b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, Utility.ScissorEnabled); b.Draw(ColorUtil.Pixel, colorBox, currentValue); b.End(); b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, Utility.ScissorEnabled); top += sliderSpacing; if (ShowStylePicker) { top += DrawStyleSelector(b, left, top); top += sliderSpacing; } if (RGBStyleButton.Selected) { sliderR.Draw(b, left, top); top += ColorSlider.height + sliderSpacing; sliderG.Draw(b, left, top); top += ColorSlider.height + sliderSpacing; sliderB.Draw(b, left, top); top += ColorSlider.height + sliderSpacing; } if (ShowAlpha) { sliderA.Draw(b, left, top); top += ColorSlider.height + sliderSpacing; } if (HSVStyleButton.Selected && HSLStyleButton.Selected) { top = Math.Max(top, (int)pos.Y + colorBoxOuterSize + sliderSpacing); } if (HSVStyleButton.Selected) { hsvWheel.Draw(b, left, top); vSlider.Draw(b, left + hsvWheel.Width + 10, top); left += hsvWheel.Width + 20 + vSlider.Width; } if (HSLStyleButton.Selected) { hslWheel.Draw(b, left, top); lSlider.Draw(b, left + hslWheel.Width + 10, top); } }