void Segment() { drawNode.DrawSegment(from: new CCPoint(0, 0), to: new CCPoint(100, 200), radius: 5, color: new CCColor4F(1, 1, 1, 1)); }
private void UpdateLine() { line.Clear(); var effectiveWidth = System.Math.Max(0, width); line.DrawSegment(CCPoint.Zero, new CCPoint(40, 0), effectiveWidth / 2, new CCColor4F(1, 1, 0, 1)); }
void addVerticalLines() { var l = new CCDrawNode(); for (int x = 1; x < _size; ++x) { var y = VisibleBoundsWorldspace.LowerLeft.Offset( VisibleBoundsWorldspace.MaxX / _size * x, 0); l.DrawSegment(y, y.Offset(0, VisibleBoundsWorldspace.MaxY), 5f, new CCColor4F(255f, 0f, 0f, 1f)); } AddChild(l); }
void DrawWinningLine() { if (!GameState.HasValue) { return; } // Draw var l = new CCDrawNode(); l.DrawSegment(cellToLocation(WinningLineStart), cellToLocation(WinningLineEnd), 10f, new CCColor4F(255f, 255f, 0f, 1f)); AddChild(l); }
public override bool Init() { base.Init(); CCSize s = CCDirector.SharedDirector.WinSize; CCDrawNode draw = new CCDrawNode(); AddChild(draw, 10); // Draw 10 circles for (int i = 0; i < 10; i++) { draw.DrawDot(new CCPoint(s.Width / 2, s.Height / 2), 10 * (10 - i), new CCColor4F(CCRandom.Float_0_1(), CCRandom.Float_0_1(), CCRandom.Float_0_1(), 1)); } // Draw polygons CCPoint[] points = new CCPoint[] { new CCPoint(s.Height / 4, 0), new CCPoint(s.Width, s.Height / 5), new CCPoint(s.Width / 3 * 2, s.Height) }; draw.DrawPolygon(points, points.Length, new CCColor4F(1, 0, 0, 0.5f), 4, new CCColor4F(0, 0, 1, 1)); // star poly (triggers buggs) { const float o = 80; const float w = 20; const float h = 50; CCPoint[] star = new CCPoint[] { new CCPoint(o + w, o - h), new CCPoint(o + w * 2, o), // lower spike new CCPoint(o + w * 2 + h, o + w), new CCPoint(o + w * 2, o + w * 2), // right spike // {o +w, o+w*2+h}, {o,o+w*2}, // top spike // {o -h, o+w}, {o,o}, // left spike }; draw.DrawPolygon(star, star.Length, new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); } // star poly (doesn't trigger bug... order is important un tesselation is supported. { const float o = 180; const float w = 20; const float h = 50; var star = new CCPoint[] { new CCPoint(o, o), new CCPoint(o + w, o - h), new CCPoint(o + w * 2, o), // lower spike new CCPoint(o + w * 2 + h, o + w), new CCPoint(o + w * 2, o + w * 2), // right spike new CCPoint(o + w, o + w * 2 + h), new CCPoint(o, o + w * 2), // top spike new CCPoint(o - h, o + w), // left spike }; draw.DrawPolygon(star, star.Length, new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); } // Draw segment draw.DrawSegment(new CCPoint(20, s.Height), new CCPoint(20, s.Height / 2), 10, new CCColor4F(0, 1, 0, 1)); draw.DrawSegment(new CCPoint(10, s.Height / 2), new CCPoint(s.Width / 2, s.Height / 2), 40, new CCColor4F(1, 0, 1, 0.5f)); return(true); }
public override void OnEnter() { base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size; CCDrawNode draw = new CCDrawNode(); AddChild(draw, 10); var s = windowSize; // Draw 10 circles for (int i = 0; i < 10; i++) { draw.DrawDot(s.Center, 10 * (10 - i), new CCColor4F(CCRandom.Float_0_1(), CCRandom.Float_0_1(), CCRandom.Float_0_1(), 1)); } // Draw polygons CCV3F_C4B[] points = new CCV3F_C4B[3]; points[0].Colors = CCColor4B.Red; points[0].Colors.A = 127; points[1].Colors = CCColor4B.Green; points[1].Colors.A = 127; points[2].Colors = CCColor4B.Blue; points[2].Colors.A = 127; points[0].Vertices.X = windowSize.Height / 4; points[0].Vertices.Y = 0; points[1].Vertices.X = windowSize.Width; points[1].Vertices.Y = windowSize.Height / 5; points[2].Vertices.X = windowSize.Width / 3 * 2; points[2].Vertices.Y = windowSize.Height; draw.DrawTriangleList(points); // star poly (triggers buggs) { const float o = 80; const float w = 20; const float h = 50; CCPoint[] star = new CCPoint[] { new CCPoint(o + w, o - h), new CCPoint(o + w * 2, o), // lower spike new CCPoint(o + w * 2 + h, o + w), new CCPoint(o + w * 2, o + w * 2), // right spike }; draw.DrawPolygon(star, star.Length, new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); } // star poly (doesn't trigger bug... order is important un tesselation is supported. { const float o = 180; const float w = 20; const float h = 50; var star = new CCPoint[] { new CCPoint(o, o), new CCPoint(o + w, o - h), new CCPoint(o + w * 2, o), // lower spike new CCPoint(o + w * 2 + h, o + w), new CCPoint(o + w * 2, o + w * 2), // right spike new CCPoint(o + w, o + w * 2 + h), new CCPoint(o, o + w * 2), // top spike new CCPoint(o - h, o + w), // left spike }; draw.DrawPolygon(star, star.Length, new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); } // Draw segment draw.DrawSegment(new CCPoint(20, windowSize.Height), new CCPoint(20, windowSize.Height / 2), 10, new CCColor4F(0, 1, 0, 1)); draw.DrawSegment(new CCPoint(10, windowSize.Height / 2), new CCPoint(windowSize.Width / 2, windowSize.Height / 2), 40, new CCColor4F(1, 0, 1, 0.5f)); }
public override void OnEnter() { base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size; CCDrawNode draw = new CCDrawNode(); AddChild(draw, 10); var s = windowSize; // Draw 10 circles for (int i = 0; i < 10; i++) { draw.DrawDot(s.Center, 10 * (10 - i), new CCColor4F(CCRandom.Float_0_1(), CCRandom.Float_0_1(), CCRandom.Float_0_1(), 1)); } // Draw polygons CCPoint[] points = new CCPoint[] { new CCPoint(windowSize.Height / 4, 0), new CCPoint(windowSize.Width, windowSize.Height / 5), new CCPoint(windowSize.Width / 3 * 2, windowSize.Height) }; draw.DrawPolygon(points, points.Length, new CCColor4F(1.0f, 0, 0, 0.5f), 4, new CCColor4F(0, 0, 1, 1)); // star poly (triggers buggs) { const float o = 80; const float w = 20; const float h = 50; CCPoint[] star = new CCPoint[] { new CCPoint(o + w, o - h), new CCPoint(o + w * 2, o), // lower spike new CCPoint(o + w * 2 + h, o + w), new CCPoint(o + w * 2, o + w * 2), // right spike }; draw.DrawPolygon(star, star.Length, new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); } // star poly (doesn't trigger bug... order is important un tesselation is supported. { const float o = 180; const float w = 20; const float h = 50; var star = new CCPoint[] { new CCPoint(o, o), new CCPoint(o + w, o - h), new CCPoint(o + w * 2, o), // lower spike new CCPoint(o + w * 2 + h, o + w), new CCPoint(o + w * 2, o + w * 2), // right spike new CCPoint(o + w, o + w * 2 + h), new CCPoint(o, o + w * 2), // top spike new CCPoint(o - h, o + w), // left spike }; draw.DrawPolygon(star, star.Length, new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); } // Draw segment draw.DrawSegment(new CCPoint(20, windowSize.Height), new CCPoint(20, windowSize.Height / 2), 10, new CCColor4F(0, 1, 0, 1)); draw.DrawSegment(new CCPoint(10, windowSize.Height / 2), new CCPoint(windowSize.Width / 2, windowSize.Height / 2), 40, new CCColor4F(1, 0, 1, 0.5f)); CCSize size = Layer.VisibleBoundsWorldspace.Size; var visibleRect = VisibleBoundsWorldspace; // draw quad bezier path draw.DrawQuadBezier(new CCPoint(0, size.Height), visibleRect.Center, (CCPoint)visibleRect.Size, 50, 3, new CCColor4B(255, 0, 255, 255)); // draw cubic bezier path draw.DrawCubicBezier(visibleRect.Center, new CCPoint(size.Width / 2 + 30, size.Height / 2 + 50), new CCPoint(size.Width / 2 + 60, size.Height / 2 - 50), new CCPoint(size.Width, size.Height / 2), 100, 2, CCColor4B.Green); // draw an ellipse within rectangular region draw.DrawEllipse(new CCRect(100, 300, 100, 200), 2, CCColor4B.AliceBlue); }
void OnTouchesMoved(List <CCTouch> touches, CCEvent touchEvent) { if (touches.Count <= 0) { return; } if (hitBubble == null) { return; } var touch = touches [0]; line.DrawSegment(lastPoint, touch.Location, 3, hitBubble.ColorF); lastPoint = touch.Location; var hitOtherColor = (from bubble in visibleBubbles where bubble.ContainsPoint(touch.Location) && bubble.ColorId != hitBubble.ColorId select true).Any(); if (hitOtherColor) { foreach (var bubble in frozenBubbles) { bubble.ForcePop(this); visibleBubbles.Remove(bubble); } line.Clear(); frozenBubbles.Clear(); hitBubble = null; multiplierLabel.Text = string.Empty; return; } var bubbles = (from bubble in visibleBubbles where bubble.ContainsPoint(touch.Location) && bubble.ColorId == hitBubble.ColorId && !bubble.IsFrozen select bubble).ToList(); if (bubbles == null || !bubbles.Any()) { return; } foreach (var bubble in bubbles) { frozenBubbles.Add(bubble); bubble.Freeze(frozenBubbles.Count); } if (frozenBubbles.Count > 1) { multiplierLabel.SystemFontSize = baseFont + (frozenBubbles.Count * 2); multiplierLabel.Text = (frozenBubbles.Count - 1) + "x"; } if (frozenBubbles.Count >= 6) { TallyScore(); CCSimpleAudioEngine.SharedEngine.PlayEffect("sounds/highscore"); } }