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


C++ LayerColor::setPositionY方法代码示例

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


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

示例1: init

bool BuyChipLayer::init()
{
    if(!PokerChildLayer::init()) {
        return false;
    }
    LayerColor *layer = LayerColor::create(Color4B(100,100,100,100));
    this->addChild(layer);
    this->setTouchMode(Touch::DispatchMode::ONE_BY_ONE);
    this->setTouchEnabled(true);
    this->setSwallowsTouches(true);
    
    auto& size = Director::getInstance()->getWinSize();
    auto layout = ui::Layout::create();
    layout->setContentSize(size);
    layout->setTouchEnabled(true);
    layout->setAnchorPoint(Point::ZERO);
    this->addChild(layout, -10);
    
    auto root = CSLoader::createNode("LayerBuyChip1.csb");
    this->addChild(root);
    Size winSize = Director::getInstance()->getWinSize();
    LayerColor *layerBlack = LayerColor::create(Color4B(0, 0, 0, 100),winSize.width,winSize.height * 2);
    layerBlack->setPositionY(-winSize.height);
    this->addChild(layerBlack,-1);
    auto text_max_add = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_max_add"));
    auto text_min_add = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_min_add"));
    text_max_add->setString(tools::local_string("max_buy", "最多可添加"));
    text_min_add->setString(tools::local_string("min_buy", "最少可添加"));
    
    text_min_number_ = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_min_number"));
    text_max_number_ = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_max_number"));
    text_buy_number_ = dynamic_cast<Text*>(CSLoader::seekNodeByName(root, "text_buy_number"));
    
    auto btn_cancel = dynamic_cast<Button *>(CSLoader::seekNodeByName(root, "btn_cancel"));
    auto btn_confirm = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_confirm"));
    btn_cancel->addClickEventListener(std::bind(&BuyChipLayer::click_btn_cancel, this, std::placeholders::_1));
    btn_confirm->addClickEventListener(std::bind(&BuyChipLayer::click_btn_confirm, this, std::placeholders::_1));
    btn_cancel->setTitleText(tools::local_string("cancel","取消"));
    btn_confirm->setTitleText(tools::local_string("confirm_change_password","确定"));
    
    auto btn_add = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_add"));
    auto btn_sub = dynamic_cast<Button*>(CSLoader::seekNodeByName(root, "btn_sub"));
    
    btn_add->addClickEventListener(std::bind(&BuyChipLayer::click_btn_add, this, std::placeholders::_1));
    btn_sub->addClickEventListener(std::bind(&BuyChipLayer::click_btn_sub, this, std::placeholders::_1));
    
    slider_chip_ = dynamic_cast<Slider*>(CSLoader::seekNodeByName(root, "slider_chip"));
    slider_chip_->addEventListener(std::bind(&BuyChipLayer::slider_slider_chip, this, std::placeholders::_1, std::placeholders::_2));
    
    return true;
}
开发者ID:,项目名称:,代码行数:51,代码来源:


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