本文整理汇总了C#中Cocos2D.CCGridSize类的典型用法代码示例。如果您正苦于以下问题:C# CCGridSize类的具体用法?C# CCGridSize怎么用?C# CCGridSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCGridSize类属于Cocos2D命名空间,在下文中一共展示了CCGridSize类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InitWithSize
protected virtual bool InitWithSize(CCGridSize gridSize, CCTexture2D pTexture, bool bFlipped)
{
bool bRet = true;
m_bActive = false;
m_nReuseGrid = 0;
m_sGridSize = gridSize;
m_pTexture = pTexture;
m_bIsTextureFlipped = bFlipped;
CCSize texSize = m_pTexture.ContentSize;
m_obStep.X = texSize.Width / m_sGridSize.X;
m_obStep.Y = texSize.Height / m_sGridSize.Y;
m_pGrabber = new CCGrabber();
if (m_pGrabber != null)
{
m_pGrabber.Grab(m_pTexture);
}
else
{
bRet = false;
}
//m_pShaderProgram = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTexture);
CalculateVertexPoints();
return bRet;
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:31,代码来源:CCGridBase.cs
示例2: TileAt
public Color TileAt(CCGridSize position)
{
Debug.Assert(m_pTGAInfo != null, "tgaInfo must not be nil");
Debug.Assert(position.X < m_pTGAInfo.width, "Invalid position.x");
Debug.Assert(position.Y < m_pTGAInfo.height, "Invalid position.y");
return m_pTGAInfo.imageData[position.X + position.Y * m_pTGAInfo.width];
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:8,代码来源:CCTileMapAtlas.cs
示例3: TestFunc
public override float TestFunc(CCGridSize pos, float time)
{
float fy = m_sGridSize.Y * time;
if(fy == 0f) {
return(1f);
}
return (float) Math.Pow(pos.Y / fy, 6);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:8,代码来源:CCFadeOutUpTiles.cs
示例4: Update
public override void Update(float time)
{
float tt = Math.Max(0, time - 0.25f);
float deltaAy = (tt * tt * 500);
float ay = -100 - deltaAy;
float deltaTheta = -MathHelper.PiOver2 * (float) Math.Sqrt(time);
float theta = /*0.01f */ +MathHelper.PiOver2 + deltaTheta;
var sinTheta = (float) Math.Sin(theta);
var cosTheta = (float) Math.Cos(theta);
for (int i = 0; i <= m_sGridSize.X; ++i)
{
for (int j = 0; j <= m_sGridSize.Y; ++j)
{
// Get original vertex
var gs = new CCGridSize(i, j);
CCVertex3F p = OriginalVertex(gs);
var R = (float) Math.Sqrt((p.X * p.X) + ((p.Y - ay) * (p.Y - ay)));
float r = R * sinTheta;
var alpha = (float) Math.Asin(p.X / R);
float beta = alpha / sinTheta;
var cosBeta = (float) Math.Cos(beta);
// If beta > PI then we've wrapped around the cone
// Reduce the radius to stop these points interfering with others
if (beta <= MathHelper.Pi)
{
p.X = (r * (float) Math.Sin(beta));
}
else
{
// Force X = 0 to stop wrapped
// points
p.X = 0;
}
p.Y = (R + ay - (r * (1 - cosBeta) * sinTheta));
// We scale z here to avoid the animation being
// too much bigger than the screen due to perspective transform
p.Z = (r * (1 - cosBeta) * cosTheta) / 7; // "100" didn't work for
// Stop z coord from dropping beneath underlying page in a transition
// issue #751
if (p.Z < 0.5f)
{
p.Z = 0.5f;
}
// Set new coords
SetVertex(gs, ref p);
}
}
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:57,代码来源:CCPageTurn3D.cs
示例5: InitWithSize
protected virtual bool InitWithSize(CCGridSize gridSize, float duration)
{
if (base.InitWithDuration(duration))
{
m_sGridSize = gridSize;
return true;
}
return false;
}
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:9,代码来源:CCGridAction.cs
示例6: TestFunc
public override float TestFunc(CCGridSize pos, float time)
{
var n = new CCPoint((m_sGridSize.X * (1.0f - time)), (m_sGridSize.Y * (1.0f - time)));
if (pos.Y == 0)
{
return 1.0f;
}
return (float) Math.Pow(n.Y / pos.Y, 6);
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:10,代码来源:CCFadeOutDownTiles.cs
示例7: TestFunc
public virtual float TestFunc(CCGridSize pos, float time)
{
float px = m_sGridSize.X * time;
float py = m_sGridSize.Y * time;
if ((px + py) == 0.0f)
{
return 1.0f;
}
return (float) Math.Pow((pos.X + pos.Y) / (px + py), 6);
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:11,代码来源:CCFadeOutTRTiles.cs
示例8: InitWithWaves
public bool InitWithWaves(int wav, float amp, CCGridSize gridSize, float duration)
{
if (InitWithSize(gridSize, duration))
{
m_nWaves = wav;
m_fAmplitude = amp;
m_fAmplitudeRate = 1.0f;
return true;
}
return false;
}
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:11,代码来源:CCWaves3D.cs
示例9: InitWithSize
protected override bool InitWithSize(CCGridSize gridSize, float duration)
{
if (gridSize.X != 1 || gridSize.Y != 1)
{
// Grid size must be (1,1)
Debug.Assert(false);
return false;
}
return base.InitWithSize(gridSize, duration);
}
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:11,代码来源:CCFlipX3D.cs
示例10: InitWithWaves
public bool InitWithWaves(float duration, CCGridSize gridSize, int waves, float amplitude)
{
if (InitWithDuration(duration, gridSize))
{
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
}
return false;
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCWaves3D.cs
示例11: InitWithDuration
/// <summary>
/// initializes the action with a number of waves, the waves amplitude, the grid size and the duration
/// </summary>
protected virtual bool InitWithDuration(float duration, CCGridSize gridSize, int waves, float amplitude)
{
if (base.InitWithDuration(duration, gridSize))
{
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
}
return false;
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:16,代码来源:CCWavesTiles3D.cs
示例12: InitWithJumps
/// <summary>
/// initializes the action with the number of jumps, the sin amplitude, the grid size and the duration
/// </summary>
protected virtual bool InitWithJumps(int j, float amp, CCGridSize gridSize, float duration)
{
if (base.InitWithSize(gridSize, duration))
{
m_nJumps = j;
m_fAmplitude = amp;
m_fAmplitudeRate = 1.0f;
return true;
}
return false;
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:16,代码来源:CCJumpTiles3D.cs
示例13: SetTile
/// <summary>
/// sets a new tile
/// </summary>
public void SetTile(CCGridSize pos, ref CCQuad3 coords)
{
int idx = (m_sGridSize.Y * pos.X + pos.Y) * 4;
CCV3F_T2F[] vertArray = m_pVertices;
vertArray[idx + 0].vertices = coords.BottomLeft;
vertArray[idx + 1].vertices = coords.BottomRight;
vertArray[idx + 2].vertices = coords.TopLeft;
vertArray[idx + 3].vertices = coords.TopRight;
m_bDirty = true;
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:16,代码来源:CCTiledGrid3D.cs
示例14: Tile
/// <summary>
/// returns the tile at the given position
/// </summary>
public CCQuad3 Tile(CCGridSize pos)
{
int idx = (m_sGridSize.Y * pos.X + pos.Y) * 4;
CCV3F_T2F[] vertArray = m_pVertices;
return new CCQuad3
{
BottomLeft = vertArray[idx + 0].vertices,
BottomRight = vertArray[idx + 1].vertices,
TopLeft = vertArray[idx + 2].vertices,
TopRight = vertArray[idx + 3].vertices
};
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:17,代码来源:CCTiledGrid3D.cs
示例15: TransformTile
public override void TransformTile(CCGridSize pos, float distance)
{
CCQuad3 coords = OriginalTile(pos);
CCPoint step = m_pTarget.Grid.Step;
float dy = (step.Y / 2) * (1.0f - distance);
coords.BottomLeft.Y += dy; // (step.Y / 2) * (1.0f - distance);
coords.BottomRight.Y += dy; // (step.Y / 2) * (1.0f - distance);
coords.TopLeft.Y -= dy; // (step.Y / 2) * (1.0f - distance);
coords.TopRight.Y -= dy; // (step.Y / 2) * (1.0f - distance);
SetTile(pos, ref coords);
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:14,代码来源:CCFadeOutUpTiles.cs
示例16: InitWithWaves
protected virtual bool InitWithWaves(int wav, float amp, bool h, bool v, CCGridSize gridSize, float duration)
{
if (base.InitWithSize(gridSize, duration))
{
m_nWaves = wav;
m_fAmplitude = amp;
m_fAmplitudeRate = 1.0f;
m_bHorizontal = h;
m_bVertical = v;
return true;
}
return false;
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:15,代码来源:CCWaves.cs
示例17: initWithDuration
protected virtual bool initWithDuration(float duration, CCGridSize gridSize, CCPoint position, int twirls,
float amplitude)
{
if (base.InitWithDuration(duration, gridSize))
{
m_positionInPixels = new CCPoint();
Position = position;
m_nTwirls = twirls;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
}
return false;
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:16,代码来源:CCTwirl.cs
示例18: InitWithDuration
protected virtual bool InitWithDuration(float duration, CCGridSize gridSize, int waves, float amplitude,
bool horizontal, bool vertical)
{
if (base.InitWithDuration(duration, gridSize))
{
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
m_bHorizontal = horizontal;
m_bVertical = vertical;
return true;
}
return false;
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:16,代码来源:CCWaves.cs
示例19: InitWithPosition
protected virtual bool InitWithPosition(CCPoint pos, int t, float amp, CCGridSize gridSize,
float duration)
{
if (base.InitWithSize(gridSize, duration))
{
m_positionInPixels = new CCPoint();
Position = pos;
m_nTwirls = t;
m_fAmplitude = amp;
m_fAmplitudeRate = 1.0f;
return true;
}
return false;
}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:16,代码来源:CCTwirl.cs
示例20: InitWithPosition
public bool InitWithPosition(CCPoint pos, float r, CCGridSize gridSize, float duration)
{
if (base.InitWithSize(gridSize, duration))
{
m_position = new CCPoint(-1, -1);
m_positionInPixels = new CCPoint();
Position = pos;
m_fRadius = r;
m_fLensEffect = 0.7f;
m_bDirty = true;
return true;
}
return false;
}
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:17,代码来源:CCLens3D.cs
注:本文中的Cocos2D.CCGridSize类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论