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


C++ DeviceConfig::getBindingAsString方法代码示例

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


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

示例1: getKeyBinding

 /** Get the key bound to a player action (enum GUI::PlayerAction)*/
 std::string getKeyBinding(int Enum_value)
 {
     InputDevice* device = input_manager->getDeviceManager()->getLatestUsedDevice();
     DeviceConfig* config = device->getConfiguration();
     PlayerAction ScriptAction = (PlayerAction)Enum_value;
     irr::core::stringw control = config->getBindingAsString(ScriptAction);
     std::string key = StringUtils::wideToUtf8(control);
     return key;
 }
开发者ID:devnexen,项目名称:stk-code,代码行数:10,代码来源:script_gui.cpp

示例2: onTriggerItemApproached

void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
{
    if (!m_action_active) return;

    if (m_action == "garage")
    {
        m_action_active = false;

        new RacePausedDialog(0.8f, 0.6f);
        //dynamic_cast<OverWorld*>(World::getWorld())->scheduleSelectKart();
    }
    //action trigger near big doors in the overword to notify players that they'll open once they finish all the challenges
    else if (m_action == "big_door")
    {
        m_action_active = false;

        Track* m_track = World::getWorld()->getTrack();
        unsigned int unlocked_challenges = m_track->getNumOfCompletedChallenges();
        std::vector<OverworldChallenge> m_challenges = m_track->getChallengeList();

        // allow ONE unsolved challenge : the last one
        if (unlocked_challenges < m_challenges.size() - 1)
        {
            new TutorialMessageDialog(_("Complete all challenges to unlock the big door!"), true);
        }
    }
    else if (m_action == "tutorial_drive")
    {
        //if (World::getWorld()->getPhase() == World::RACE_PHASE)
        {
            m_action_active = false;
            //World::getWorld()->getRaceGUI()->clearAllMessages();

            InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
            DeviceConfig* config = device->getConfiguration();
            irr::core::stringw accel = config->getBindingAsString(PA_ACCEL);
            irr::core::stringw left = config->getBindingAsString(PA_STEER_LEFT);
            irr::core::stringw right = config->getBindingAsString(PA_STEER_RIGHT);

            new TutorialMessageDialog(_("Accelerate with <%s> and steer with <%s> and <%s>", accel, left, right),
                                      false);
        }
    }
    else if (m_action == "tutorial_bananas")
    {
        m_action_active = false;

        new TutorialMessageDialog(_("Avoid bananas!"), true);
    }
    else if (m_action == "tutorial_giftboxes")
    {
        m_action_active = false;
        InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
        DeviceConfig* config = device->getConfiguration();
        irr::core::stringw fire = config->getBindingAsString(PA_FIRE);

        new TutorialMessageDialog(_("Collect gift boxes, and fire the weapon with <%s> to blow away these boxes!", fire),
                                true);
    }
    else if (m_action == "tutorial_backgiftboxes")
    {
        m_action_active = false;
        InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
        DeviceConfig* config = device->getConfiguration();
        irr::core::stringw fire = config->getBindingAsString(PA_FIRE);
        
        new TutorialMessageDialog(_("Press <B> to look behind, to fire the weapon with <%s> while pressing <B> to to fire behind!", fire),
                                  true);
    }
    else if (m_action == "tutorial_nitro_collect")
    {
        m_action_active = false;

        new TutorialMessageDialog(_("Collect nitro bottles (we will use them after the curve)"),
                                  true);
    }
    else if (m_action == "tutorial_nitro_use")
    {
        m_action_active = false;
        InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
        DeviceConfig* config = device->getConfiguration();
        irr::core::stringw nitro = config->getBindingAsString(PA_NITRO);

        new TutorialMessageDialog(_("Use the nitro you collected by pressing <%s>!", nitro),
                                 true);
    }
    else if (m_action == "tutorial_rescue")
    {
        m_action_active = false;
        InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
        DeviceConfig* config = device->getConfiguration();
        irr::core::stringw rescue = config->getBindingAsString(PA_RESCUE);

        new TutorialMessageDialog(_("Oops! When you're in trouble, press <%s> to be rescued", rescue),
                                  false);
    }
    else if (m_action == "tutorial_skidding")
    {
        m_action_active = false;
        //World::getWorld()->getRaceGUI()->clearAllMessages();
//.........这里部分代码省略.........
开发者ID:clasik,项目名称:stk-code,代码行数:101,代码来源:track_object_presentation.cpp


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