本文整理汇总了C#中Cocos2D.CCGridSize类的典型用法代码示例。如果您正苦于以下问题:C# CCGridSize类的具体用法?C# CCGridSize怎么用?C# CCGridSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCGridSize类属于Cocos2D命名空间,在下文中一共展示了CCGridSize类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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];
}
示例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);
}
示例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);
}
}
}
示例5: InitWithSize
protected virtual bool InitWithSize(CCGridSize gridSize, float duration)
{
if (base.InitWithDuration(duration))
{
m_sGridSize = gridSize;
return true;
}
return false;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
};
}
示例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);
}