本文整理汇总了C#中CocosSharp.CCSprite.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# CCSprite.Visit方法的具体用法?C# CCSprite.Visit怎么用?C# CCSprite.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CocosSharp.CCSprite
的用法示例。
在下文中一共展示了CCSprite.Visit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEnter
public override void OnEnter()
{
base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;
CCSprite sprite = new CCSprite("Images/fire");
sprite.Position = new CCPoint(windowSize.Width * 0.25f, 0);
sprite.Scale = 10;
CCRenderTexture rend = new CCRenderTexture(windowSize, windowSize,
CCSurfaceFormat.Color,
CCDepthFormat.Depth24Stencil8, CCRenderTargetUsage.DiscardContents);
rend.BeginWithClear(0, 0, 0, 0, 0);
// var save = CCDrawManager.SharedDrawManager.DepthStencilState;
//
// CCDrawManager.SharedDrawManager.DepthStencilState = new DepthStencilState()
// {
// ReferenceStencil = 1,
//
// DepthBufferEnable = false,
// StencilEnable = true,
// StencilFunction = CompareFunction.Always,
// StencilPass = StencilOperation.Replace,
//
// TwoSidedStencilMode = true,
// CounterClockwiseStencilFunction = CompareFunction.Always,
// CounterClockwiseStencilPass = StencilOperation.Replace,
// };
sprite.Visit();
// CCDrawManager.SharedDrawManager.DepthStencilState = new DepthStencilState()
// {
// DepthBufferEnable = false,
// StencilEnable = true,
// StencilFunction = CompareFunction.NotEqual,
// StencilPass = StencilOperation.Keep,
// ReferenceStencil = 1
// };
// CCDrawManager.SharedDrawManager.BlendFunc(new CCBlendFunc(CCOGLES.GL_ONE, CCOGLES.GL_ONE_MINUS_SRC_ALPHA));
sprite.Position = sprite.Position
+ new CCPoint(sprite.ContentSize.Width * sprite.ScaleX, sprite.ContentSize.Height * sprite.ScaleY) * 0.5f;
sprite.Visit();
// CCDrawManager.SharedDrawManager.DepthStencilState = save;
rend.End();
rend.Sprite.Position = new CCPoint(windowSize.Width * 0.5f, windowSize.Height * 0.5f);
AddChild(rend.Sprite);
}
示例2: SpriteWithColor
public SpriteWithColor(CCColor4B bgColor, CCSize textureSizeInPixels) : base ()
{
// 1: Create new CCRenderTexture
CCRenderTexture rt = new CCRenderTexture(textureSizeInPixels, textureSizeInPixels);
// 2: Call CCRenderTexture:begin
rt.BeginWithClear(bgColor);
// 3: Draw into the texture
// You'll add this later
GenerateGradient(textureSizeInPixels);
var noise = new CCSprite("images/Noise.png");
noise.AnchorPoint = CCPoint.AnchorLowerLeft;
noise.Position = CCPoint.Zero;
noise.BlendFunc = new CCBlendFunc(CCOGLES.GL_DST_COLOR, CCOGLES.GL_ZERO);
noise.Texture.SamplerState = Microsoft.Xna.Framework.Graphics.SamplerState.LinearWrap;
// To get the linear wrap to work correctly we have to set the TextureRectInPixels as well as ContentSize
noise.TextureRectInPixels = new CCRect(0, 0, textureSizeInPixels.Width, textureSizeInPixels.Height);
noise.ContentSize = noise.TextureRectInPixels.Size;
noise.Visit();
// 4: Call CCRenderTexture:end
rt.End();
this.Texture = rt.Texture;
}
示例3: StripeWithColor
public StripeWithColor(CCColor4B c1, CCColor4B c2, CCSize textureSizeInPixels, int nStripes) : base ()
{
// 1: Create new CCRenderTexture
CCRenderTexture rt = new CCRenderTexture(textureSizeInPixels, textureSizeInPixels);
// 2: Call CCRenderTexture:begin
rt.BeginWithClear(c1);
// 3: Draw into the texture
// You'll add this later
GenerateStripes(textureSizeInPixels, c2, nStripes);
var noise = new CCSprite("images/Noise.png");
noise.AnchorPoint = CCPoint.AnchorLowerLeft;
noise.BlendFunc = new CCBlendFunc(CCOGLES.GL_DST_COLOR, CCOGLES.GL_ZERO);
noise.Visit();
// 4: Call CCRenderTexture:end
rt.End();
this.Texture = rt.Texture;
}