public override void OnEnter() { base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size; spritePremulti.Position = new CCPoint(16, 48); spriteNonpremulti.Position = new CCPoint(16, 16); CCSize rendSize = new CCSize(32, 64); /* A2 & B2 setup */ CCRenderTexture rend = new CCRenderTexture(rendSize,rendSize); // It's possible to modify the RenderTexture blending function by // CCBlendFunc bf = new CCBlendFunc (OGLES.GL_ONE, OGLES.GL_ONE_MINUS_SRC_ALPHA); // rend.Sprite.BlendFunc = bf; rend.Begin(); // A2 spritePremulti.Visit(); // B2 spriteNonpremulti.Visit(); rend.End(); /* A1: setup */ spritePremulti.Position = new CCPoint(windowSize.Width / 2 - 16, windowSize.Height / 2 + 16); /* B1: setup */ spriteNonpremulti.Position = new CCPoint(windowSize.Width / 2 - 16, windowSize.Height / 2 - 16); rend.Position = new CCPoint(windowSize.Width / 2 + 16, windowSize.Height / 2); AddChild(spriteNonpremulti); AddChild(spritePremulti); AddChild(rend); }
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(); }
public void renderScreenShot() { var size = Layer.VisibleBoundsWorldspace.Size; var texture = new CCRenderTexture(size,size); //var texture = new CCRenderTexture(512, 512); texture.AnchorPoint = new CCPoint(0, 0); texture.Begin(); Visit(); texture.End(); CCSprite sprite = new CCSprite(texture.Sprite.Texture); //sprite.Position = new CCPoint(256, 256); sprite.Position = new CCPoint(size.Width/2, size.Height / 2); sprite.Opacity = 182; //sprite.IsFlipY = true; AddChild(sprite, 999999); sprite.Color = CCColor3B.Green; sprite.RunAction( new CCSequence( new CCFadeTo (2, 0), new CCHide() ) ); }