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


C++ Scale9Sprite::setTag方法代码示例

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


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

示例1: semiselected

void PubSprite::semiselected()
{
    if (pub_sprite_ == NULL)
        return;
    const float kDisplayWidth = 354.0 * gScale;
    const float kDisplayHeight = 530.0 * gScale;
    Rect inset_rect = CCRectMake(38, 29, 1, 1);
    Rect full_rect = CCRectMake(0, 0, 74, 284);
    pub_sprite_->removeAllChildren();

    /* add the sun state */
    Sprite *sun = Sprite::create("main_screen/sun_semi.png");
    const float kSunOffsetY = 317;
    if (gScale == 1.0)
        sun->setPosition(ccp(kDisplayWidth*2/3, kDisplayHeight*2/3+kSunOffsetY));
    else
        sun->setPosition(ccp(kDisplayWidth, kDisplayHeight+kSunOffsetY));

    sun->setTag(2);
    pub_sprite_->addChild(sun, 1);
    /* add the white border*/
    const float kBorderWidth = 480;
    const float kBorderHeight = 706;
    const float kBorderX = 226;
    const float kBorderY = 336;
    Scale9Sprite *yborder = Scale9Sprite::create("main_screen/border_selected.png", full_rect, inset_rect); 
    yborder->setPreferredSize(CCSizeMake(kBorderWidth, kBorderHeight));
    yborder->setPosition(ccp(kBorderX, kBorderY));
    yborder->setTag(2);
    pub_sprite_->addChild(yborder);
}
开发者ID:wanguolin,项目名称:FreeValley,代码行数:31,代码来源:PubSprite.cpp

示例2: unseleted

void PubSprite::unseleted()
{
    if (pub_sprite_ == NULL)
        return;
    const float kDisplayWidth = 354.0 * gScale;
    const float kDisplayHeight = 530.0 * gScale;
    Rect inset_rect = CCRectMake(11, 13, 1, 1);
    Rect full_rect = CCRectMake(0, 0, 22, 23);
    pub_sprite_->removeAllChildren();
    /* add the cloud state */
    Sprite *cloud = Sprite::create("main_screen/cloud_unselected.png");
    const float kCloudOffsetY = 317;
    if (gScale == 1.0)
        cloud->setPosition(ccp(kDisplayWidth*2/3, kDisplayHeight*2/3+kCloudOffsetY));
    else
        cloud->setPosition(ccp(kDisplayWidth, kDisplayHeight+kCloudOffsetY));
    cloud->setTag(1);
    pub_sprite_->addChild(cloud, 1);

    /* add the white border*/
    const float kBorderWidth = 460;
    const float kBorderHeight = 685;
    const float kBorderX = 226;
    const float kBorderY = 336;
    Scale9Sprite *wborder = Scale9Sprite::create("main_screen/border_unselected.png", full_rect, inset_rect); 
    wborder->setPreferredSize(CCSizeMake(kBorderWidth, kBorderHeight));
    wborder->setPosition(ccp(kBorderX, kBorderY));
    wborder->setTag(1);
    pub_sprite_->addChild(wborder);
}
开发者ID:wanguolin,项目名称:FreeValley,代码行数:30,代码来源:PubSprite.cpp

示例3: selected

void PubSprite::selected()
{
    if (pub_sprite_ == NULL)
        return;
    const float kDisplayWidth = 354.0 * gScale;
    const float kDisplayHeight = 530.0 * gScale;
    Rect inset_rect = CCRectMake(38, 29, 1, 1);
    Rect full_rect = CCRectMake(0, 0, 74, 284);
    pub_sprite_->removeAllChildren();

    /** 
     * add the sun state 
     */
    Sprite *sun = Sprite::create("main_screen/sun_selected.png");

    /* gScale is 1 means 1080p, so 2/3 is a fixed number to get the right position */
    const float kSunOffsetY = 317;
    if (gScale == 1.0)
        sun->setPosition(ccp(kDisplayWidth*2/3, kDisplayHeight*2/3+kSunOffsetY));
    else
        sun->setPosition(ccp(kDisplayWidth, kDisplayHeight+kSunOffsetY));
    sun->setTag(2);
    pub_sprite_->addChild(sun, 1);

    /** 
     * add the white border
     */
    const float kBorderWidth = 480;
    const float kBorderHeight = 706;
    const float kBorderX = 226;
    const float kBorderY = 336;
    Scale9Sprite *yborder = Scale9Sprite::create("main_screen/border_selected.png", full_rect, inset_rect); 
    yborder->setPreferredSize(CCSizeMake(kBorderWidth, kBorderHeight));
    yborder->setPosition(ccp(kBorderX, kBorderY));
    yborder->setTag(2);
    pub_sprite_->addChild(yborder);
    
    if (pub_title_ != NULL){
        int size = 36;
        if (strlen(pub_title_) > 35){
            size = 32;
        }
        LabelTTF *title= LabelTTF::create(pub_title_, "Arial", size);
        CCLog("title %s, length %d", pub_title_, strlen(pub_title_));
        title->setFontFillColor(ccc3(255, 255, 0));
        pub_sprite_->addChild(title);
        const float kTitleOffsetX = 10;
        const float kTitleOffsetY = 60;
        if (gScale == 1.0)
            title->setPosition(kDisplayWidth*2/3-kTitleOffsetX, kTitleOffsetY);
        else
            title->setPosition(kDisplayWidth-kTitleOffsetX, kTitleOffsetY);
    }
}
开发者ID:wanguolin,项目名称:FreeValley,代码行数:54,代码来源:PubSprite.cpp

示例4: showpubUnselect

void PubSprite::showpubUnselect()
{
    pub_sprite_->removeAllChildren();

    const float kDisplayWidth = 290.0 * gScale;
    const float kDisplayHeight = 544.0 * gScale;
    Rect inset_rect = CCRectMake(12, 12, 1, 1);
    Rect full_rect = CCRectMake(0, 0, 23, 73);

    /* add the cloud state */
    Sprite *cloud = Sprite::create("main_screen/cloud_unselected.png");
    const float kCloudOffsetY = 295;
    const float kCloudOffsetX = 55;
    if (gScale == 1.0)
        cloud->setPosition(ccp(kDisplayWidth*2/3+kCloudOffsetX, kDisplayHeight*2/3+kCloudOffsetY));
    else
        cloud->setPosition(ccp(kDisplayWidth+kCloudOffsetX, kDisplayHeight+kCloudOffsetY));
    cloud->setTag(1);
    pub_sprite_->addChild(cloud, 1);
    /** 
     * add the white border
     */
    const float kBorderWidth = 460;
    const float kBorderHeight = 730;
    const float kBorderX = 225;
    const float kBorderY = 310;
    Scale9Sprite *wborder = Scale9Sprite::create("showlist/border_unselected.png", full_rect, inset_rect); 
    wborder->setPreferredSize(CCSizeMake(kBorderWidth, kBorderHeight));
    wborder->setPosition(ccp(kBorderX, kBorderY));
    wborder->setTag(2);
    pub_sprite_->addChild(wborder);

    if (pub_title_ != NULL){
        int size = 36;
        if (strlen(pub_title_) > 30){
            size = 32;
        }
        LabelTTF *title= LabelTTF::create(pub_title_, "Arial", size);
        /** the color is blue */
        title->setFontFillColor(ccc3(67, 155, 203));
        pub_sprite_->addChild(title);
        const float kTitleOffsetX = 20;
        const float kTitleOffsetY = 20;
        if (gScale == 1.0)
            title->setPosition(kDisplayWidth*2/3+kTitleOffsetX, -kTitleOffsetY);
        else
            title->setPosition(kDisplayWidth+kTitleOffsetX, -kTitleOffsetY);
    }
}
开发者ID:wanguolin,项目名称:FreeValley,代码行数:49,代码来源:PubSprite.cpp

示例5: showpubSelect

void PubSprite::showpubSelect()
{
    pub_sprite_->removeAllChildren();
    const float kDisplayWidth = 290.0 * gScale;
    const float kDisplayHeight = 544.0 * gScale;
    Sprite *sun = Sprite::create("main_screen/sun_semi.png");
    const float kSunOffsetY = 315;
    const float kSunOffsetX = 35;
    if (gScale == 1.0)
        sun->setPosition(ccp(kDisplayWidth*2/3+kSunOffsetX, kDisplayHeight*2/3+kSunOffsetY));
    else
        sun->setPosition(ccp(kDisplayWidth+kSunOffsetX, kDisplayHeight+kSunOffsetY));

    sun->setTag(2);
    pub_sprite_->addChild(sun, 1);
    Rect inset_rect = CCRectMake(30, 27, 1, 1);
    Rect full_rect = CCRectMake(0, 0, 60, 120);
    const float kBorderWidth = 500;
    const float kBorderHeight = 775;
    const float kBorderX = 225;
    const float kBorderY = 298;
    Scale9Sprite *yborder = Scale9Sprite::create("showlist/border_selected.png", full_rect, inset_rect); 
    yborder->setPreferredSize(CCSizeMake(kBorderWidth, kBorderHeight));
    yborder->setPosition(ccp(kBorderX, kBorderY));
    yborder->setTag(2);
    pub_sprite_->addChild(yborder);
    
    if (pub_title_ != NULL){
        int size = 46;
        if (strlen(pub_title_) > 38){
            size = 32;
        }
        LabelTTF *title= LabelTTF::create(pub_title_, "Arial", size);
        /** the color is blue */
        title->setFontFillColor(ccc3(67, 155, 203));
        pub_sprite_->addChild(title);
        const float kTitleOffsetX = 20;
        const float kTitleOffsetY = 30;
        if (gScale == 1.0)
            title->setPosition(kDisplayWidth*2/3+kTitleOffsetX, -kTitleOffsetY);
        else
            title->setPosition(kDisplayWidth+kTitleOffsetX, -kTitleOffsetY);
    }
}
开发者ID:wanguolin,项目名称:FreeValley,代码行数:44,代码来源:PubSprite.cpp


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