public override void Draw(Graphics g) { //Show only if its collidable if (!HasPegInfo) { if (Level.ShowCollision && !Collision) { return; } } base.Draw(g); //Get the circle image Image circleImage = GetCircleImage(); //Set the location PointF location = DrawLocation; //Set the draw bounds RectangleF drawbounds = new RectangleF(location.X - mRadius, location.Y - mRadius, mRadius * 2, mRadius * 2); if (Level.ShowCollision || (!HasPegInfo && circleImage == null)) { if (!Level.ShowPreview) { //Draw the collision white circle g.FillEllipse(Brushes.White, drawbounds); } } else { if (HasPegInfo) { //Draw the PeggleEdit style peg g.FillEllipse(new SolidBrush(PegInfo.GetOuterColour()), drawbounds); drawbounds.Inflate(-2, -2); g.FillEllipse(new SolidBrush(PegInfo.GetInnerColour()), drawbounds); } else { //Draw the circle image g.DrawImage(circleImage, location.X - (circleImage.Width / 2), location.Y - (circleImage.Height / 2), circleImage.Width, circleImage.Height); } } }
private void DrawStrightBrick(Graphics g, PointF location) { RectangleF dest = new RectangleF(location.X - (Length / 2), location.Y - (Width / 2), Length, Width); DrawBrick(g, dest, PegInfo.GetOuterColour()); dest.Inflate(-2, -5); if (mTextureFlip) { dest.Y += 3.0f; } else { dest.Y -= 3.0f; } DrawBrick(g, dest, PegInfo.GetInnerColour()); }
private void DrawCurvedBrick(Graphics g, PointF location) { if (Level.ShowCollision) { DrawCurvedBrick(g, Color.White, location, false); return; } float shadingOffset = 8.0f; if (mTextureFlip) { shadingOffset = 2.0f; } DrawCurvedBrick(g, PegInfo.GetOuterColour(), location, false); mWidth /= 2.0f; location.X += shadingOffset; DrawCurvedBrick(g, PegInfo.GetInnerColour(), location, true); location.X -= shadingOffset; mWidth *= 2.0f; }