void Circle() { drawNode.DrawCircle( center: new CCPoint(0, 0), radius: 20, color: CCColor4B.Yellow); }
protected void Draw() { CCColor4B color = new CCColor4B(1.0f, 1.0f, 1.0f, 1.0f); switch (_lineType) { case lineTypes.LINE_NONE: break; case lineTypes.LINE_TEMP: drawNode.DrawLine(_tip, _pivot, color); drawNode.DrawCircle(_pivot, 10, 10, color); break; case lineTypes.LINE_DASHED: drawNode.DrawCircle(_pivot, 10, 10, color); int segments = (int)(_lineLength / (_dash + _dashSpace)); float t = 0.0f; float x_; float y_; for (int i = 0; i < segments + 1; i++) { x_ = _pivot.X + t * (_tip.X - _pivot.X); y_ = _pivot.Y + t * (_tip.Y - _pivot.Y); drawNode.DrawCircle(new CCPoint(x_, y_), 4, 6, color); t += (float)1 / segments; } break; } //draw energy bar color = new CCColor4B(0.0f, 0.0f, 0.0f, 1.0f); drawNode.DrawLine( new CCPoint(_energyLineX, _screenSize.Height * 0.1f), new CCPoint(_energyLineX, _screenSize.Height * 0.9f), color); color = new CCColor4B(1.0f, 0.5f, 0.0f, 1.0f); drawNode.DrawLine( new CCPoint(_energyLineX, _screenSize.Height * 0.1f), new CCPoint(_energyLineX, _screenSize.Height * 0.1f + _energy * _energyHeight), color); }
void AddSun() { circleNode = new CCDrawNode(); circleNode.DrawCircle(CCPoint.Zero, 30.0f, CCColor4B.Yellow); AddChild(circleNode); sun = new CCParticleSun(CCPoint.Zero); sun.StartColor = new CCColor4F(CCColor3B.Red); sun.EndColor = new CCColor4F(CCColor4B.Yellow); AddChild(sun); }
public GameScene(CCGameView gameView) : base(gameView) { var layer = new CCLayer(); AddLayer(layer); circle = new CCDrawNode(); layer.AddChild(circle); circle.DrawCircle(new CCPoint(0, 0), radius: 15, color: CCColor4B.White); circle.PositionX = 50; circle.PositionY = 50; }
public GameScene(CCGameView gameView) : base(gameView) { var layer = new CCLayer(); this.AddLayer(layer); circle = new CCDrawNode(); layer.AddChild(circle); // centro da utilizzare quando si disegna il cerchio, relativo al CCDrawNode circle.DrawCircle(new CCPoint(0, 0), radius: 15, color: CCColor4B.White); circle.PositionX = 20; circle.PositionY = 50; }
void Fire() { var shot = new CCDrawNode(); shot.DrawCircle(new CCPoint(0, 0), SHOT_RADIUS, CCColor4B.Red); shots.AddChild(shot); shot.Position = new CCPoint(ship.Position.X + 60.0f, ship.Position.Y - 2.5f); var moveShot = new CCMoveTo(1.0f, new CCPoint(VisibleBoundsWorldspace.MaxX, shot.Position.Y)); shot.RunActions(moveShot, removeNodeAction); }
void AddEnemy() { var enemy = new CCDrawNode(); enemy.DrawCircle(new CCPoint(0, 0), ENEMY_RADIUS, CCColor4B.Blue); enemy.Position = GetRandomPointY(ENEMY_RADIUS); enemies.AddChild(enemy); var moveEnemy = new CCMoveTo(3.0f, new CCPoint(0, enemy.Position.Y)); enemy.RunActions(moveEnemy, removeNodeAction); }
protected override void AddedToScene() { base.AddedToScene(); // Use the bounds to layout the positioning of our drawable assets _bounds = VisibleBoundsWorldspace; //var background = new CCSprite("background"); //AddChild(background); _targetZone = new CCDrawNode(); _targetZone.Position = new CCPoint(_bounds.MaxX - 100, _bounds.MaxY - 100); _targetZone.DrawRect(new CCPoint(0, 0), 50, CCColor4B.Transparent); AddChild(_targetZone); var coinSprite = new CCSprite("coin"); _targetZone.AddChild(coinSprite); _line = new CCDrawNode(); AddChild(_line); _ball = new CCDrawNode(); _ball.Position = new CCPoint(100, 100); _ball.DrawCircle(new CCPoint(0, 0), 50, CCColor4B.Transparent); AddChild(_ball); ReorderChild(_ball, 2); var ballSprite = new CCSprite("ball"); _ball.AddChild(ballSprite); //ballSprite.Scale = 0.15f; _ball.ReorderChild(ballSprite, 2); _glow = new CCParticleSun(new CCPoint(0, 0), CCEmitterMode.Radius); _glow.StartColor = new CCColor4F(CCColor3B.Orange); _glow.EndColor = new CCColor4F(CCColor3B.Yellow); _glow.StartRadius = _ball.ContentSize.Width * 0.4f; _glow.EndRadius = _ball.ContentSize.Width * 0.5f; Schedule(RunGameLogic); // Register for touch events var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesBegan = OnTouchesBegan; touchListener.OnTouchesEnded = OnTouchesEnded; touchListener.OnTouchesMoved = HandleTouchesMoved; AddEventListener(touchListener, _ball); }
public Joystick(CCPoint center) { socket = new CCDrawNode(); stick = new CCDrawNode(); analogStick = new TouchScreenAnalogStick(); socket.DrawCircle(center, 50, CCColor4B.Black); stick.DrawCircle(center, 10, CCColor4B.Black); AddChild(socket); AddChild(stick); var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesMoved = HandleTouchesMoved; socket.AddEventListener(touchListener); }
public GameScene(CCGameView gameView) : base(gameView) { var layer = new CCLayer(); this.AddLayer(layer); circle = new CCDrawNode(); layer.AddChild(circle); circle.DrawCircle( // The center to use when drawing the circle, // relative to the CCDrawNode: new CCPoint(0, 0), radius: 15, color: CCColor4B.White); circle.PositionX = 20; circle.PositionY = 50; }
void RenderDrawPrimTest() { CCSize size = Layer.VisibleBoundsWorldspace.Size; var visibleRect = VisibleBoundsWorldspace; CCDrawNode drawNode = new CCDrawNode(); // *NOTE* Using the Director.ContentScaleFactor for now until we work something out with the initialization // CCDrawPriitives should be able to do this converstion themselves. // draw a simple line // The default state is: // Line Width: 1 // color: 255,255,255,255 (white, non-transparent) // Anti-Aliased // glEnable(GL_LINE_SMOOTH); float lineWidth = 1.0f; CCColor4B lineColor = CCColor4B.White; drawNode.DrawLine(visibleRect.LeftBottom(), visibleRect.RightTop(), lineWidth); // line: color, width, aliased lineWidth = 5.0f; lineColor = CCColor4B.Red; drawNode.DrawLine(visibleRect.LeftTop(), visibleRect.RightBottom(), lineWidth, lineColor); // TIP: // If you are going to use always thde same color or width, you don't // need to call it before every draw // // draw big point in the center drawNode.DrawSolidCircle(visibleRect.Center(), 64.0f, new CCColor4B(0, 0, 255, 128)); // draw 4 small points CCPoint[] points = { new CCPoint(60, 60), new CCPoint(70, 70), new CCPoint(60, 70), new CCPoint(70, 60) }; foreach (CCPoint point in points) { drawNode.DrawSolidCircle(point, 8.0f, new CCColor4B(0, 255, 255, 255)); } // draw a green circle with 10 segments drawNode.DrawCircle(visibleRect.Center, 100.0f, 10, CCColor4B.Green); // draw an arc drawNode.DrawSolidArc(visibleRect.Center, 10.0f, 0, 180, CCColor4B.AliceBlue); // draw an ellipse within rectangular region drawNode.DrawEllipse(new CCRect(100, 100, 100, 200), 10.0f, CCColor4B.Red); // open yellow poly CCPoint[] vertices = { new CCPoint(0, 0), new CCPoint(50, 50), new CCPoint(100, 50), new CCPoint(100, 100), new CCPoint(50, 100) }; // draw quad bezier path drawNode.DrawQuadBezier( new CCPoint(0, size.Height), visibleRect.Center, (CCPoint)visibleRect.Size, 50, 10.0f, new CCColor4B(255, 0, 255, 255)); // draw cubic bezier path drawNode.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, 10.0f, new CCColor4B(255, 0, 255, 255)); //draw a solid polygon CCPoint[] vertices3 = { new CCPoint(60, 160), new CCPoint(70, 190), new CCPoint(100, 190), new CCPoint(90, 160) }; drawNode.DrawPolygon(vertices3, 4, new CCColor4F(1, 1, 0, 1), 1.0f, new CCColor4F(1, 1, 0, 1)); AddChild(drawNode); }