public DrawPrimitivesWithRenderTextureTest() { CCSize s = CCDirector.SharedDirector.WinSize; CCRenderTexture text = new CCRenderTexture((int)s.Width, (int)s.Height); CCDrawNode draw = new CCDrawNode(); text.AddChild(draw, 10); text.Begin(); // 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)); text.End(); AddChild(text, 24); }
public override void OnEnter() { base.OnEnter(); CCDrawNode circle = new CCDrawNode(); circle.DrawSolidCircle(new CCPoint(150.0f, 150.0f), 75.0f, new CCColor4B(255, 255, 255, 255)); CCRenderTexture rtm = new CCRenderTexture(new CCSize(200.0f, 200.0f), new CCSize(200.0f, 200.0f), CCSurfaceFormat.Color, CCDepthFormat.Depth24Stencil8); rtm.AddChild(circle); rtm.BeginWithClear(CCColor4B.Orange); rtm.End(); // Make sure our children nodes get visited rtm.AutoDraw = true; rtm.Position = VisibleBoundsWorldspace.Center; rtm.AnchorPoint = CCPoint.AnchorMiddle; AddChild(rtm); }
public override void OnEnter() { base.OnEnter(); var windowSize = Layer.VisibleBoundsWorldspace.Size; CCRenderTexture text = new CCRenderTexture(windowSize, windowSize); AddChild(text, 24); CCDrawNode draw = new CCDrawNode(); text.AddChild(draw, 10); text.Begin(); // 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, 0, 0, 0.5f), 4, new CCColor4F(0, 0, 1, 1)); text.End(); }