当前位置: 首页>>代码示例>>C++>>正文


C++ setTouchMode函数代码示例

本文整理汇总了C++中setTouchMode函数的典型用法代码示例。如果您正苦于以下问题:C++ setTouchMode函数的具体用法?C++ setTouchMode怎么用?C++ setTouchMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setTouchMode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initPhysics

void BaseScene::macroDefineInInit(){
#ifndef NOBOX2D1
	initPhysics();

	// create a polygon body
	/*b2BodyDef bodydef;
	bodydef.type = b2_dynamicBody;
	bodydef.position = b2Vec2(200 / RTM_RATIO, 400 / RTM_RATIO);
	b2Body* b2 = world->CreateBody(&bodydef);
	b2PolygonShape polygon;
	b2Vec2 v[4];
	v[0].Set(-1.5, 1.5);
	v[1].Set(1.5, 1.5);
	v[2].Set(1.5, -1.5);
	v[3].Set(-1.5, -1.5);
	polygon.Set(v, 4);
	b2->CreateFixture(&polygon, 0.5);*/
#endif

#ifndef NOTOUCHONEBYONEEVENT1
	// 这段代码好像不写也可以
	setTouchEnabled(true);
	setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
#endif

#ifndef NOTOUCHALLATONCEEVENT
	// 这段代码好像不写也可以
	setTouchEnabled(true);
	setTouchMode(Touch::DispatchMode::ALL_AT_ONCE);
#endif

}
开发者ID:yinglang,项目名称:DemoWork,代码行数:32,代码来源:BaseScene.cpp

示例2: setTouchMode

void AllianceRankAttrView::onEnter(){
    PopupBaseView::onEnter();
    this->setTitleName(_lang("115904"));
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    setTouchEnabled(true);
    //CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 1, false);
}
开发者ID:ourgames,项目名称:dc208,代码行数:7,代码来源:AllianceRankAttrView.cpp

示例3: setSwallowsTouches

void AllianceFlagPar::onEnter(){
    CCNode::onEnter();
    setSwallowsTouches(false);
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    setTouchEnabled(true);
    //CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, Touch_Popup, false);
}
开发者ID:ourgames,项目名称:dc208,代码行数:7,代码来源:AllianceFlagPar.cpp

示例4: setTouchEnabled

bool Box2DView::initWithEntryID(int entryId)
{    
//    setIsAccelerometerEnabled( true );
    setTouchEnabled( true );
    
    schedule( schedule_selector(Box2DView::tick) );

    m_entry = g_testEntries + entryId;
    m_test = m_entry->createFcn();
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    
    // Removes Touch Event Listener
    EventDispatcher::getInstance()->removeEventListener(_touchListener);
    
    // Adds Touch Event Listener
    auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE);
    listener->setSwallowTouches(true);
    
    listener->onTouchBegan = CC_CALLBACK_2(Box2DView::onTouchBegan, this);
    listener->onTouchMoved = CC_CALLBACK_2(Box2DView::onTouchMoved, this);
    listener->onTouchEnded = CC_CALLBACK_2(Box2DView::onTouchEnded, this);
    
    EventDispatcher::getInstance()->addEventListenerWithFixedPriority(listener, -10);
    _touchListener = listener;
    
    return true;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:27,代码来源:Box2dView.cpp

示例5: setMessage

bool HMessageBox::init(const char* msg, const char* title, int buttons, int style, HMessageDelegate* delegate)
{
    m_pLabelMessage->setString(msg);
    if (title && strlen(title) > 0) m_pLabelTitle->setString(title);
    m_pDelegate = delegate;
    m_showStyle = style;
    setMessage(CCString::create(msg));
    
    if (HNewbieGuide::isPass(214, 5) && !HNewbieGuide::isPass(214, 6)) {
        HNewbieGuide* guide = HNewbieGuide::create(214, 6);
        if (guide) {
            guide->showIn(this);
            guide->runAction(HGuideClick::create(6, m_pBtnOk));
            guide->hiddenAfterActionWithoutAnima();
        }
    }
 
    m_pBtnOk->setVisible(buttons != HMB_CANCEL);
    m_pBtnCancel->setVisible(buttons != HMB_OK);
    
    m_pBtnOk->setTouchPriority(-500);
    m_pBtnCancel->setTouchPriority(-500);
    
    setTouchMode(kCCTouchesOneByOne);
    setTouchPriority(-200);
    
    if (buttons == HMB_OK || buttons == HMB_CANCEL) {
        m_pBtnOk->setPositionX(240);
        m_pBtnCancel->setPositionX(240);
    }
    
    
    return true;
}
开发者ID:hyizsg,项目名称:mytest1st,代码行数:34,代码来源:HMessageBox.cpp

示例6: tolua_Cocos2d_Node_setTouchMode

static int tolua_Cocos2d_Node_setTouchMode(lua_State* tolua_S)
{
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (
        !tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err) ||
        !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
        !tolua_isnoobj(tolua_S,3,&tolua_err)
        )
        goto tolua_lerror;
    else
#endif
    {
        Node* self = (Node*)  tolua_tousertype(tolua_S,1,0);
        int mode = ((int)  tolua_tonumber(tolua_S,2,0));
#if COCOS2D_DEBUG >= 1
        if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setTouchMode'", nullptr);
#endif
        {
            auto mng = LuaNodeManager::getInstance();
            auto lnode = mng->getLuaNodeByNode(self, true);
            if (!lnode) {
                return 0;
            }
            lnode->setTouchMode(mode);
        }
    }
    return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'setTouchMode'.",&tolua_err);
    return 0;
#endif
}
开发者ID:JackTongy,项目名称:shared,代码行数:34,代码来源:lua_cocos2dx_quick_manual.cpp

示例7: CCLOG

void TouchLayer::onEnter()
{
	CCLayer::onEnter();
	CCLOG("Enter");
	setTouchEnabled(true);
	setTouchMode(kCCTouchesOneByOne);
}
开发者ID:pfzq303,项目名称:RunGame,代码行数:7,代码来源:TouchLayer.cpp

示例8: setTouchMode

void UILayer::onEnter()
{
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    setTouchEnabled(true);
    CCLayer::onEnter();
    
}
开发者ID:duongbadu,项目名称:FightGame,代码行数:7,代码来源:UILayer.cpp

示例9: setTouchEnabled

////////////////////////////////////////////////////////
//
// TouchesPerformTest1
//
////////////////////////////////////////////////////////
void TouchesPerformTest1::onEnter()
{
    TouchesMainScene::onEnter();
    setTouchEnabled(true);
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    setSwallowsTouches(true);
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:12,代码来源:PerformanceTouchesTest.cpp

示例10: addChild

bool CCRookieGuide::init() {
    if(!CCLayer::init()) {
        return false;
    }
	
	// stencil
	m_stencil = CCDrawNode::create();
	m_stencil->setPosition(CCPointZero);
	
	// clipper
	m_clipper = CCClippingNode::create();
	m_clipper->setPosition(CCPointZero);
	m_clipper->setStencil(m_stencil);
	m_clipper->setInverted(true);
	addChild(m_clipper);
	
	// add bg
	m_content = CCLayerColor::create(m_bgColor);
	m_clipper->addChild(m_content);
    
    // enable event, and set top priority
    setTouchEnabled(true);
    setTouchMode(kCCTouchesOneByOne);
    setTouchPriority(-MAX_INT);
    setKeypadEnabled(true);
    
    return true;
}
开发者ID:cfpt,项目名称:cocos2dx-common,代码行数:28,代码来源:CCRookieGuide.cpp

示例11: addChild

bool GameScene::init()
{
	if (!LayerColor::initWithColor(Color4B::WHITE))
	{
		return false;
	}
	
	this->setContentSize(Director::getInstance()->getVisibleSize());
	this->setColor(Color3B::WHITE);

	_size = Director::getInstance()->getVisibleSize();

	auto edge = Edge::create();
	edge->setPosition(_size.width/2,_size.height/2);
	addChild(edge);


	h = Hero::create();
	addChild(h);
	h->setPosition(200,300);
	h->setScale(0.5, 0.5);

	schedule(schedule_selector(GameScene::blockUpdate),1.0f);
	schedule(schedule_selector(GameScene::failUpdate), 1.0f);

	setTouchEnabled(true);
	setTouchMode(Touch::DispatchMode::ONE_BY_ONE);


	return true;
}
开发者ID:slienthuang,项目名称:MyGame,代码行数:31,代码来源:GameScene.cpp

示例12: setTouchEnabled

void GameLoadingLayer::onEnter()
{
    setTouchEnabled(true);
    //设置父节点为一次响应
    setTouchMode(kCCTouchesOneByOne);
    CCLayer::onEnter();
}
开发者ID:itismyera,项目名称:SZ,代码行数:7,代码来源:GameLoadingScene.cpp

示例13: setTouchMode

void LotteryAct2ShowView::onEnter()
{
    CCNode::onEnter();
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    setTouchEnabled(true);
    //CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 0, false);
}
开发者ID:ourgames,项目名称:dc208,代码行数:7,代码来源:LotteryAct2ShowView.cpp

示例14: SEL_TouchEvent

bool GameLoading::init()
{
	if (Layer::init())
	{
		loginUI = NodeGrid::create(); 
		//将UILayer层加入到当前的场景 
		this->addChild(loginUI); 
		Layout *m_pWidget = dynamic_cast<Layout*>(cocostudio::GUIReader::shareReader()->widgetFromJsonFile("login_1.json"));
		loginUI->addChild(m_pWidget);

		startBtn = dynamic_cast<Button*> (Helper::seekWidgetByName(m_pWidget, "btn_start"));

		startBtn->setPressedActionEnabled(true);
		startBtn->setBright(true);

		startBtn->addTouchEventListener(this, SEL_TouchEvent(&GameLoading::startGameTouchListener));

		this->schedule(schedule_selector(GameLoading::doing), 0.0f, kRepeatForever, 1);

		_res = new CommonRes();
		_res->load();

		_waveAction = WaterWaveAction::create(10000, Size(200, 200));
		loginUI->runAction(_waveAction);
		
		_lastUpdate = new struct timeval;
		
		setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
		setTouchEnabled(true);

		return true;
	}

	return false;
}
开发者ID:qing7ling0,项目名称:LQProjects,代码行数:35,代码来源:GameLoadingScene.cpp

示例15: CreatePlate

bool GameStartLayer::init() 			
{ 						
	CCLayer::init(); 			

	CreatePlate();
	Stone::_d = winSize.height / 10;;
	Stone::_offx = Stone::_d;
	Stone::_offy = Stone::_d / 2;

	for (int i = 0; i < 32; i++)
	{
		_s[i] = Stone::create();
		_s[i]->initStone(i);
		addChild(_s[i]);
	}

	setTouchEnabled(true);
	//! 默认是多点触摸
	setTouchMode(kCCTouchesOneByOne);

	_selectid = -1;
	_selectedSprite = CCSprite::create("selected.png");
	_selectedSprite->setVisible(false);
	_selectedSprite->setScale(0.6f);
	_selectedSprite->setZOrder(100);
	addChild(_selectedSprite);

	_bRedTurn = true;
	_steps.clear();

	addCtrlPanel();

	return true;				
} 						
开发者ID:dalechngame,项目名称:mygame,代码行数:34,代码来源:GameStartLayer.cpp


注:本文中的setTouchMode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。