您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CCSizeMake函数代码示例

51自学网 2021-06-01 19:57:31
  C++
这篇教程C++ CCSizeMake函数代码示例写得很实用,希望能帮到您。

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

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

示例1: getWinSize

bool SGBaseBox::init(SGBoxDelegate *dg, BoxTag bt, CCSize size, bool ishaveinfobg,bool isHaveBg,CCSize bottomsize,bool useDefaultBg){    if (!SGBaseShow::init(NULL, bt, false))    {        return false;    }    ResourceManager::sharedInstance()->bindTexture("sgmainlayer/sgmainlayer.plist", RES_TYPE_LAYER_UI, sg_baseBox, LIM_PNG_AS_PNG);    ResourceManager::sharedInstance()->bindTexture("sgsoldierslayer/sgsoldierslayer.plist", RES_TYPE_LAYER_UI, sg_baseBox, LIM_PNG_AS_PNG);    ResourceManager::sharedInstance()->bindTexture("sgcountrylayer/sgcountrylayer.plist", RES_TYPE_LAYER_UI, sg_baseBox);    CCSize s = CCDirector::sharedDirector() -> getWinSize();    boxSize = size;    deletage = dg;    if (isHaveBg)    {        CCPoint center = ccpAdd(SGLayout::getPoint(kMiddleCenter), ccp(0, 0));        CCSprite *bg1 = NULL;        if (useDefaultBg)        {            biao=CCSprite::createWithSpriteFrameName("box_bian.png");            this->addChild(biao, -1);            biao->setPosition(ccpAdd(center, ccp(0, size.height*.5 -45)));            ResourceManager::sharedInstance()->bindTexture("sanguobigpic/Tips.plist", RES_TYPE_LAYER_UI, sg_baseBox);            cocos2d::extension::CCScale9Sprite *frame2 = cocos2d::extension::CCScale9Sprite::createWithSpriteFrameName("Tips.png");            //cocos2d::extension::CCScale9Sprite *frame2 = cocos2d::extension::CCScale9Sprite::create("sanguobigpic/Tips.png");            this->addChild(frame2,0);            frame2->setScaleX(size.width/frame2->getContentSize().width);            frame2->setScaleY(size.height/frame2->getContentSize().height);            frame2->setPosition(ccpAdd(center, ccp(0,0)));            CCLayerColor *bgLayer  =CCLayerColor::create(ccc4(0, 0, 0, 180), skewing(320)*3, skewingY(960)*3);            this->addChild(bgLayer,-3);            bgLayer->setPosition(ccpAdd(CCPointZero, ccp(-bgLayer->getContentSize().width*.5, -bgLayer->getContentSize().height*.5)));        }        else        {            ResourceManager::sharedInstance()->bindTexture("sanguobigpic/barrack_bg.plist", RES_TYPE_LAYER_UI, sg_baseBox);            bg1 = CCSprite::createWithSpriteFrameName("barrack_bg.png");            this->addChild(bg1 ,-2);            bg1->setScaleY(s.height/bg1->getContentSize().height);            bg1->setScaleX(s.width/bg1->getContentSize().width);            bg1->setPosition(center);        }        if (ishaveinfobg)        {            ResourceManager::sharedInstance()->bindTexture("sanguobigpic/tipsinside.plist", RES_TYPE_LAYER_UI, sg_baseBox);            fontbg = cocos2d::extension::CCScale9Sprite::createWithSpriteFrameName("tipsinside.png");            this->addChild(fontbg,0);            fontbg->setPreferredSize(CCSizeMake(size.width-55, size.height-162));//-112            fontbg->setPosition(ccpAdd(center, ccp(0, 0)));//-27        }    }    this->runactionwithscale();    return true;}
开发者ID:caoguoping,项目名称:warCraft,代码行数:72,


示例2: if

bool AppDelegate::applicationDidFinishLaunching() {    // initialize director    CCDirector* pDirector = CCDirector::sharedDirector();    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();	CCSize frameSize = pEGLView->getFrameSize();    pDirector->setOpenGLView(pEGLView);    std::vector<std::string> searchPaths;#if MC_ADAPTIVE_RESOLUTION == 1    // Set the design resolution#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)    pEGLView->setDesignResolutionSize(PCResource.size.width, PCResource.size.height, kResolutionExactFit);    searchPaths.push_back(PCResource.directory);//    pDirector->setContentScaleFactor(MIN(32 * 25 / PCResource.size.width, 32 * 15 / PCResource.size.height));//    pDirector->setContentScaleFactor(0.75f);    pDirector->setContentScaleFactor(MIN(32 * 25 / frameSize.width, 32 * 15 / frameSize.height));#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)        // if the frame's height is larger than the height of medium resource size, select large resource.	if (frameSize.height == smallResource.size.height) {        pEGLView->setDesignResolutionSize(smallResource.size.width, smallResource.size.height, kResolutionNoBorder);        searchPaths.push_back(smallResource.directory);	}        // if the frame's height is larger than the height of small resource size, select medium resource.    else if (frameSize.height == mediumResource.size.height) {        pEGLView->setDesignResolutionSize(mediumResource.size.width, mediumResource.size.height, kResolutionNoBorder);        searchPaths.push_back(mediumResource.directory);    }        // if the frame's height is smaller than the height of medium resource size, select small resource.	else {        pEGLView->setDesignResolutionSize(largeResource.size.width, largeResource.size.height, kResolutionNoBorder);		searchPaths.push_back(largeResource.directory);    }    pDirector->setContentScaleFactor(MIN(32 * 25 / frameSize.width, 32 * 15 / frameSize.height));#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)    int i = 0;    int size = sizeof(resources);    int found = 0;    for (; i < size; ++i) {        if ((frameSize.width == resources[i].size.width && frameSize.height == resources[i].size.height)            || (frameSize.width == resources[i].size.height && frameSize.height == resources[i].size.width)) {            searchPaths.push_back(resources[i].directory);            pEGLView->setDesignResolutionSize(resources[i].size.width, resources[i].size.height, kResolutionNoBorder);            pDirector->setContentScaleFactor(MIN(32 * 25 / resources[i].size.width, 32 * 15 / resources[i].size.height));            found = 1;            break;        }    }    if (found == 0) {		searchPaths.push_back(resources[0].directory);        pEGLView->setDesignResolutionSize(resources[0].size.width, resources[0].size.height, kResolutionNoBorder);        pDirector->setContentScaleFactor(MIN(32 * 25 / resources[0].size.width, 32 * 15 / resources[0].size.height));    }#else    // if the frame's height is larger than the height of medium resource size, select large resource.	if (frameSize.height > mediumResource.size.height) {        searchPaths.push_back(largeResource.directory);        pEGLView->setDesignResolutionSize(largeResource.size.width, largeResource.size.height);        pDirector->setContentScaleFactor(MIN(largeResource.size.height/smallResource.size.height, largeResource.size.width/smallResource.size.width));	}    // if the frame's height is larger than the height of small resource size, select medium resource.    else if (frameSize.height > smallResource.size.height) {        searchPaths.push_back(mediumResource.directory);        pEGLView->setDesignResolutionSize(mediumResource.size.width, mediumResource.size.height);        pDirector->setContentScaleFactor(MIN(mediumResource.size.height/smallResource.size.height, mediumResource.size.width/smallResource.size.width));    }    // if the frame's height is smaller than the height of medium resource size, select small resource.	else {		searchPaths.push_back(smallResource.directory);        pEGLView->setDesignResolutionSize(smallResource.size.width, smallResource.size.height);        pDirector->setContentScaleFactor(MIN(smallResource.size.height, smallResource.size.width));    }#endif // platforms#else    CCSize designSize = CCSizeMake(960, 640);        searchPaths.push_back(CommonResource.directory);    if (frameSize.height > 1280) {        CCSize resourceSize = CCSizeMake(2048, 1536);        std::vector<std::string> searchPaths;//        searchPaths.push_back("hd"); //没资源        pDirector->setContentScaleFactor(0.75 * resourceSize.height / designSize.height);    } else {        pDirector->setContentScaleFactor(0.75);    }        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionFixedWidth);#endif // MC_ADAPTIVE_RESOLUTION == 0    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);	    // turn on display FPS//    pDirector->setDisplayStats(true);    // set FPS. the default value is 1.0/60 if you don't call this    pDirector->setAnimationInterval(1.0 / 60);        CCLog("%s(%d): %.0f %.0f %.0f", __FILE__, __LINE__, frameSize.width, frameSize.height, pDirector->getContentScaleFactor());        // register lua engine//.........这里部分代码省略.........
开发者ID:edison9888,项目名称:__graduation_project,代码行数:101,


示例3: sprintf

CCLayer* Tornado::getUnitCardDesc(int level,bool isAll) {    CCLayer* layer = CCLayer::create();    float attackLevelData = MyUtil::getInstance()->updateLevelByRate(0,baseDamage, level, updateDamageRate);    float attackMaxData = MyUtil::getInstance()->updateLevelByRate(0,baseDamage, unitBean->getMaxLevel(), updateDamageRate);    CCSprite* attackIcon = CCSprite::createWithSpriteFrameName("damageIcon.png");    attackIcon->setPosition(ccp(40,360));    layer->addChild(attackIcon);    attackIcon->setScale(1.3);    GXProgressBar* attackBar = GXProgressBar::create(CCSprite::create("levelBarUp.png"), CCSprite::create("BarDown.png"));        attackBar->setContentSize(CCSizeMake(416,20));    attackBar->updatePercentage((attackLevelData+baseDamage*unitBean->getMaxLevel())/(attackMaxData+baseDamage*unitBean->getMaxLevel()));    attackBar->setPosition(ccp(70,337));            char str[100] = {0};    sprintf(str, "每秒造成伤害:%d",(int)(attackLevelData));        CCLabelTTF* attackLabel = CCLabelTTF::create(str, "Arial", 28);    attackLabel->setAnchorPoint(ccp(0,0));    attackLabel->setColor(ccc3(238,204,122));    attackLabel->setPosition(ccp(70,352));    layer->addChild(attackBar);    layer->addChild(attackLabel);        //    CCLog("damageRate:%f",attackLevelData/attackMaxData);        float speedLevelData = MyUtil::getInstance()->updateLevelByCount(baseSpeed, level, updateSpeedRate);        float speedMaxData = MyUtil::getInstance()->updateLevelByCount(baseSpeed, unitBean->getMaxLevel(), updateSpeedRate);        CCSprite* speedIcon = CCSprite::createWithSpriteFrameName("speedIcon.png");    speedIcon->setScale(1.3);    speedIcon->setPosition(ccp(40,300));    layer->addChild(speedIcon);    GXProgressBar* speedBar = GXProgressBar::create(CCSprite::create("levelBarUp.png"), CCSprite::create("BarDown.png"));        speedBar->setContentSize(CCSizeMake(416,20));    speedBar->updatePercentage(speedLevelData/speedMaxData);    speedBar->setPosition(ccp(70,277));        sprintf(str, "移动速度:%d",(int)(speedLevelData*10));        CCLabelTTF* speedLabel = CCLabelTTF::create(str, "Arial", 24);    speedLabel->setAnchorPoint(ccp(0,0));    speedLabel->setColor(ccc3(238,204,122));    speedLabel->setPosition(ccp(70,292));    layer->addChild(speedBar);    layer->addChild(speedLabel);        //    CCLog("speedRate:%f",speedLevelData/speedMaxData);        float healthLevelData = MyUtil::getInstance()->updateLevelByRate(0,baseHealth, level, updateHealthRate);    float healthMaxData = MyUtil::getInstance()->updateLevelByRate(0,baseHealth, unitBean->getMaxLevel(),updateHealthRate);            CCSprite* healthIcon = CCSprite::createWithSpriteFrameName("healthIcon.png");    healthIcon->setScale(1.3);    healthIcon->setPosition(ccp(40,240));    layer->addChild(healthIcon);    GXProgressBar* healthBar = GXProgressBar::create(CCSprite::create("levelBarUp.png"), CCSprite::create("BarDown.png"));        healthBar->setContentSize(CCSizeMake(416,20));    healthBar->updatePercentage((healthLevelData+baseHealth*unitBean->getMaxLevel())/(healthMaxData+baseHealth*unitBean->getMaxLevel()));        healthBar->setPosition(ccp(70,217));        sprintf(str, "耐久度:%d",(int)healthLevelData);        CCLabelTTF* healthLabel = CCLabelTTF::create(str, "Arial", 24);    healthLabel->setAnchorPoint(ccp(0,0));    healthLabel->setColor(ccc3(238,204,122));    healthLabel->setPosition(ccp(70,232));    layer->addChild(healthBar);    layer->addChild(healthLabel);        //    CCLog("lifeRate:%f",healthLevelData/healthMaxData);        float costLevelData = MyUtil::getInstance()->updateLevelByRate(0,baseCost, level, updateCostRate);    float costMaxData = MyUtil::getInstance()->updateLevelByRate(0,baseCost, unitBean->getMaxLevel(), updateCostRate);        CCSprite* costIcon = CCSprite::createWithSpriteFrameName("oilIcon.png");    costIcon->setPosition(ccp(40,180));    costIcon->setScale(40/costIcon->getContentSize().width);    layer->addChild(costIcon);            GXProgressBar* costBar = GXProgressBar::create(CCSprite::create("levelBarUp.png"), CCSprite::create("BarDown.png"));        costBar->setContentSize(CCSizeMake(416,20));    costBar->updatePercentage((costLevelData+baseCost*unitBean->getMaxLevel())/(costMaxData+baseCost*unitBean->getMaxLevel()));        costBar->setPosition(ccp(70,157));            sprintf(str, "派遣使用油料:%d",(int)(costLevelData));    CCLabelTTF* costLabel = CCLabelTTF::create(str, "Arial", 24);    costLabel->setAnchorPoint(ccp(0,0));    costLabel->setColor(ccc3(238,204,122));    costLabel->setPosition(ccp(70,172));//.........这里部分代码省略.........
开发者ID:itita,项目名称:2-z-q-x-,代码行数:101,


示例4: atoi

void CCSpriteFrameCache::addSpriteFramesWithDictionary(CCDictionary<std::string, CCObject*> *dictionary, CCTexture2D *pobTexture){	/*	Supported Zwoptex Formats:	ZWTCoordinatesFormatOptionXMLLegacy = 0, // Flash Version	ZWTCoordinatesFormatOptionXML1_0 = 1, // Desktop Version 0.0 - 0.4b	ZWTCoordinatesFormatOptionXML1_1 = 2, // Desktop Version 1.0.0 - 1.0.1	ZWTCoordinatesFormatOptionXML1_2 = 3, // Desktop Version 1.0.2+	*/	CCDictionary<std::string, CCObject*> *metadataDict = (CCDictionary<std::string, CCObject*>*)dictionary->objectForKey(std::string("metadata"));	CCDictionary<std::string, CCObject*> *framesDict = (CCDictionary<std::string, CCObject*>*)dictionary->objectForKey(std::string("frames"));	int format = 0;	// get the format	if(metadataDict != NULL) 	{		format = atoi(valueForKey("format", metadataDict));	}	// check the format	assert(format >=0 && format <= 3);	framesDict->begin();	std::string key = "";	CCDictionary<std::string, CCObject*> *frameDict = NULL;	while( frameDict = (CCDictionary<std::string, CCObject*>*)framesDict->next(&key) )	{		CCSpriteFrame *spriteFrame = m_pSpriteFrames->objectForKey(key);		if (spriteFrame)		{			continue;		}				if(format == 0) 		{			float x = (float)atof(valueForKey("x", frameDict));			float y = (float)atof(valueForKey("y", frameDict));			float w = (float)atof(valueForKey("width", frameDict));			float h = (float)atof(valueForKey("height", frameDict));			float ox = (float)atof(valueForKey("offsetX", frameDict));			float oy = (float)atof(valueForKey("offsetY", frameDict));			int ow = atoi(valueForKey("originalWidth", frameDict));			int oh = atoi(valueForKey("originalHeight", frameDict));			// check ow/oh			if(!ow || !oh)			{				CCLOG("cocos2d: WARNING: originalWidth/Height not found on the CCSpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist");			}			// abs ow/oh			ow = abs(ow);			oh = abs(oh);			// create frame			spriteFrame = new CCSpriteFrame();			spriteFrame->initWithTexture(pobTexture, 				                        CCRectMake(x, y, w, h), 										false,                                        CCPointMake(ox, oy),                                        CCSizeMake((float)ow, (float)oh)										);		} 		else if(format == 1 || format == 2) 		{			CCRect frame = CCRectFromString(valueForKey("frame", frameDict));			bool rotated = false;			// rotation			if (format == 2)			{				rotated = atoi(valueForKey("rotated", frameDict)) == 0 ? false : true;			}			CCPoint offset = CCPointFromString(valueForKey("offset", frameDict));			CCSize sourceSize = CCSizeFromString(valueForKey("sourceSize", frameDict));			// create frame			spriteFrame = new CCSpriteFrame();			spriteFrame->initWithTexture(pobTexture, 				frame,				rotated,				offset,				sourceSize				);		} else		if (format == 3)		{			/// @todo what's the format look like?			assert(false);			return;			/*			// get values			CCSize spriteSize = CCSizeFromString(valueForKey("spriteSize", frameDict));			CCPoint spriteOffset = CCPointFromString(valueForKey("spriteOffset", frameDict));			CCSize spriteSourceSize = CCSizeFromString(valueForKey("spriteSourceSize", frameDict));			CCRect textureRect = CCRectFromString(valueForKey("textureRect", frameDict));			bool textureRotated = atoi(valueForKey("textureRotated", frameDict)) == 0;			// get aliases			CCArray<CCString*> *aliases = CCArray<CCString*>dictionary->objectForKey(std::string("aliases"));//.........这里部分代码省略.........
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:101,


示例5: glGetIntegerv

bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat){    bool bRet = false;    do     {        w *= (int)CC_CONTENT_SCALE_FACTOR();        h *= (int)CC_CONTENT_SCALE_FACTOR();        glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &m_nOldFBO);        // textures must be power of two squared        unsigned int powW = ccNextPOT(w);        unsigned int powH = ccNextPOT(h);        void *data = malloc((int)(powW * powH * 4));        CC_BREAK_IF(! data);        memset(data, 0, (int)(powW * powH * 4));        m_ePixelFormat = eFormat;        m_pTexture = new CCTexture2D();        CC_BREAK_IF(! m_pTexture);        m_pTexture->initWithData(data, (CCTexture2DPixelFormat)m_ePixelFormat, powW, powH, CCSizeMake((float)w, (float)h));        free( data );        // generate FBO        ccglGenFramebuffers(1, &m_uFBO);        ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_uFBO);        // associate texture with FBO        ccglFramebufferTexture2D(CC_GL_FRAMEBUFFER, CC_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pTexture->getName(), 0);        // check if it worked (probably worth doing :) )        GLuint status = ccglCheckFramebufferStatus(CC_GL_FRAMEBUFFER);        if (status != CC_GL_FRAMEBUFFER_COMPLETE)        {            CCAssert(0, "Render Texture : Could not attach texture to framebuffer");            CC_SAFE_DELETE(m_pTexture);            break;        }        m_pTexture->setAliasTexParameters();        m_pSprite = CCSprite::spriteWithTexture(m_pTexture);        m_pTexture->release();        m_pSprite->setScaleY(-1);        this->addChild(m_pSprite);        ccBlendFunc tBlendFunc = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA };        m_pSprite->setBlendFunc(tBlendFunc);        ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_nOldFBO);        bRet = true;    } while (0);    return bRet;    }
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:59,


示例6: CCSizeMake

bool CCSplitCols::initWithDuration(float duration, unsigned int nCols){    m_nCols = nCols;    return CCTiledGrid3DAction::initWithDuration(duration, CCSizeMake(nCols, 1));}
开发者ID:solarzhong,项目名称:cocos2dx-classical,代码行数:5,


示例7: CCSizeMake

//------------------------------------------------------------------------------void LHJoint::createBox2dJointFromDictionary(LHDictionary* dictionary){    joint = 0;    	if(NULL == dictionary)return;	if(boxWorld == 0)return;            LHSprite* sprA  = parentLoader->spriteWithUniqueName(dictionary->stringForKey("ObjectA"));    b2Body* bodyA   = sprA->getBody();	    LHSprite* sprB  = parentLoader->spriteWithUniqueName(dictionary->stringForKey("ObjectB"));    b2Body* bodyB   = sprB->getBody();	    CCPoint sprPosA = sprA->getPosition();    CCPoint sprPosB = sprB->getPosition();    //    CCSize scaleA   = sprA->getRealScale();//    CCSize scaleB   = sprB->getRealScale();        CCSize scaleA   = CCSizeMake(sprA->getScaleX(), sprA->getScaleY());//[sprA realScale];    CCSize scaleB   = CCSizeMake(sprB->getScaleX(), sprB->getScaleY());//[sprB realScale];       scaleA = LHSettings::sharedInstance()->transformedSize(scaleA, sprA->getImageFile());    scaleB = LHSettings::sharedInstance()->transformedSize(scaleB, sprB->getImageFile());    //    scaleA = [[LHSettings sharedInstance] transformedSize:scaleA forImage:[sprA imageFile]];//    scaleB = [[LHSettings sharedInstance] transformedSize:scaleB forImage:[sprB imageFile]];        	if(NULL == bodyA || NULL == bodyB ) return;		CCPoint anchorA = dictionary->pointForKey("AnchorA");	CCPoint anchorB = dictionary->pointForKey("AnchorB");    	bool collideConnected = dictionary->boolForKey("CollideConnected");	    tag     = dictionary->intForKey("Tag");    type    = (LH_JOINT_TYPE)dictionary->intForKey("Type");    	b2Vec2 posA, posB;	    float ptm = LHSettings::sharedInstance()->lhPtmRatio();	float convertX = LHSettings::sharedInstance()->convertRatio().x;	float convertY = LHSettings::sharedInstance()->convertRatio().y;        if(!dictionary->boolForKey("CenterOfMass"))    {                posA = b2Vec2((sprPosA.x + anchorA.x*scaleA.width)/ptm,                       (sprPosA.y - anchorA.y*scaleA.height)/ptm);                posB = b2Vec2((sprPosB.x + anchorB.x*scaleB.width)/ptm,                       (sprPosB.y - anchorB.y*scaleB.height)/ptm);            }    else {		        posA = bodyA->GetWorldCenter();        posB = bodyB->GetWorldCenter();    }		if(0 != bodyA && 0 != bodyB)	{		switch ((int)type)		{			case LH_DISTANCE_JOINT:			{				b2DistanceJointDef jointDef;								jointDef.Initialize(bodyA, 									bodyB, 									posA,									posB);								jointDef.collideConnected = collideConnected;								jointDef.frequencyHz    = dictionary->floatForKey("Frequency");				jointDef.dampingRatio   = dictionary->floatForKey("Damping");								if(0 != boxWorld){					joint = (b2DistanceJoint*)boxWorld->CreateJoint(&jointDef);				}			}					break;							case LH_REVOLUTE_JOINT:			{				b2RevoluteJointDef jointDef;								jointDef.lowerAngle     = CC_DEGREES_TO_RADIANS(dictionary->floatForKey("LowerAngle"));				jointDef.upperAngle     = CC_DEGREES_TO_RADIANS(dictionary->floatForKey("UpperAngle"));				jointDef.motorSpeed     = dictionary->floatForKey("MotorSpeed");				jointDef.maxMotorTorque = dictionary->floatForKey("MaxTorque");				jointDef.enableLimit    = dictionary->boolForKey("EnableLimit");				jointDef.enableMotor    = dictionary->boolForKey("EnableMotor");				jointDef.collideConnected = collideConnected;    								jointDef.Initialize(bodyA, bodyB, posA);								if(0 != boxWorld){//.........这里部分代码省略.........
开发者ID:kdridi,项目名称:level-helper-sample,代码行数:101,


示例8: init

bool CCScrollView::init(){    return this->initWithViewSize(CCSizeMake(200, 200), NULL);}
开发者ID:136446529,项目名称:book-code,代码行数:4,


示例9: CCSizeMake

CCSize TextField::getTouchSize(){    return CCSizeMake(_touchWidth, _touchHeight);}
开发者ID:237676098,项目名称:quick-cocos2d-x,代码行数:4,


示例10: CCLOG

void GameStage::onEnter(){	CCLOG("gamestage onEnter");	this->stageWidth = 640;	this->stageHeight = 360;	//监听失败消息	CCNotificationCenter::sharedNotificationCenter()->addObserver(		this,                         		callfuncO_selector(GameStage::failCallBackFun),  // 处理的消息的回调函数		FAIL,  // 感兴趣的消息名称		NULL);   	//背景	ccColor4B color4b;	color4b.r = 42;	color4b.g = 43;	color4b.b = 38;	color4b.a = 0xFF;	this->background = CCLayerColor::create(color4b);	this->addChild(this->background);	//运动背景	float bgWidth = 43;	float bgHeigth = this->stageHeight - 140;	float gapH = 10;	//使这个数组已经是当前类的成员变量,也必须要做一次retain	this->drawBgList = CCArray::create();	this->drawBgList->retain();	ccColor4F color4f = ColorUtil::getColor4F(56, 57, 51, 255);	CCDrawNode* drawNode = this->createMotionWall(0, 140, bgWidth, bgHeigth, gapH, color4f);	float posX = drawNode->getContentSize().width;	this->drawBgList->addObject(drawNode);	this->addChild(drawNode);	drawNode = this->createMotionWall(0, 140, bgWidth, bgHeigth, gapH, color4f);	drawNode->setPosition(ccp(posX, 0));	this->drawBgList->addObject(drawNode);	this->addChild(drawNode);	//地板	color4b.r = 116;	color4b.g = 115;	color4b.b = 98;	color4b.a = 0xFF;	this->floorBg = CCLayerColor::create(color4b);	CCSize size = CCSizeMake(this->stageWidth, 141);	this->floorBg->setContentSize(size);	this->addChild(this->floorBg);	//地板线条	color4b.r = 72;	color4b.g = 66;	color4b.b = 50;	color4b.a = 0xFF;	this->floorLineBg = CCLayerColor::create(color4b);	size = CCSizeMake(this->stageWidth, 10);	this->floorLineBg->setContentSize(size);	this->addChild(this->floorLineBg);	this->floorLineBg->setPosition(ccp(0, this->floorBg->getContentSize().height));	//前景	this->frontBgList = CCArray::create();	this->frontBgList->retain();	for (int i = 0; i < 3; i++)	{		drawNode = this->createFrontMotionWall(0, 83, this->stageWidth, this->stageHeight - 83, i);		this->addChild(drawNode);		drawNode->setPosition(ccp(this->stageWidth * (i - 1), 0));		this->frontBgList->addObject(drawNode);	}	//初始化核心类	this->pukaManCore = new PukaManCore();	this->pukaManCore->initGame(17, 2, 10, 15, 0.3, 0, CCDirector::sharedDirector()->getWinSize().height - 35, 70);	/*初始化人物*/	this->initRole(this->pukaManCore->roleVo->x, this->pukaManCore->roleVo->y);	this->uiLayer = CCLayer::create();	this->uiText = CCSprite::create("uiText.png");	this->uiText->setAnchorPoint(ccp(0, 0));	this->uiText->setPosition(ccp(0, this->stageHeight - 50));	this->uiLayer->addChild(this->uiText);	this->addChild(this->uiLayer);	this->bomb = NULL;	this->comboList = NULL;	this->scoreList = NULL;	this->highScoreList = NULL;		//设置最高分记录	if(Cookie::isSaved())		this->pukaManCore->highScore = Cookie::getShareUserData()->getIntegerForKey("highScore");	//设置bombo数字	this->updateCombo();	this->updateScore();	//设置最高分数数字//.........这里部分代码省略.........
开发者ID:kanon1109,项目名称:Pukaman,代码行数:101,


示例11: CCPoint

/*创建运动前景*/CCDrawNode* GameStage::createFrontMotionWall(float x, float y, 											 float bgWidth, float bgHeight, 											 int tag){	//前景列表	CCDrawNode* drawNode = CCDrawNode::create();	ccColor4F color = ColorUtil::getColor4F(141, 143, 129, 255);	CCPoint points[] = {CCPoint(x, y), 						CCPoint(x,  bgHeight + y), 						CCPoint(x + bgWidth, bgHeight + y), 						CCPoint(x + bgWidth, y)};	//顶点列表,顶点数量,颜色	drawNode->drawPolygon(points, 4, color, 0, ColorUtil::getColor4F(0, 0, 0, 0));	//前景中段	float my = y + 97;	float mHeight = 93;	color = ColorUtil::getColor4F(103, 107, 82, 255);	CCPoint points2[] = {CCPoint(x, my), 						 CCPoint(x,  mHeight + my), 						 CCPoint(x + bgWidth, mHeight + my), 						 CCPoint(x + bgWidth, my)};	drawNode->drawPolygon(points2, 4, color, 0, ColorUtil::getColor4F(0, 0, 0, 0));		mHeight = 3;	my = my - mHeight;	color = ColorUtil::getColor4F(86, 90, 67, 255);	CCPoint points3[] = {CCPoint(x, my), 						 CCPoint(x,  mHeight + my), 						 CCPoint(x + bgWidth, mHeight + my), 						 CCPoint(x + bgWidth, my)};	drawNode->drawPolygon(points3, 4, color, 0, ColorUtil::getColor4F(0, 0, 0, 0));		mHeight = 2;	my = my - mHeight;	color = ColorUtil::getColor4F(100, 103, 82, 255);	CCPoint points4[] = {CCPoint(x, my), 						 CCPoint(x,  mHeight + my), 						 CCPoint(x + bgWidth, mHeight + my), 						 CCPoint(x + bgWidth, my)};	drawNode->drawPolygon(points4, 4, color, 0, ColorUtil::getColor4F(0, 0, 0, 0));	mHeight = 1;	my = my - mHeight;	color = ColorUtil::getColor4F(113, 116, 99, 255);	CCPoint points5[] = {CCPoint(x, my), 		CCPoint(x,  mHeight + my), 		CCPoint(x + bgWidth, mHeight + my), 		CCPoint(x + bgWidth, my)};	drawNode->drawPolygon(points5, 4, color, 0, ColorUtil::getColor4F(0, 0, 0, 0));	drawNode->setAnchorPoint(ccp(0, 0));	drawNode->setContentSize(CCSizeMake(bgWidth, bgHeight));	//创建阴影 设置注册点在top和center	CCSprite* shadow = CCSprite::create("shadow.png");	shadow->setTag(tag);	shadow->setAnchorPoint(ccp(.5, 1));	shadow->setPosition(ccp(shadow->getContentSize().width *.5, y));	drawNode->setTag(tag);	drawNode->addChild(shadow);	return drawNode;}
开发者ID:kanon1109,项目名称:Pukaman,代码行数:63,


示例12: CCAssert

bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat){    CCAssert(eFormat != kCCTexture2DPixelFormat_A8, "only RGB and RGBA formats are valid for a render texture");    bool bRet = false;    void *data = NULL;    do     {        w = (int)(w * CC_CONTENT_SCALE_FACTOR());        h = (int)(h * CC_CONTENT_SCALE_FACTOR());        glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_nOldFBO);        // textures must be power of two squared        unsigned int powW = 0;        unsigned int powH = 0;        if (CCConfiguration::sharedConfiguration()->supportsNPOT())        {            powW = w;            powH = h;        }        else        {            powW = ccNextPOT(w);            powH = ccNextPOT(h);        }        data = malloc((int)(powW * powH * 4));        CC_BREAK_IF(! data);        memset(data, 0, (int)(powW * powH * 4));        m_ePixelFormat = eFormat;        m_pTexture = new CCTexture2D();        if (m_pTexture)        {            m_pTexture->initWithData(data, (CCTexture2DPixelFormat)m_ePixelFormat, powW, powH, CCSizeMake((float)w, (float)h));        }        else        {            break;        }        GLint oldRBO;        glGetIntegerv(GL_RENDERBUFFER_BINDING, &oldRBO);                if (CCConfiguration::sharedConfiguration()->checkForGLExtension("GL_QCOM"))        {            m_pTextureCopy = new CCTexture2D();            if (m_pTextureCopy)            {                m_pTextureCopy->initWithData(data, (CCTexture2DPixelFormat)m_ePixelFormat, powW, powH, CCSizeMake((float)w, (float)h));            }            else            {                break;            }        }        // generate FBO        glGenFramebuffers(1, &m_uFBO);        glBindFramebuffer(GL_FRAMEBUFFER, m_uFBO);        // associate texture with FBO        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pTexture->getName(), 0);        if (uDepthStencilFormat != 0)        {            //create and attach depth buffer            glGenRenderbuffers(1, &m_uDepthRenderBufffer);            glBindRenderbuffer(GL_RENDERBUFFER, m_uDepthRenderBufffer);            glRenderbufferStorage(GL_RENDERBUFFER, uDepthStencilFormat, (GLsizei)powW, (GLsizei)powH);            glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_uDepthRenderBufffer);            // if depth format is the one with stencil part, bind same render buffer as stencil attachment            if (uDepthStencilFormat == GL_DEPTH24_STENCIL8)            {                glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_uDepthRenderBufffer);            }        }        // check if it worked (probably worth doing :) )        CCAssert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE, "Could not attach texture to framebuffer");        m_pTexture->setAliasTexParameters();        // retained        setSprite(CCSprite::createWithTexture(m_pTexture));        m_pTexture->release();        m_pSprite->setScaleY(-1);        ccBlendFunc tBlendFunc = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA };        m_pSprite->setBlendFunc(tBlendFunc);        glBindRenderbuffer(GL_RENDERBUFFER, oldRBO);        glBindFramebuffer(GL_FRAMEBUFFER, m_nOldFBO);                // Diabled by default.        m_bAutoDraw = false;//.........这里部分代码省略.........
开发者ID:cheerayhuang,项目名称:cocos2d-x,代码行数:101,


示例13: CCSizeMake

bool AppDelegate::applicationDidFinishLaunching() {	// initialize director	    CCDirector *pDirector = CCDirector::sharedDirector();	    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());	    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();	    CCSize designSize = CCSizeMake(480, 320);	    std::vector<std::string> searchPaths;	    if (screenSize.height > 320)	    {	        searchPaths.push_back("hd");	        searchPaths.push_back("sd");	        pDirector->setContentScaleFactor(640.0f/designSize.height);	    }	    else	    {	        searchPaths.push_back("sd");	        pDirector->setContentScaleFactor(320.0f/designSize.height);	    }	    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);	    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionExactFit);	    // turn on display FPS	    pDirector->setDisplayStats(true);	    // set FPS. the default value is 1.0/60 if you don't call this	    pDirector->setAnimationInterval(1.0 / 60);	    // create a scene. it's an autorelease object	    CCScene *pScene = HelloWorld::scene();	    // run	    pDirector->runWithScene(pScene);	    return true;//	// initialize director//	CCDirector* pDirector = CCDirector::sharedDirector();//	CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();////	pDirector->setOpenGLView(pEGLView);//	CCSize visibleSize = pDirector->getVisibleSize();//	// Set the design resolution//	pEGLView->setDesignResolutionSize(visibleSize.width,//			visibleSize.height, kResolutionShowAll);//	CCSize frameSize = pEGLView->getFrameSize();//	cocos2d::CCLog("frameSize.width=%2f, frameSize.height=%2f",frameSize.width, frameSize.height);//////	float ratio = frameSize.width / frameSize.height;////	float ratio1 = largeDesignResolutionSize.width / largeDesignResolutionSize.height;////	float ratio2 = mediumDesignResolutionSize.width / mediumDesignResolutionSize.height;////	float ratio3 = smallDesignResolutionSize.width / smallDesignResolutionSize.height;////	float d1 = abs(ratio - ratio1);////	float d2 = abs(ratio - ratio2);////	float d3 = abs(ratio - ratio3);////	std::map<float, CCSize> designSize;////	designSize[d1] = largeDesignResolutionSize;////	designSize[d2] = mediumDesignResolutionSize;////	designSize[d3] = smallDesignResolutionSize;////	std::map<float, CCSize>::reverse_iterator iter = designSize.rbegin();////	//得到key最大的,因此我这里是横屏,所以以高度为基准,为了确保缩放后宽度能全屏,所以选取宽高比最大的为设计方案////	CCSize designResolutionSize = iter->second;////	//pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);////	pEGLView->setDesignResolutionSize(designResolutionSize.width,////			designResolutionSize.height, kResolutionShowAll);////	//pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionExactFit);//////	if (frameSize.height > mediumResource.size.height) {////		CCFileUtils::sharedFileUtils()->setResourceDirectory(////				largeResource.directory);////		pDirector->setContentScaleFactor(////				largeResource.size.height / designResolutionSize.height);////	} else if (frameSize.height > smallResource.size.height) {////		CCFileUtils::sharedFileUtils()->setResourceDirectory(////				mediumResource.directory);////		pDirector->setContentScaleFactor(////				mediumResource.size.height / designResolutionSize.height);////	} else {////		CCFileUtils::sharedFileUtils()->setResourceDirectory(////				smallResource.directory);////		pDirector->setContentScaleFactor(////				smallResource.size.height / designResolutionSize.height);////	}////	std::vector<std::string> searchPath;////	// In this demo, we select resource according to the frame's height.//	// If the resource size is different from design resolution size, you need to set contentScaleFactor.//	// We use the ratio of resource's height to the height of design resolution,//	// this can make sure that the resource's height could fit for the height of design resolution.////	// if the frame's height is larger than the height of medium resource size, select large resource.//	if (frameSize.height > mediumResource.size.height) {//		searchPath.push_back(largeResource.directory);//.........这里部分代码省略.........
开发者ID:yohyow,项目名称:cocos2dxTest,代码行数:101,


示例14: CCSizeMake

bool RPGDialogLayer::init(string titleStr, string menuOKStr, int menuItemOKTag, string menuCancelStr, int menuItemCancelTag, float width, float height, CCObject* target, SEL_MenuHandler seletor){    if(CCLayerColor::initWithColor(ccc4(0, 0, 0, 200), width, height))    {        this->initCommons(titleStr);                CCTMXTiledMap *mainBg = (CCTMXTiledMap*)this->getChildByTag(kRPGDialogLayerBg);        CCMenu *menu = (CCMenu*)mainBg->getChildByTag(kRPGDialogLayerBgMenu);                CCLabelTTF *menuOKLab = CCLabelTTF::create(OzgCCUtility::generalString(CCString::create(menuOKStr)->getCString()).c_str(), "Arial", 20, CCSizeMake(120, 25), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);        menuOKLab->setColor(ccc3(160, 160, 160));        CCMenuItemLabel *menuOK = CCMenuItemLabel::create(menuOKLab, target, seletor);        menuOK->setTag(menuItemOKTag);        menuOK->setPosition(ccp(100, 60));        menu->addChild(menuOK);                CCLabelTTF *menuCancelLab = CCLabelTTF::create(OzgCCUtility::generalString(CCString::create(menuCancelStr)->getCString()).c_str(), "Arial", 20, CCSizeMake(120, 25), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);        menuCancelLab->setColor(ccc3(160, 160, 160));        CCMenuItemLabel *menuCancel = CCMenuItemLabel::create(menuCancelLab, target, seletor);        menuCancel->setTag(menuItemCancelTag);        menuCancel->setPosition(ccp(280, 60));        menu->addChild(menuCancel);                return true;    }        return false;}
开发者ID:aboduo,项目名称:OzgGameRPG,代码行数:28,


示例15: CCSizeMake

void CCEGLViewProtocol::setFrameSize(float width, float height){    m_obDesignResolutionSize = m_obScreenSize = CCSizeMake(width, height);}
开发者ID:vedi,项目名称:cocos2d-x,代码行数:4,


示例16: initWithRichString

bool CCTexture2D_richlabel::initWithRichString(const char *text, const char *fontName, float fontSize) {    return initWithRichString(text,  fontName, fontSize, CCSizeMake(0,0), kCCTextAlignmentCenter, kCCVerticalTextAlignmentTop);}
开发者ID:ourgames,项目名称:dc208,代码行数:3,


示例17: setPropsFromJsonDictionary

void LayoutReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options){    WidgetReader::setPropsFromJsonDictionary(widget, options);            std::string jsonPath = GUIReader::shareReader()->getFilePath();        ui::Layout* panel = (ui::Layout*)widget;        float w = 0, h = 0;    bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen");    if (adaptScrenn)    {        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();        w = screenSize.width;        h = screenSize.height;    }    else    {        w = DICTOOL->getFloatValue_json(options, "width");        h = DICTOOL->getFloatValue_json(options, "height");    }    panel->setSize(CCSizeMake(w, h));        panel->setClippingEnabled(DICTOOL->getBooleanValue_json(options, "clipAble"));        bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, "backGroundScale9Enable");    panel->setBackGroundImageScale9Enabled(backGroundScale9Enable);    int cr = DICTOOL->getIntValue_json(options, "bgColorR");    int cg = DICTOOL->getIntValue_json(options, "bgColorG");    int cb = DICTOOL->getIntValue_json(options, "bgColorB");        int scr = DICTOOL->getIntValue_json(options, "bgStartColorR");    int scg = DICTOOL->getIntValue_json(options, "bgStartColorG");    int scb = DICTOOL->getIntValue_json(options, "bgStartColorB");        int ecr = DICTOOL->getIntValue_json(options, "bgEndColorR");    int ecg = DICTOOL->getIntValue_json(options, "bgEndColorG");    int ecb = DICTOOL->getIntValue_json(options, "bgEndColorB");        float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");    float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");    panel->setBackGroundColorVector(ccp(bgcv1, bgcv2));        int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");        int colorType = DICTOOL->getIntValue_json(options, "colorType");    panel->setBackGroundColorType(ui::LayoutBackGroundColorType(colorType));    panel->setBackGroundColor(ccc3(scr, scg, scb),ccc3(ecr, ecg, ecb));    panel->setBackGroundColor(ccc3(cr, cg, cb));    panel->setBackGroundColorOpacity(co);            const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "backGroundImageData");    int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");    switch (imageFileNameType)    {        case 0:        {            std::string tp_b = jsonPath;            const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");            const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL;            panel->setBackGroundImage(imageFileName_tp);            break;        }        case 1:        {            const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");            panel->setBackGroundImage(imageFileName, ui::UI_TEX_TYPE_PLIST);            break;        }        default:            break;    }        if (backGroundScale9Enable)    {        float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");        float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");        float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");        float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");        panel->setBackGroundImageCapInsets(CCRectMake(cx, cy, cw, ch));    }    panel->setLayoutType((ui::LayoutType)DICTOOL->getIntValue_json(options, "layoutType"));            WidgetReader::setColorPropsFromJsonDictionary(widget, options);}
开发者ID:237676098,项目名称:quick-cocos2d-x,代码行数:88,


示例18: menu_selector

bool S411FeedBack::setUpSubClass2(){	bool bRet = false;	do	{        refreshItemImage->setOpacity(0);        refreshItemImage->setEnabled(false);        isMale = true;        AppDelegate::S51TextViewStr = "";                feedBackSp = CCSprite::create("S41FeedBack.png");        feedBackSp->setPosition(ccp(530,330));        this->addChild(feedBackSp, zNum, 10);                float pox = 487;        float poy = 477;                male = CCSprite::create("S49RadioSelected.png");        male->setPosition(ccp(pox,poy));        this->addChild(male,zNum);                CCSprite * sprite1 = CCSprite::create();        CCSprite * sprite2 = CCSprite::create();        CCMenuItemSprite * maleItem = CCMenuItemSprite::create(                                                               sprite1,                                                               sprite2,                                                               this,                                                               menu_selector(S411FeedBack::changeSex));        maleItem->setPosition(male->getPosition());        maleItem->setContentSize(CCSizeMake(male->getContentSize().width*3, male->getContentSize().height*3));        _menu->addChild(maleItem,zNum);                                        famale =CCSprite::create("S49RadioSelected.png");        famale->setPosition(ccp(pox+45,poy));        this->addChild(famale,zNum);        famale->setOpacity(0);                CCSprite * sprite3 = CCSprite::create();        CCSprite * sprite4 = CCSprite::create();        CCMenuItemSprite * faMaleItem = CCMenuItemSprite::create(sprite3, sprite4,this,menu_selector(S411FeedBack::changeSex));        faMaleItem->setPosition(famale->getPosition());        faMaleItem->setContentSize(CCSizeMake(famale->getContentSize().width*3, famale->getContentSize().height*3));        _menu->addChild(faMaleItem,zNum);                        float editFontSize = 10;        float addWidth = 128.0;        float addHeight = 45;        const char * input = "";                CCScale9Sprite *sacel9SprG1=CCScale9Sprite::create("S49Submit.png");        sacel9SprG1->setOpacity(1);        nameBox=CCEditBox::create(CCSizeMake(sacel9SprG1->getContentSize().width*2.8, sacel9SprG1->getContentSize().height), sacel9SprG1);        nameBox->setFontName(s1FontName_macro);        nameBox->setFontSize(editFontSize);        nameBox->setFontColor(ccBLACK);        nameBox->setInputMode(kEditBoxInputModeAny);        nameBox->setPlaceHolder(input);        nameBox->setPosition(ccp(240+addWidth,430+addHeight));        this->addChild(nameBox,zNum);        nameBox->setDelegate(this);                                        CCScale9Sprite *sacel9SprG2=CCScale9Sprite::create("S49Submit.png");        sacel9SprG2->setOpacity(1);        telBox=CCEditBox::create(CCSizeMake(sacel9SprG2->getContentSize().width*2.8, sacel9SprG2->getContentSize().height), sacel9SprG2);        telBox->setFontSize(editFontSize);        telBox->setFontColor(ccBLACK);        telBox->setPlaceHolder(input);        telBox->setPosition(ccp(240+addWidth,400+addHeight));        this->addChild(telBox,zNum);        telBox->setDelegate(this);                        CCScale9Sprite *sacel9SprG3=CCScale9Sprite::create("S49Submit.png");        sacel9SprG3->setOpacity(1);        mobilePhoneBox=CCEditBox::create(CCSizeMake(sacel9SprG3->getContentSize().width*2.8, sacel9SprG3->getContentSize().height), sacel9SprG3);        mobilePhoneBox->setFontSize(editFontSize);        mobilePhoneBox->setFontColor(ccBLACK);        mobilePhoneBox->setPlaceHolder(input);        mobilePhoneBox->setPosition(ccp(240+addWidth,365+addHeight));        this->addChild(mobilePhoneBox,zNum);        mobilePhoneBox->setDelegate(this);                                CCScale9Sprite *sacel9SprG4=CCScale9Sprite::create("S49Submit.png");        sacel9SprG4->setOpacity(1);        mailBox=CCEditBox::create(CCSizeMake(sacel9SprG4->getContentSize().width*2.8, sacel9SprG4->getContentSize().height), sacel9SprG4);        mailBox->setFontSize(editFontSize);        mailBox->setFontColor(ccBLACK);        mailBox->setPlaceHolder(input);        mailBox->setPosition(ccp(240+addWidth,335+addHeight));        this->addChild(mailBox,zNum);        mailBox->setDelegate(this);//.........这里部分代码省略.........
开发者ID:Ratel13,项目名称:JinRiCompany,代码行数:101,


示例19: toucheventselector

bool UIStrengthen::init(){	if (!CCLayer::init())	{		return false;	}	uiLayer = UILayer::create();	UILayout* strengthenRoot = dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("ui/UIStrengthen.ExportJson"));	uiLayer->addWidget(strengthenRoot);	UIButton* closeButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("CloseButton"));	closeButton->addTouchEventListener(this, toucheventselector(UIStrengthen::closeButtonClicked));	UIButton* strengthenButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("StrengthenButton"));	strengthenButton->addTouchEventListener(this, toucheventselector(UIStrengthen::strengthenButtonClicked));	UIButton* pageLeftButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("PageLeftButton"));	pageLeftButton->addTouchEventListener(this, toucheventselector(UIStrengthen::pageLeftButtonClicked));	UIButton* pageRightButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("PageRightButton"));	pageRightButton->addTouchEventListener(this, toucheventselector(UIStrengthen::pageRightButtonClicked));	for (int i = 0; i < 4; i++)	{		const char* s = CCString::createWithFormat("EquipmentButton_%d", i+1)->getCString();		UIButton* equipmentButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName(s));		equipmentButton->addTouchEventListener(this, toucheventselector(UIStrengthen::equipmentButtonClicked));	}	for (int i = 0; i < 2; i++)	{		const char* s = CCString::createWithFormat("GemButton_%d", i+1)->getCString();		UIButton* gemButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName(s));		gemButton->addTouchEventListener(this, toucheventselector(UIStrengthen::gemButtonClicked));	}	for (int i = 0; i < 4; i++)	{		const char* s = CCString::createWithFormat("EquipmentImageView_%d", i+1)->getCString();		equipmentImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));	}	for (int i = 0; i < 3; i++)	{		const char* s = CCString::createWithFormat("GemImageView_%d", i+1)->getCString();		gemImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));	}	for (int i = 0; i < 2; i++)	{		const char* s = CCString::createWithFormat("GemFrontImageView_%d", i+1)->getCString();		gemFrontImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));	}	strengthenfeatureImageView = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName("FeatureImageView"));	strengthenTestButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("StrengthenTestButton"));	selectFrameImageView = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName("SelectFrameImageView"));	UIPanel* tableViewPanel = dynamic_cast<UIPanel*>(uiLayer->getWidgetByName("TableViewPanel"));	CCTableView* strengthenTableView = CCTableView::create(this, CCSizeMake(strengthenTestButton->getContentSize().width, tableViewPanel->getContentSize().height));	strengthenTableView->setDirection(kCCScrollViewDirectionVertical);	strengthenTableView->setVerticalFillOrder(kCCTableViewFillTopDown);	CCPoint strengthenTestPosition = strengthenTestButton->getPosition();	strengthenTableView->setPosition(ccp(strengthenTestPosition.x, strengthenTestPosition.y - tableViewPanel->getContentSize().height));	strengthenTableView->setDelegate(this);	strengthenTableView->reloadData();	addChild(uiLayer);	addChild(strengthenTableView);	setVisible(false);	refresh();	return true;}
开发者ID:joyfish,项目名称:tianxiadiyi,代码行数:80,


示例20: CCLog

void ArenaWindow::recv_3700(){    Message *revMsg=(Message *)CData::getCData()->m_dictionary->objectForKey(3700);    CData::getCData()->m_dictionary->removeObjectForKey(3700);            if(revMsg)    {        load->removeFromParent();                this->unschedule(schedule_selector(ArenaWindow::recv_3700));        char* data=revMsg->data;        CCLog("%s",data);        Json::Reader read;        Json::Value root;        Json::Value jsonData;        Json::Value petlist;                        if(read.parse(data, root)){                        CCSprite* sp = CCSprite::create();                        jsonData=root["data"];            petlist=jsonData["dsList"];                        int sptimes = jsonData["sptimes"].asInt();                        char titlechar[100] = "";            sprintf(titlechar, "当前排名:%d  今日挑战剩余次数:%d",jsonData["ranking"].asInt(),jsonData["sptimes"].asInt());            CCLabelTTF* titel = CCLabelTTF::create(titlechar, "hycc.ttf", 22,CCSizeMake(400, 0),kCCTextAlignmentCenter);            titel->setColor(ccc3(255, 219, 160));            titel->setPosition(ccp(size.width/2, 600));            this->addChild(titel);                        int len = petlist.size();                        for (int i=0; i<len; i++) {                                CCScale9Sprite* item = CCScale9Sprite::create("arena_item_bkg.png");                item->setContentSize(CCSizeMake(410, 85));                char rank[10] = "";                sprintf(rank, "%d",jsonData["dsList"][i]["ranking"].asInt());                CCLabelTTF* ranking = CCLabelTTF::create(rank, "hycc.ttf", 20,CCSizeMake(200, 0),kCCTextAlignmentCenter);                //ranking->setColor(ccc3(255, 219, 160));                ranking->setPosition(ccp(37, 42));                item->addChild(ranking);                                CCLabelTTF* nickname = CCLabelTTF::create(jsonData["dsList"][i]["nickname"].asString().c_str(), "hycc.ttf", 18,CCSizeMake(200, 0),kCCTextAlignmentLeft);                nickname->setColor(ccc3(255, 219, 160));                nickname->setAnchorPoint(ccp(0, 0));                nickname->setPosition(ccp(85, 30));                item->addChild(nickname);                                char levelchar[10] = "";                sprintf(levelchar, "%d级",jsonData["dsList"][i]["level"].asInt());                CCLabelTTF* level = CCLabelTTF::create(levelchar, "hycc.ttf", 18,CCSizeMake(200, 0),kCCTextAlignmentLeft);                level->setAnchorPoint(ccp(0, 0));                level->setColor(ccc3(255, 219, 160));                level->setPosition(ccp(180, 30));                item->addChild(level);                                if (sptimes != 0) {                    CCMenuItemImage* ok = CCMenuItemImage::create("arena_btn_bat_1.png", "arena_btn_bat_2.png", this, menu_selector(ArenaWindow::clk_battle));                    ok->setTag(jsonData["dsList"][i]["characterId"].asInt());                    CCMenu* menu = CCMenu::create();                    menu->setAnchorPoint(ccp(0, 0));                    menu->setPosition(ccp(370, 40));                    menu->addChild(ok);                    item->addChild(menu);                }                                                CCSprite* qsbkg = CCSprite::create("common_qs_bkg_4.png");                qsbkg->setScale(1.0);                                int pro = jsonData["dsList"][i]["profession"].asInt();                                char prochar[20] = "";                sprintf(prochar, "qs_%04d.png",pro);                                CCSprite* headsp = CCSprite::create(prochar);                headsp->setScale(0.18);                headsp->setAnchorPoint(ccp(0, 0));                qsbkg->addChild(headsp);                                qsbkg->setPosition(ccp(265, 38));                item->addChild(qsbkg);                                                                item->setAnchorPoint(ccp(0.5, 1));                item->setPosition(ccp(0,-i*82));//82                sp->addChild(item);            }            sp->setPosition(ccp(size.width/2, 560));            this->addChild(sp);        }    }//.........这里部分代码省略.........
开发者ID:KuaiFaMaster,项目名称:KuaifaCppDemo,代码行数:101,


示例21: CCSizeMake

cocos2d::CCSize UIStrengthen::cellSizeForTable( CCTableView* table ){	return  CCSizeMake(strengthenTestButton->getContentSize().width, strengthenTestButton->getContentSize().height);}
开发者ID:joyfish,项目名称:tianxiadiyi,代码行数:4,


示例22: sliderpercentchangedselector

/*===*/bool UISliderTest_Scale9::init(){    if (UIScene::init())    {        CCSize widgetSize = m_pWidget->getSize();                // Add a label in which the slider alert will be displayed        m_pDisplayValueLabel = UILabel::create();        m_pDisplayValueLabel->setText("Move the slider thumb");        m_pDisplayValueLabel->setFontName("Marker Felt");        m_pDisplayValueLabel->setFontSize(32);        m_pDisplayValueLabel->setAnchorPoint(ccp(0.5f, -1));        m_pDisplayValueLabel->setPosition(ccp(widgetSize.width / 2.0f, widgetSize.height / 2.0f));        m_pUiLayer->addWidget(m_pDisplayValueLabel);                // Add the alert        UILabel *alert = UILabel::create();        alert->setText("Slider scale9 render");        alert->setFontName("Marker Felt");        alert->setFontSize(30);        alert->setColor(ccc3(159, 168, 176));        alert->setPosition(ccp(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 1.75));        m_pUiLayer->addWidget(alert);                // Create the slider        UISlider* slider = UISlider::create();        slider->setTouchEnabled(true);        slider->loadBarTexture("cocosgui/sliderTrack2.png");        slider->loadSlidBallTextures("cocosgui/sliderThumb.png", "cocosgui/sliderThumb.png", "");        slider->loadProgressBarTexture("cocosgui/slider_bar_active_9patch.png");        slider->setScale9Enabled(true);        slider->setCapInsets(CCRectMake(0, 0, 0, 0));        slider->setSize(CCSizeMake(250, 19));        slider->setPosition(ccp(widgetSize.width / 2.0f, widgetSize.height / 2.0f));//        slider->setPosition(ccp(widgetSize.width / 2.0f, widgetSize.height / 2.0f + slider->getSize().height * 2));        slider->addEventListenerSlider(this, sliderpercentchangedselector(UISliderTest_Scale9::sliderEvent));        m_pUiLayer->addWidget(slider);        /*        // Create the slider that set allow min progress and allow max progress        UISlider* sliderAllow = UISlider::create();        //===////        sliderAllow->setMinAllowPercent(20);//        sliderAllow->setMaxAllowPercent(80);        //        sliderAllow->setTouchEnabled(true);        sliderAllow->loadBarTexture("cocosgui/sliderTrack2.png");        sliderAllow->loadSlidBallTextures("cocosgui/sliderThumb.png", "cocosgui/sliderThumb.png", "");        sliderAllow->loadProgressBarTexture("cocosgui/slider_bar_active_9patch.png");        sliderAllow->setScale9Enabled(true);        sliderAllow->setCapInsets(CCRectMake(0, 0, 0, 0));        sliderAllow->setSize(CCSizeMake(250, 10));        sliderAllow->setPosition(ccp(widgetSize.width / 2.0f, widgetSize.height / 2.0f - slider->getSize().height * 2));        sliderAllow->addEventListenerSlider(this, sliderpercentchangedselector(UISliderTest_Scale9::sliderEvent));        m_pUiLayer->addWidget(sliderAllow);        */                return true;    }    return false;}
开发者ID:1901,项目名称:cocos2d-x,代码行数:62,


示例23: CCLog

bool xuanren::init(){    if(!CCLayer::init()){        return false;    }        CCLog("xuanren---------------------------0");    flag=0;    size=CCDirector::sharedDirector()->getWinSize();    CCSprite *backGround=CCSprite::create("selectrole_bkg.png");    backGround->setPosition(ccp(size.width/2, size.height/2));    this->addChild(backGround);   CCSprite *  kuang=CCSprite::create("common_item_bkg.png");    kuang->setScale(1);    kuang->setTag(9002);//    kuang->setAnchorPoint(ccp(0, 0));    selectBtn=CCMenuItemImage::create("common_btn_ok_1.png", "common_btn_ok_2.png", "common_btn_ok_3.png",this, menu_selector(xuanren::EnterName));    selectBtn->setScale(1.3);    CCMenu *selectMenu=CCMenu::create(selectBtn,NULL);    selectMenu->setPosition(ccp(size.width/2, 100));    this->addChild(selectMenu,1);     CCLog("xuanren---------------------------1");        jieshao=CCLabelTTF::create("", "hycc.ttf", 23, CCSizeMake(450,58),kCCTextAlignmentCenter);    jieshao->setColor(ccc3(134,105,59));    jieshao->setAnchorPoint(ccp(0, 0));    jieshao->setPosition(ccp(50, 245));//原始375    jieshao->setDimensions(CCSizeMake(300, 0));    jieshao->setHorizontalAlignment(kCCTextAlignmentLeft);    jieshao->setVerticalAlignment(kCCVerticalTextAlignmentTop);    this->addChild(jieshao,1);    mingcheng=CCLabelTTF::create("第三方","hycc.ttf" , 40, CCSizeMake(120,40), kCCTextAlignmentLeft);    mingcheng->setPosition(ccp(80, 905));//原始275    //this->addChild(mingcheng,1);    jineng=CCLabelTTF::create("技能:啊啊", "hycc.ttf", 25,CCSizeMake(135,25), kCCTextAlignmentLeft);    jineng->setPosition(ccp(85, 860));//原始280    //this->addChild(jineng,1);    mingcheng=CCLabelTTF::create("第三方","hycc.ttf" , 40, CCSizeMake(110,40), kCCTextAlignmentLeft);//    touxiang1=CCSprite::create(r_xuanren_icon);//    touxiang1->setPosition(ccp(540, 835));//原始100//    touxiang2=CCSprite::create(r_xuanren_icon);//    touxiang2->setPosition(ccp(540, 660));//    touxiang3=CCSprite::create(r_xuanren_icon);//    touxiang3->setPosition(ccp(540, 485));        //    CCSize sz = CCSizeMake(72, 72);        btn1=CCMenuItemImage::create("common_item_bkg1.png", "common_item_bkg1.png", this, menu_selector(xuanren::FirstPerson));    CCSize btnSize=btn1->getContentSize();    btn1->setScale(1.0);         CCLog("xuanren---------------------------2");        CCSprite* btnsp1 = CCSprite::create("qs_0001.png");    btnsp1->setScale(0.18);    btnsp1->setAnchorPoint(ccp(0.5,0.5));    //btnsp1->setPosition(ccp(0,0));    btn1->addChild(btnsp1);    btnsp1->setPosition(ccp(btnSize.width/2, btnSize.height/2));//    btn1->setScale(0.38);//    CCSprite * pzk=CCSprite::create("pz_k_04.png");//    pzk->setAnchorPoint(ccp(0, 0));//    pzk->setPosition(ccp(0, 0));//    btn1->addChild(pzk);//    btn1->setPosition(ccp(-160, 0));//0  175            btn2=CCMenuItemImage::create("common_item_bkg1.png", "common_item_bkg1.png", this, menu_selector(xuanren::SecondPerson));    btn2->setScale(1.0);        CCSprite* btnsp2 = CCSprite::create("qs_0002.png");    btnsp2->setScale(0.18);    btnsp2->setAnchorPoint(ccp(0.5,0.5));    btn2->addChild(btnsp2);    btnsp2->setPosition(ccp(btnSize.width/2, btnSize.height/2));//    CCSprite * pzk2=CCSprite::create("pz_k_04.png");//    pzk2->setAnchorPoint(ccp(0, 0));//    pzk2->setPosition(ccp(0, 0));//    btn2->addChild(pzk2);//    btn2->setPosition(ccp(0, 0));//0    0            btn3=CCMenuItemImage::create("common_item_bkg1.png", "common_item_bkg1.png", this, menu_selector(xuanren::ThridPerson));    btn3->setScale(1.0);        CCSprite* btnsp3 = CCSprite::create("qs_0003.png");    btnsp3->setScale(0.18);    btnsp3->setAnchorPoint(ccp(0.5,0.5));    btn3->addChild(btnsp3);    btnsp3->setPosition(ccp(btnSize.width/2, btnSize.height/2));//    CCSprite * pzk3=CCSprite::create("pz_k_04.png");//    pzk3->setAnchorPoint(ccp(0, 0));//    pzk3->setPosition(ccp(0, 0));//    btn3->addChild(pzk3);//    btn3->setPosition(ccp(160, 0));//0    0                //.........这里部分代码省略.........
开发者ID:GeekMobileShop,项目名称:diabloWorld,代码行数:101,


示例24: CCSizeMake

CCRect GameObjHero::rect(){    CCSize s = CCSizeMake(100, 125);    return CCRectMake(-s.width/2, -s.height/2, s.width, s.height);}
开发者ID:pandazheng,项目名称:LuoLiRunGame,代码行数:5,


示例25: CCSizeMake

CCSize FriendList::cellSizeForTable(CCTableView *table){    return CCSizeMake(SCREEN_WIDTH, CELL_HEIGHT + 2);}
开发者ID:chenbk85,项目名称:EziSocialDemo,代码行数:4,


示例26: switch

void ImageViewReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options){    WidgetReader::setPropsFromJsonDictionary(widget, options);            std::string jsonPath = GUIReader::shareReader()->getFilePath();        ui::ImageView* imageView = (ui::ImageView*)widget;        const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "fileNameData");    int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");    switch (imageFileNameType)    {        case 0:        {            std::string tp_i = jsonPath;            const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");            const char* imageFileName_tp = NULL;            if (imageFileName && (strcmp(imageFileName, "") != 0))            {                imageFileName_tp = tp_i.append(imageFileName).c_str();                imageView->loadTexture(imageFileName_tp);            }            break;        }        case 1:        {            const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");            imageView->loadTexture(imageFileName, ui::UI_TEX_TYPE_PLIST);            break;        }        default:            break;    }        bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, "scale9Enable");    bool scale9Enable = false;    if (scale9EnableExist)    {        scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");    }    imageView->setScale9Enabled(scale9Enable);            if (scale9Enable)    {        bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");        bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");        if (sw && sh)        {            float swf = DICTOOL->getFloatValue_json(options, "scale9Width");            float shf = DICTOOL->getFloatValue_json(options, "scale9Height");            imageView->setSize(CCSizeMake(swf, shf));        }                float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");        float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");        float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");        float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");                imageView->setCapInsets(CCRectMake(cx, cy, cw, ch));            }            WidgetReader::setColorPropsFromJsonDictionary(widget, options);}
开发者ID:BlackStar0313,项目名称:TrumanMustDie,代码行数:67,


示例27: menu_selector

bool FriendList::init(){    if ( !CCLayer::init())    {        return false;    }        mEnableHighScoreDisplay = false;    mEnableInstalledDisplay = false;    mReadyForNextDownload   = false;    mPhotoLoadIndex         = 0;        EziSocialObject::sharedObject()->setFacebookDelegate(this);        CCSize winSize = CCDirector::sharedDirector()->getVisibleSize();    SCREEN_WIDTH  = winSize.width;    SCREEN_HEIGHT = winSize.height;        CCLayerColor *backgroundLayer = CCLayerColor::create(ccc4(20, 100, 100, 255), SCREEN_WIDTH, SCREEN_HEIGHT);        this->addChild(backgroundLayer);            MENU_FONT_SCALE = SCREEN_HEIGHT/320;            // Back Menu        CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(FriendList::showHomePage));	itemBack->setPosition(ccp(SCREEN_WIDTH/2, (itemBack->getContentSize().height/2 + 2) * MENU_FONT_SCALE));	    CCMenuItemFont *itemHighScore = CCMenuItemFont::create("High Scores", this, menu_selector(FriendList::showHighScoreList));    itemHighScore->setAnchorPoint(ccp(1, 0.5));    itemHighScore->setPosition(ccp((SCREEN_WIDTH-10), itemBack->getPositionY()));        CCMenuItemFont *allFriends = CCMenuItemFont::create("All Friends", this, menu_selector(FriendList::showAllFriendsList));    allFriends->setAnchorPoint(ccp(0, 0.5));    allFriends->setPosition(ccp((10), itemBack->getPositionY()));        CCMenuItemFont *installedOnly = CCMenuItemFont::create("Installed Only", this, menu_selector(FriendList::showInstalledList));    installedOnly->setAnchorPoint(ccp(0, 1));    installedOnly->setPosition(ccp((10), SCREEN_HEIGHT - 2));        CCMenuItemFont *notPlaying = CCMenuItemFont::create("Friends Not Playing", this, menu_selector(FriendList::showNotInstalledList));    notPlaying->setAnchorPoint(ccp(1, 1));    notPlaying->setPosition(ccp((SCREEN_WIDTH-10), SCREEN_HEIGHT - 2));                    itemBack->setScale(MENU_FONT_SCALE);    itemHighScore->setScale(MENU_FONT_SCALE);    allFriends->setScale(MENU_FONT_SCALE);    installedOnly->setScale(MENU_FONT_SCALE);    notPlaying->setScale(MENU_FONT_SCALE);        CCMenu *menuBack = CCMenu::create(itemBack, itemHighScore, allFriends, installedOnly, notPlaying, NULL);	menuBack->setPosition(CCPointZero);	addChild(menuBack);        float gap = itemBack->getContentSize().height * 2 * MENU_FONT_SCALE + (10 * MENU_FONT_SCALE);        mFriendList = NULL;        PHOTO_SCALE = SCREEN_HEIGHT/1536;        if (PHOTO_SCALE <= 0.5 && PHOTO_SCALE > 0.25)    {        FB_DEFAULT_PHOTO = "fb_user_icon_half.jpg";    }    else if (PHOTO_SCALE < 0.25)    {        FB_DEFAULT_PHOTO = "fb_user_icon_quater.jpg";    }            CCSprite *sprite = CCSprite::create(FB_DEFAULT_PHOTO);    CELL_HEIGHT = (sprite->getContentSize().height) + (40 * PHOTO_SCALE);            mTableView = CCTableView::create(this, CCSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT - gap));    mTableView->setDirection(kCCScrollViewDirectionVertical);    mTableView->setPosition(ccp(0, gap/2));        mTableView->setDelegate(this);    this->addChild(mTableView);        mTableView->reloadData();        ALL_DOWNLOAD_COMPLETE = true;        mLoadingImage = CCSprite::create("ball.png");    mLoadingImage->setPosition(ccp(SCREEN_WIDTH/2, SCREEN_HEIGHT/2));    mLoadingImage->retain();        this->addChild(mLoadingImage);    this->hideLoadingAction();        return true;}
开发者ID:chenbk85,项目名称:EziSocialDemo,代码行数:100,


示例28: changeWidthAndHeight

void CCLayerColor::changeWidthAndHeight(GLfloat w ,GLfloat h){	this->setContentSize(CCSizeMake(w, h));}
开发者ID:classfoo,项目名称:cocos2d-x,代码行数:4,


示例29: CCSizeMake

void CC3VertexTextureCoordinates::repeatTexture( const ccTex2F& repeatFactor ){	CCSize repeatSize = CCSizeMake(repeatFactor.u * m_mapSize.width, repeatFactor.v * m_mapSize.height);	alignWithTextureCoverage( repeatSize );}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:5,



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


C++ CC_ASSERT函数代码示例
C++ CCSize函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。