欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當(dāng)前位置:主頁 > 軟件編程 > C語言 >

Cocos2d-x UI開發(fā)之CCControlSwitch控件類使用實例

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C語言|點擊: 次

CCControlSwitch是開關(guān)按鈕,關(guān)于控件使用時的一些配置,請參見文章:UI開發(fā)之控件類-CCControlButton。以下的演示中出現(xiàn)的key和value代表什么意思,知道的人說一聲。

bool HelloWorld::init()
{
  bool bRet = false;
  do
  {

    CC_BREAK_IF(! CCLayer::init());

		//參數(shù)就不說了,看一下你的資源文件就明白了
		CCControlSwitch * controlSwitch = CCControlSwitch::create(
			CCSprite::create("extensions/switch-mask.png"),
			CCSprite::create("extensions/switch-on.png"),
			CCSprite::create("extensions/switch-off.png"),
			CCSprite::create("extensions/switch-thumb.png"),
			CCLabelTTF::create("On", "Arial-BoldMT", 16),
			CCLabelTTF::create("Off", "Arial-BoldMT", 16));

		//設(shè)置位置
		controlSwitch->setPosition(ccp(240,160));

		//這個函數(shù)對應(yīng)初始時,開關(guān)的狀態(tài)是開還是關(guān)。
		controlSwitch->setOn(true);
		//這個函數(shù)對應(yīng)開關(guān)能否使用。
		controlSwitch->setEnabled(true);

		//添加事件監(jiān)聽
		controlSwitch->addTargetWithActionForControlEvents(this,cccontrol_selector(HelloWorld::valueChanged),
			CCControlEventValueChanged);

		this->addChild(controlSwitch);

    bRet = true;
  } while (0);

  return bRet;
}

void HelloWorld::valueChanged(CCObject * pSender,CCControlEvent controlEvent)
{
	CCControlSwitch * controlSwitch = (CCControlSwitch *)pSender;
	CCLog("click");
}

上一篇:C語言指針的長度和類型深入分析

欄    目:C語言

下一篇:cocos2d-x學(xué)習(xí)筆記之CCLayer、CCLayerColor、CCLayerGradient、CCLayerMu

本文標(biāo)題:Cocos2d-x UI開發(fā)之CCControlSwitch控件類使用實例

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/3396.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有