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


C++ CCMenuItemFont::setScale方法代码示例

本文整理汇总了C++中CCMenuItemFont::setScale方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemFont::setScale方法的具体用法?C++ CCMenuItemFont::setScale怎么用?C++ CCMenuItemFont::setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCMenuItemFont的用法示例。


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

示例1: ccp

KDbool Ch7_GridPathfinding::init ( KDvoid )
{	
	// Superclass initialization and message
	if ( !Recipe::init ( ) )
	{
		return KD_FALSE;
	}

	this->showMessage ( "Tap and hold to draw walls.\nPress 'Find Path' to run the simulation." );

	//Initial variables
	m_tGridSize			= ccp ( 25, 15 );
	m_fNodeSpace		= 16.0f;
	m_tTouchedNode		= ccp ( 0, 0 );
	m_tStartCoord		= ccp ( 2, 2 );
	m_tEndCoord			= ccp ( m_tGridSize.x - 3, m_tGridSize.y - 3 );
	m_bTouchedNodeIsNew = KD_FALSE;
	m_pFoundPath		= new CCArray ( );
	m_bAddMode			= KD_TRUE;
	
	// Seperate grid node
	m_pGridNode = CCNode::create ( );
	m_pGridNode->setPosition ( ccp ( 35, 15 ) );
	this->addChild ( m_pGridNode, 3 ); 

	// Create 2D array (grid)
	m_pGrid = new CCArray ( (KDint) m_tGridSize.x ); 
	for ( KDint x = 0; x < (KDint) m_tGridSize.x; x++ )
	{
		m_pGrid->addObject ( CCArray::createWithCapacity ( (KDint) (KDint) m_tGridSize.y ) );
	}

	// Create AStar nodes and place them in the grid
	for ( KDint x = 0; x < (KDint) m_tGridSize.x; x++ )
	{
		for ( KDint y = 0; y < (KDint) m_tGridSize.y; y++ )
		{
			// Add a node
			AStarNode*	pNode = AStarNode::create ( );
			pNode->setPosition ( ccp ( x * m_fNodeSpace + m_fNodeSpace / 2, y * m_fNodeSpace + m_fNodeSpace / 2 ) );
			( (CCArray*) m_pGrid->objectAtIndex ( x ) )->addObject ( pNode );
		}
	}
	
	// Add neighbor nodes
	for ( KDint x = 0; x < (KDint) m_tGridSize.x; x++ )
	{
		for ( KDint y = 0; y < (KDint) m_tGridSize.y; y++ )
		{			
			// Add a node
			AStarNode*	pNode = (AStarNode*) ( (CCArray*) m_pGrid->objectAtIndex ( x ) )->objectAtIndex ( y );
			
			// Add self as neighbor to neighboring nodes
			this->addNeighbor ( pNode, x - 1, y - 1 );		// Top-Left
			this->addNeighbor ( pNode, x - 1, y     );		// Left
			this->addNeighbor ( pNode, x - 1, y + 1 );		// Bottom-Left
			this->addNeighbor ( pNode, x    , y - 1 );		// Top
			
			this->addNeighbor ( pNode, x    , y + 1 );		// Bottom
			this->addNeighbor ( pNode, x + 1, y - 1 );		// Top-Right
			this->addNeighbor ( pNode, x + 1, y     );		// Right
			this->addNeighbor ( pNode, x + 1, y + 1 );		// Bottom-Right		
		}
	}

	// Add visual represenation of nodes
	this->addGridArt ( );
	
	// Menu items 
	CCMenuItemFont::setFontSize ( 30 );

	CCMenuItemFont*		pFindPathItem = CCMenuItemFont::create ( "Find Path", this, menu_selector ( Ch7_GridPathfinding::findPath ) );
	pFindPathItem->setScale ( 0.65f );
	
	CCMenuItemToggle*	pSwitchModeItem = CCMenuItemToggle::createWithTarget 
	(
		this, 
		menu_selector ( Ch7_GridPathfinding::switchMode ), 
		CCMenuItemFont::create ( "Switch Mode: Remove Wall" ),
		CCMenuItemFont::create ( "Switch Mode: Add Wall" ), 
		KD_NULL 
	);
	pSwitchModeItem->setScale ( 0.65f );
	
	CCMenu*				pMenu = CCMenu::create ( pFindPathItem, pSwitchModeItem, KD_NULL );
	pMenu->alignItemsVertically ( 0 );
	pMenu->setPosition ( ccp ( 350, 290 ) );
	this->addChild ( pMenu, Z_HUD );

	// Add draw layer
	this->addDrawLayer ( );
	
	// Schedule step method
	this->schedule ( schedule_selector ( Ch7_GridPathfinding::step ) );

	return KD_TRUE;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:97,代码来源:Ch7_GridPathfinding.cpp

示例2: init

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,代码来源:FriendList.cpp

示例3: init

bool RequestList::init()
{
    if ( !CCLayer::init())
    {
        return 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(RequestList::showHomePage));
    itemBack->setAnchorPoint(ccp(1, 0.5));
	itemBack->setPosition(ccp(SCREEN_WIDTH - 10, (itemBack->getContentSize().height/2 + 2) * MENU_FONT_SCALE));
	
    CCMenuItemFont *purgeItems = CCMenuItemFont::create("Clear Completed Requests",
                                                           this,
                                                           menu_selector(RequestList::clearCompletedRequest));
    purgeItems->setAnchorPoint(ccp(0, 0.5));
    purgeItems->setPosition(ccp(10, (itemBack->getContentSize().height/2 + 2) * MENU_FONT_SCALE));
    
    
    itemBack->setScale(MENU_FONT_SCALE);
    purgeItems->setScale(MENU_FONT_SCALE);
    
    CCMenu *menuBack = CCMenu::create(itemBack, purgeItems, NULL);
	menuBack->setPosition(CCPointZero);
	addChild(menuBack);
    
    float gap = itemBack->getContentSize().height * 2 * MENU_FONT_SCALE + (10 * MENU_FONT_SCALE);
    
    _fbIncomingRequestList = NULL;
    
    refreshList();

    SCALE_FACTOR  = SCREEN_HEIGHT / 768.0f;
    SCALE_FACTOR = MAX(0.5, SCALE_FACTOR);
    
    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,代码行数:88,代码来源:RequestList.cpp

示例4: CCRectMake


//.........这里部分代码省略.........
        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);
        
        
        CCScale9Sprite *sacel9SprG5=CCScale9Sprite::create("S49Submit.png");
        sacel9SprG5->setOpacity(1);
        msnBox=CCEditBox::create(CCSizeMake(sacel9SprG5->getContentSize().width*2.8, sacel9SprG5->getContentSize().height), sacel9SprG5);
        msnBox->setFontSize(editFontSize);
        msnBox->setFontColor(ccBLACK);
        msnBox->setPlaceHolder(input);
        msnBox->setPosition(ccp(240+addWidth,305+addHeight));
        this->addChild(msnBox,zNum);
        msnBox->setDelegate(this);
        
        
        CCScale9Sprite *sacel9SprG6=CCScale9Sprite::create("S49Submit.png");
        sacel9SprG6->setOpacity(1);
        addressBox=CCEditBox::create(CCSizeMake(sacel9SprG6->getContentSize().width*4, sacel9SprG6->getContentSize().height), sacel9SprG6);
        addressBox->setFontSize(editFontSize);
        addressBox->setFontColor(ccBLACK);
        addressBox->setPlaceHolder(input);
        addressBox->setPosition(ccp(270+addWidth,269+addHeight));
        this->addChild(addressBox,zNum);
        addressBox->setDelegate(this);
        
        CCScale9Sprite *sacel9SprG7=CCScale9Sprite::create("S49Submit.png");
        sacel9SprG7->setOpacity(1);
        submitBox=CCEditBox::create(CCSizeMake(sacel9SprG7->getContentSize().width*1.5, sacel9SprG7->getContentSize().height), sacel9SprG7);
        submitBox->setFontSize(editFontSize);
        submitBox->setFontColor(ccBLACK);
       // submitBox->setPlaceHolder("asdhjashdkjansda\nasdjgkjahdkjas");//input);
        submitBox->setPosition(ccp(210+addWidth,140+addHeight));
        this->addChild(submitBox,zNum);
        submitBox->setDelegate(this);
        
        textView = CCUIKit::create();
        CCRect aRect = CCRectMake(295, 480, 500, 100);
        textView->creatWithRect(aRect,this);
        addChild(textView);
        AppDelegate::isTextViewExist = false;
        
        CCScale9Sprite *sacel9SprG8=CCScale9Sprite::create("S49Submit.png");
        sacel9SprG8->setOpacity(1);
        yanzhengBox=CCEditBox::create(CCSizeMake(sacel9SprG8->getContentSize().width*1.5, sacel9SprG8->getContentSize().height), sacel9SprG8);
        yanzhengBox->setFontSize(editFontSize);
        yanzhengBox->setFontColor(ccBLACK);
        yanzhengBox->setPlaceHolder(input);
        yanzhengBox->setPosition(ccp(210+addWidth,110+addHeight));
        this->addChild(yanzhengBox,zNum);
        yanzhengBox->setDelegate(this);
        
        
        
        CCMenuItemFont *aItem = CCMenuItemFont::create("提交留言",this,menu_selector(S411FeedBack::submit));
        aItem->setOpacity(1);
        aItem->setColor(ccBLACK);
        aItem->setScale(1.2);
        aItem->setPosition(ccp(550,165));
        aItem->setContentSize(CCSizeMake(100,100));
        _menu ->addChild(aItem,zNum);
    
        CCLabelTTF * titlelabel = CCLabelTTF::create("我要加盟", s1FontName_macro, 15);
        titlelabel->setPosition(ccp(visibleSize.width/2,visibleSize.height/2+155));
        titlelabel->setColor(ccWHITE);
        this->addChild(titlelabel,zNum+1000);
        
		bRet = true;
	} while (0);
    
	return bRet;
}
开发者ID:Ratel13,项目名称:JinRiCompany,代码行数:101,代码来源:S411FeedBack.cpp


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