本文整理汇总了C#中cocos2d.CCPoint类的典型用法代码示例。如果您正苦于以下问题:C# CCPoint类的具体用法?C# CCPoint怎么用?C# CCPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCPoint类属于cocos2d命名空间,在下文中一共展示了CCPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ccTouchesMoved
public override void ccTouchesMoved(List<CCTouch> pTouches, CCEvent pEvent)
{
foreach (var it in pTouches)
{
CCTouch touch = it;
CCPoint touchLocation = touch.locationInView(touch.view());
touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation);
float nMoveY = touchLocation.y - m_tBeginPos.y;
CCPoint curPos = m_pItmeMenu.position;
CCPoint nextPos = new CCPoint(curPos.x, curPos.y + nMoveY);
CCSize winSize = CCDirector.sharedDirector().getWinSize();
if (nextPos.y < 0.0f)
{
m_pItmeMenu.position = new CCPoint(0, 0);
return;
}
if (nextPos.y > ((BugsTestScene.MAX_COUNT + 1) * BugsTestScene.LINE_SPACE - winSize.height))
{
m_pItmeMenu.position = new CCPoint(0, ((BugsTestScene.MAX_COUNT + 1) * BugsTestScene.LINE_SPACE - winSize.height));
return;
}
m_pItmeMenu.position = nextPos;
m_tBeginPos = touchLocation;
BugsTestScene.s_tCurPos = nextPos;
}
}
开发者ID:hiceka,项目名称:cocos2d-x-for-xna,代码行数:30,代码来源:BugsTestMainLayer.cs
示例2: pointWithCCPoint
public static CCPointObject pointWithCCPoint(CCPoint ratio, CCPoint offset)
{
CCPointObject pRet = new CCPointObject();
pRet.initWithCCPoint(ratio, offset);
//pRet->autorelease();
return pRet;
}
开发者ID:Openxlive,项目名称:cocos2d-x-for-xna,代码行数:7,代码来源:CCPointObject.cs
示例3: StackObject
public StackObject(b2World world,
CCPoint location,
string spriteFileName,
bool breaksOnGround,
bool breaksFromNinja,
bool hasAnimatedBreakFrames,
bool damagesEnemy,
float density,
CreationMethod createHow,
int angleChange,
bool makeImmovable,
int points,
BreakEffect simpleScoreVisualFXType)
{
InitWithWorld(world,
location,
spriteFileName,
breaksOnGround,
breaksFromNinja,
hasAnimatedBreakFrames,
damagesEnemy,
density,
createHow,
angleChange,
makeImmovable,
points,
simpleScoreVisualFXType);
}
开发者ID:CasperWollesen,项目名称:AngryNinjas,代码行数:28,代码来源:StackObject.cs
示例4: LayerLevels
public LayerLevels()
{
//�ؿ�ѡ���
CCPoint offset = new CCPoint(170, 180);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
//�ؿ��İ�ť
CCMenuItemSprite level = CCMenuItemSprite.itemFromNormalSprite(
CCSprite.spriteWithSpriteFrameName("btn_level1.png"),
CCSprite.spriteWithSpriteFrameName("btn_level2.png"),
this, click_level);
CCMenu menu = CCMenu.menuWithItems(level);
//λ����������ϵ�UI����
menu.position = CCDirector.sharedDirector().convertToUI(new CCPoint(offset.x + 160 * i, offset.y + 85 * j));
this.addChild(menu);
//����һ��MenuItem�������ı�����
CCMenuItem menuitem = new CCMenuItem();
//ָ��Arial��������������֤fonts����Arial.spritefont
var text = CCLabelTTF.labelWithString((j * 4 + i + 1).ToString(), "Arial", 12);
//����ɫָ��Ϊ��ɫ
text.Color = new ccColor3B();
menuitem.addChild(text);
menu.addChild(menuitem);
}
}
}
开发者ID:Nowpaper,项目名称:SanguoCommander_cocos2dxna_Sample,代码行数:28,代码来源:LayerLevels.cs
示例5: initWithCCPoint
public bool initWithCCPoint(CCPoint ratio, CCPoint offset)
{
m_tRatio = ratio;
m_tOffset = offset;
m_pChild = null;
return true;
}
开发者ID:Openxlive,项目名称:cocos2d-x-for-xna,代码行数:7,代码来源:CCPointObject.cs
示例6: Run
public void Run(CCPoint p_Point)
{
WordListLayer start = new WordListLayer();
start.position = p_Point;
addChild(start);
CCDirector.sharedDirector().replaceScene(this);
}
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:7,代码来源:WordListScene.cs
示例7: updateSize
public void updateSize(CCPoint touchLocation)
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCSize newSize = new CCSize(Math.Abs(touchLocation.X - s.Width / 2) * 2, Math.Abs(touchLocation.Y - s.Height / 2) * 2);
CCLayerColor l = (CCLayerColor)GetChildByTag(kTagLayer);
l.ContentSize = newSize;
}
开发者ID:KogleDK,项目名称:cocos2d-xna-1,代码行数:7,代码来源:LayerTest1.cs
示例8: addNewSprite
public void addNewSprite()
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCPoint p = new CCPoint((float)(Random.NextDouble() * s.Width), (float)(Random.NextDouble() * s.Height));
CCSpriteBatchNode batch = (CCSpriteBatchNode)GetChildByTag((int)kTags.kTagSpriteBatchNode);
int idx = (int)(Random.NextDouble() * 1400 / 100);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = new CCSprite(batch.Texture, new CCRect(x, y, 85, 121));
batch.AddChild(sprite);
sprite.Position = (new CCPoint(p.X, p.Y));
CCActionInterval action;
float random = (float)Random.NextDouble();
if (random < 0.20)
action = new CCScaleBy(3, 2);
else if (random < 0.40)
action = new CCRotateBy (3, 360);
else if (random < 0.60)
action = new CCBlink (1, 3);
else if (random < 0.8)
action = new CCTintBy (2, 0, -255, -255);
else
action = new CCFadeOut (2);
CCActionInterval action_back = (CCActionInterval)action.Reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.FromActions(action, action_back));
sprite.RunAction(new CCRepeatForever (seq));
}
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:35,代码来源:SpriteBatchNodeNewTexture.cs
示例9: addNewSpriteWithCoords
public void addNewSpriteWithCoords(CCPoint p)
{
int idx = (int)(CCMacros.CCRandomBetween0And1() * 1400.0f / 100.0f);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));
AddChild(sprite);
sprite.Position = p;
CCActionInterval action;
float random = CCMacros.CCRandomBetween0And1();
if (random < 0.20)
action = new CCScaleBy(3, 2);
else if (random < 0.40)
action = new CCRotateBy (3, 360);
else if (random < 0.60)
action = new CCBlink (1, 3);
else if (random < 0.8)
action = new CCTintBy (2, 0, -255, -255);
else
action = new CCFadeOut (2);
object obj = action.Reverse();
CCActionInterval action_back = (CCActionInterval)action.Reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.FromActions(action, action_back));
sprite.RunAction(new CCRepeatForever (seq));
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:30,代码来源:Sprite1.cs
示例10: addNewSpriteWithCoords
public void addNewSpriteWithCoords(CCPoint p)
{
CCSpriteBatchNode BatchNode = (CCSpriteBatchNode)getChildByTag((int)kTags.kTagSpriteBatchNode);
int idx = (int)(rand.NextDouble() * 1400 / 100);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = CCSprite.spriteWithTexture(BatchNode.Texture, new CCRect(x, y, 85, 121));
BatchNode.addChild(sprite);
sprite.position = (new CCPoint(p.x, p.y));
CCActionInterval action = null;
float random = (float)rand.NextDouble();
if (random < 0.20)
action = CCScaleBy.actionWithDuration(3, 2);
else if (random < 0.40)
action = CCRotateBy.actionWithDuration(3, 360);
else if (random < 0.60)
action = CCBlink.actionWithDuration(1, 3);
else if (random < 0.8)
action = CCTintBy.actionWithDuration(2, 0, -255, -255);
else
action = CCFadeOut.actionWithDuration(2);
CCActionInterval action_back = (CCActionInterval)action.reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.actions(action, action_back));
sprite.runAction(CCRepeatForever.actionWithAction(seq));
}
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:33,代码来源:SpriteBatchNode1.cs
示例11: Enemy
public Enemy(b2World world,
CCPoint location,
string spriteFileName,
bool isTheRotationFixed,
bool getsDamageFromGround,
bool doesGetDamageFromDamageEnabledStackObjects,
int breaksFromHowMuchContact,
bool hasDifferentSpritesForDamage,
int numberOfFramesToAnimateOnBreak,
float density,
CreationMethod createHow,
int points,
BreakEffect simpleScoreVisualFXType )
{
InitWithWorld( world,
location,
spriteFileName,
isTheRotationFixed,
getsDamageFromGround,
doesGetDamageFromDamageEnabledStackObjects,
breaksFromHowMuchContact,
hasDifferentSpritesForDamage,
numberOfFramesToAnimateOnBreak,
density,
createHow,
points,
simpleScoreVisualFXType );
}
开发者ID:CasperWollesen,项目名称:AngryNinjas,代码行数:28,代码来源:Enemy.cs
示例12: CCPointApplyAffineTransform
public static CCPoint CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t)
{
CCPoint p = new CCPoint();
p.x = (float)((double)t.a * point.x + (double)t.c * point.y + t.tx);
p.y = (float)((double)t.b * point.x + (double)t.d * point.y + t.ty);
return p;
}
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:7,代码来源:CCAffineTransform.cs
示例13: addNewSpriteWithCoords
public void addNewSpriteWithCoords(CCPoint p)
{
int idx = (int)(ccMacros.CCRANDOM_0_1() * 1400.0f / 100.0f);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));
addChild(sprite);
sprite.position = p;
CCActionInterval action;
float random = ccMacros.CCRANDOM_0_1();
if (random < 0.20)
action = CCScaleBy.actionWithDuration(3, 2);
else if (random < 0.40)
action = CCRotateBy.actionWithDuration(3, 360);
else if (random < 0.60)
action = CCBlink.actionWithDuration(1, 3);
else if (random < 0.8)
action = CCTintBy.actionWithDuration(2, 0, -255, -255);
else
action = CCFadeOut.actionWithDuration(2);
object obj = action.reverse();
CCActionInterval action_back = (CCActionInterval)action.reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.actions(action, action_back));
sprite.runAction(CCRepeatForever.actionWithAction(seq));
}
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:30,代码来源:Sprite1.cs
示例14: resetAndScoreBallForPlayer
public void resetAndScoreBallForPlayer(int player)
{
m_ballStartingVelocity = new CCPoint(m_ballStartingVelocity.x * -1.1f, m_ballStartingVelocity.y * -1.1f);
m_ball.Velocity = m_ballStartingVelocity;
m_ball.position = new CCPoint(160.0f, 240.0f);
// TODO -- scoring
}
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:PongLayer.cs
示例15: InitWithWorld
private void InitWithWorld( b2World world, CCPoint location, string spriteFileName)
{
this.theWorld = world;
this.initialLocation = location;
this.spriteImageName = spriteFileName;
CreateGround();
}
开发者ID:CasperWollesen,项目名称:AngryNinjas,代码行数:8,代码来源:GroundPlane.cs
示例16: initWithTarget
/// <summary>
/// Initializes a CCMenuItem with a target/selector
/// </summary>
/// <param name="rec"></param>
/// <param name="selector"></param>
/// <returns></returns>
public bool initWithTarget(SelectorProtocol rec, SEL_MenuHandler selector)
{
anchorPoint = new CCPoint(0.5f, 0.5f);
m_pListener = rec;
m_pfnSelector = selector;
m_bIsEnabled = true;
m_bIsSelected = false;
return true;
}
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:15,代码来源:CCMenuItem.cs
示例17: testFunc
public override float testFunc(ccGridSize pos, float time)
{
CCPoint n = new CCPoint((float)(m_sGridSize.x * time), (float)(m_sGridSize.y * time));
if (n.y == 0.0f)
{
return 1.0f;
}
return (float)Math.Pow(pos.y / n.y, 6);
}
开发者ID:hiceka,项目名称:cocos2d-x-for-xna,代码行数:10,代码来源:CCFadeOutUpTiles.cs
示例18: IsTouchNode
protected bool IsTouchNode(CCNode p_Node, List<CCTouch> touches)
{
CCRect rect = p_Node.boundingBox();
CCSize size = CCDirector.sharedDirector().getWinSize();
// rect.size = p_Node.contentSize;
CCPoint touch =new CCPoint( touches[0].locationInView(touches[0].view()).x, touches[0].locationInView(touches[0].view()).y);
touch.y = size.height - touch.y;
return CCRect.CCRectContainsPoint(rect, touch);
}
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:10,代码来源:BaseLayer.cs
示例19: testFunc
public virtual float testFunc(ccGridSize pos, float time)
{
CCPoint n = new CCPoint((float)(m_sGridSize.x * (1.0f - time)), (float)(m_sGridSize.y * (1.0f - time)));
if (pos.y == 0)
{
return 1.0f;
}
return (float)Math.Pow(n.y / pos.y, 6);
}
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:10,代码来源:CCFadeOutDownTiles.cs
示例20: testFunc
public override float testFunc(ccGridSize pos, float time)
{
CCPoint n = new CCPoint((float)(m_sGridSize.x * (1.0f - time)), (float)(m_sGridSize.y * (1.0f - time)));
if ((pos.x + pos.y) == 0)
{
return 1.0f;
}
return (float)Math.Pow((n.x + n.y) / (pos.x + pos.y), 6);
}
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:10,代码来源:CCFadeOutBLTiles.cs
注:本文中的cocos2d.CCPoint类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论