• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setTouchMode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: setEnabled

bool Control::init()
{
    if (Layer::init())
    {
        // Initialise instance variables
        _state=Control::State::NORMAL;
        setEnabled(true);
        setSelected(false);
        setHighlighted(false);

        // x-studio365 spec
        setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
        setTouchEnabled(true);

        /*auto dispatcher = Director::getInstance()->getEventDispatcher();
        auto touchListener = EventListenerTouchOneByOne::create();
        touchListener->setSwallowTouches(true);
        touchListener->onTouchBegan = CC_CALLBACK_2(Control::onTouchBegan, this);
        touchListener->onTouchMoved = CC_CALLBACK_2(Control::onTouchMoved, this);
        touchListener->onTouchEnded = CC_CALLBACK_2(Control::onTouchEnded, this);
        touchListener->onTouchCancelled = CC_CALLBACK_2(Control::onTouchCancelled, this);
        
        dispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);*/
        
        return true;
    }
    else
    {
        return false;
    }
}
开发者ID:Jian0326,项目名称:cocos2d-x-pc-port,代码行数:31,代码来源:CCControl.cpp


示例17: setTouchEnabled

void SpriteBatchNodeTestPage::loadUI()
{
    setTouchEnabled(true);
    setTouchMode(kCCTouchesOneByOne);

    auto winSize = CocosWindow::size();
    auto origin = CocosWindow::origin();

    const std::string pic("Images/grossini_dance_01.png");
    size_t num(1000);

    /*for (size_t i=0; i<num; ++i)
    {
    auto dance = CCSprite::create(pic.c_str());
    CCPoint pos;
    pos.x = winSize.width * CCRANDOM_0_1();
    pos.y = winSize.height * CCRANDOM_0_1();
    dance->setPosition(pos);
    addChildRaw(dance);
    }*/

    CCSpriteBatchNode *batch = CCSpriteBatchNode::create(pic.c_str());
    for (size_t i=0; i<num; ++i) {
        auto dance = CCSprite::createWithTexture(batch->getTexture());
        CCPoint pos;
        pos.x = winSize.width * CCRANDOM_0_1();
        pos.y = winSize.height * CCRANDOM_0_1();
        dance->setPosition(pos);
        batch->addChild(dance);
    }
    ADD_CHILD(batch);
}
开发者ID:elloop,项目名称:cocos2d-x-cpp-demos-2.x,代码行数:32,代码来源:SpriteBatchNodeTestPage.cpp


示例18: setTouchMode

void EquipMeltView::onEnter()
{
    CCNode::onEnter();
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    setTouchEnabled(true);
    CCSafeNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(EquipMeltView::refreashData), EQUIP_MELT_SHOW, NULL);
}
开发者ID:ourgames,项目名称:dc208,代码行数:7,代码来源:EquipMeltView.cpp


示例19: ccp

bool T08CCSpriteBatchNode::init()
{
	if (!BaseLayer::init())
		return false;

	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
	CCPoint ptCenter = ccp(winSize.width / 2, winSize.height / 2);

	/*
		CCSpriteBatchNode是一个容器,只能包容CCSprite对象,要求这些精灵来自同一个纹理
	*/

	CCSpriteBatchNode* pBatch = CCSpriteBatchNode::create("CloseNormal.png");
	addChild(pBatch);
	pBatch->setTag(10);

	CCSprite *pSprite = CCSprite::createWithTexture(pBatch->getTexture());
	pBatch->addChild(pSprite);
	pSprite->setPosition(ptCenter);

	setTouchEnabled(true);
	setTouchMode(kCCTouchesOneByOne);

	return true;
}
开发者ID:dfwxb,项目名称:cocos_lesson2,代码行数:25,代码来源:T08CCSpriteBatchNode.cpp


示例20: mShow

TDDSubMenu::TDDSubMenu(const Size &size,
					   const Color4B &headerColor,
					   const Color4B &bodyColor,
					   const Color3B &textColor,
					   const std::string font,
					   const int fontSize)
: mShow(true)
, mHeaderLayer(NULL)
, mToggleButton(NULL)
, mIsPressed(false)
, mMenu(NULL)
, mBackButton(NULL)
{
	TDDSubMenu::initWithColor(bodyColor, size.width, size.height);
	
	mMaxSize.width = size.width;
	mMaxSize.height = size.height;
	
	// Add the header
	setupHeader(headerColor);
	setupMenu();
	
	// Set touch
	setTouchEnabled(true);
	setTouchMode(Touch::DispatchMode::ONE_BY_ONE);	// ???
}
开发者ID:dwdcth,项目名称:SimpleTDD-cocos2dx,代码行数:26,代码来源:TDDSubMenu.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setTrafficGraphRange函数代码示例发布时间:2022-05-30
下一篇:
C++ setTouchEnabled函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap