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


C++ SpinnerWidget::setActivated方法代码示例

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


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

示例1: init

// -----------------------------------------------------------------------------
void SoccerSetupScreen::init()
{
    m_schedule_continue = false;

    Screen::init();

    // TODO: remember in config.xml the last number of goals
        
    if (UserConfigParams::m_soccer_time_limit <= 0)
        UserConfigParams::m_soccer_time_limit = 3;

    SpinnerWidget*  goalamount = getWidget<SpinnerWidget>("goalamount");
    goalamount->setValue(3);
    goalamount->setActivated();

    SpinnerWidget* timeAmount = getWidget<SpinnerWidget>("timeamount");
    timeAmount->setValue(UserConfigParams::m_soccer_time_limit);
    timeAmount->setDeactivated();

    CheckBoxWidget* timeEnabled = getWidget<CheckBoxWidget>("time_enabled");
    timeEnabled->setState(false);

    // Set focus on "continue"
    ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue");
    bt_continue->setFocusForPlayer(PLAYER_ID_GAME_MASTER);

    // We need players to be able to choose their teams
    input_manager->setMasterPlayerOnly(false);
}   // init
开发者ID:hiker,项目名称:stk-code,代码行数:30,代码来源:soccer_setup_screen.cpp

示例2: onGameModeChanged

void RaceSetupScreen::onGameModeChanged()
{
    DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
    assert( w2 != NULL );
    
    std::string gamemode_str = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
    if (gamemode_str == "locked") return;
    
    RaceManager::MinorRaceModeType gamemode = 
        RaceManager::getModeIDFromInternalName(gamemode_str);
    
    // deactivate the AI karts count widget for modes for which we have no AI
    SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
    if (!RaceManager::hasAI(gamemode))
    {
        kartamount->setDeactivated();
    }
    else
    {
        kartamount->setActivated();
    }
}
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:22,代码来源:race_setup_screen.cpp

示例3: init

void RaceSetupScreen::init()
{
    Screen::init();
    RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
    assert( w != NULL );
    w->setSelection( UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER );
    
    SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
    kartamount->setActivated();
        
    // Avoid negative numbers (which can happen if e.g. the number of karts
    // in a previous race was lower than the number of players now.
    int num_ai = race_manager->getNumberOfKarts()-race_manager->getNumLocalPlayers();
    if(num_ai<0) num_ai = 0;
    kartamount->setValue(num_ai);
    kartamount->setMax(stk_config->m_max_karts - race_manager->getNumLocalPlayers() );
    
    DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
    assert( w2 != NULL );
    w2->clearItems();

    // ---- Add game modes
    irr::core::stringw name1 = irr::core::stringw(
        RaceManager::getNameOf(RaceManager::MINOR_MODE_NORMAL_RACE)) + L"\n";
    //FIXME: avoid duplicating descriptions from the help menu!
    name1 +=  _("All blows allowed, so catch weapons and make clever use of them!");
    
    w2->addItem( name1, IDENT_STD, RaceManager::getIconOf(RaceManager::MINOR_MODE_NORMAL_RACE));
    
    irr::core::stringw name2 = irr::core::stringw(
        RaceManager::getNameOf(RaceManager::MINOR_MODE_TIME_TRIAL)) + L"\n";
    //FIXME: avoid duplicating descriptions from the help menu!
    name2 += _("Contains no powerups, so only your driving skills matter!");
    w2->addItem( name2, IDENT_TTRIAL, RaceManager::getIconOf(RaceManager::MINOR_MODE_TIME_TRIAL));
    
    if (unlock_manager->getCurrentSlot()->isLocked(IDENT_FTL))
    {
        w2->addItem( _("Locked : solve active challenges to gain access to more!"),
                    "locked", RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), true);
    }
    else
    {
        irr::core::stringw name3 = irr::core::stringw(
            RaceManager::getNameOf(RaceManager::MINOR_MODE_FOLLOW_LEADER)) + L"\n";
        //I18N: short definition for follow-the-leader game mode
        name3 += _("Keep up with the leader kart but don't overtake it!");
        w2->addItem(name3, IDENT_FTL, RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), false);
    }
    
    if (race_manager->getNumLocalPlayers() > 1 || UserConfigParams::m_artist_debug_mode)
    {
        irr::core::stringw name4 = irr::core::stringw(
            RaceManager::getNameOf(RaceManager::MINOR_MODE_3_STRIKES)) + L"\n";
        //FIXME: avoid duplicating descriptions from the help menu!
        name4 += _("Hit others with weapons until they lose all their lives. (Only in multiplayer games)");
        w2->addItem( name4, IDENT_STRIKES, RaceManager::getIconOf(RaceManager::MINOR_MODE_3_STRIKES));
    }
    

    w2->updateItemDisplay();
    
    // restore saved game mode
    switch (UserConfigParams::m_game_mode)
    {
        case CONFIG_CODE_NORMAL :
            w2->setSelection(IDENT_STD, PLAYER_ID_GAME_MASTER, true);
            break;
        case CONFIG_CODE_TIMETRIAL :
            w2->setSelection(IDENT_TTRIAL, PLAYER_ID_GAME_MASTER, true);
            break;
        case CONFIG_CODE_FTL :
            w2->setSelection(IDENT_FTL, PLAYER_ID_GAME_MASTER, true);
            break;
        case CONFIG_CODE_3STRIKES :
            w2->setSelection(IDENT_STRIKES, PLAYER_ID_GAME_MASTER, true);
            break;
    }
    
    m_mode_listener = new GameModeRibbonListener(this);
    w2->registerHoverListener(m_mode_listener);
}
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:81,代码来源:race_setup_screen.cpp


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