1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//GameScene.h@H_502_54@
#include"cocos2d.h"@H_502_54@
USING_NS_CC;@H_502_54@
{@H_502_54@
:@H_502_54@
@H_502_54@
onTouchBegan(Touch*touch,Event*unused_event);@H_502_54@
onTouchEnded(Touch*touch,Event*unused_event);@H_502_54@
@H_502_54@
menuCallback(cocos2d::Ref*pSender);@H_502_54@
@H_502_54@
};@H_502_54@
|
@H_404_160@
19
cocos2d::Scene*GameScene::createScene()@H_502_54@
{@H_502_54@
scene->addChild(layer);@H_502_54@
}@H_502_54@
//初始化当前的图层@H_502_54@
GameScene::init()@H_502_54@
{@H_502_54@
@H_502_54@
SizevisibleSize=Director::getInstance()->getVisibleSize();@H_502_54@
sprite->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));@H_502_54@
@H_502_54@
sprite1->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));@H_502_54@
sprite1->setTag(12);@H_502_54@
@H_415_404@->addChild(sprite1);@H_502_54@
@H_502_54@
//autolistener=EventListenerTouchAllAtOnce::create();//多点触摸@H_502_54@
//setTouchEnabled(true);//3.0版本已经被弃用@H_502_54@
@H_502_54@
listener->onTouchMoved=CC_CALLBACK_2(GameScene::onTouchMoved,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">);@H_502_54@
listener->onTouchEnded=CC_CALLBACK_2(GameScene::onTouchEnded,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">);@H_502_54@
@H_502_54@
_eventDispatcher->addEventListenerWithSceneGraPHPriority(listener,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">);@H_502_54@
@H_502_54@
}@H_502_54@
GameScene::onTouchBegan(Touch*touch,Event*unused_event)@H_502_54@
{@H_502_54@
//touch->getLocation();//获得的是OpenGL坐标@H_502_54@
//autop1=touch->getLocationInView();//获得的是UI坐标@H_502_54@
//autop2=Dirctor::getInstance()->convertToGL(p1);//转换成OpenGL坐标@H_502_54@
CCLOG(@H_502_54@
"TouchBeganx:%lf,y:%lf"@H_502_54@
@H_502_54@
//sprite->setPosition(Vec2(touch->getLocation().x,touch->getLocation().y));@H_502_54@
sprite->runAction(MoveTo::create(0.5f,Point(touch->getLocation().x,touch->getLocation().y)));@H_502_54@
;@H_502_54@
}@H_502_54@
GameScene::onTouchMoved(Touch*touch,Event*unused_event)@H_502_54@
{@H_502_54@
//图标随鼠标一起移动@H_502_54@
502_54@
}@H_502_54@
GameScene::onTouchEnded(Touch*touch,Event*unused_event)@H_502_54@
{@H_502_54@
@H_502_54@
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
@H_404_160@
19
cocos2d::Scene*GameScene::createScene()@H_502_54@
{@H_502_54@
scene->addChild(layer);@H_502_54@
}@H_502_54@
//初始化当前的图层@H_502_54@
GameScene::init()@H_502_54@
{@H_502_54@
@H_502_54@
SizevisibleSize=Director::getInstance()->getVisibleSize();@H_502_54@
502_54@
@H_502_54@
502_54@
sprite1->setTag(12);@H_502_54@
@H_415_404@->addChild(sprite1);@H_502_54@
@H_502_54@
//autolistener=EventListenerTouchAllAtOnce::create();//多点触摸@H_502_54@
//setTouchEnabled(true);//3.0版本已经被弃用@H_502_54@
@H_502_54@
502_54@
);@H_502_54@
);@H_502_54@
);@H_502_54@
@H_502_54@
);@H_502_54@
@H_502_54@
}@H_502_54@
502_54@
{@H_502_54@
//touch->getLocation();//获得的是OpenGL坐标@H_502_54@
//autop1=touch->getLocationInView();//获得的是UI坐标@H_502_54@
//autop2=Dirctor::getInstance()->convertToGL(p1);//转换成OpenGL坐标@H_502_54@
CCLOG(@H_502_54@
502_54@
@H_502_54@
502_54@
502_54@
;@H_502_54@
}@H_502_54@
502_54@
{@H_502_54@
//图标随鼠标一起移动@H_502_54@
502_54@
}@H_502_54@
502_54@
{@H_502_54@
|