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


C++ UIElement::GetChild方法代码示例

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


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

示例1: HandlerConfigurationWindowButtonPressed

/// Get the button
void GameEconomicGameClient::HandlerConfigurationWindowButtonPressed(StringHash eventType, VariantMap& eventData)
{
    /// Get needed resources
    Renderer* renderer = GetSubsystem<Renderer>();
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui_ = GetSubsystem<UI>();

    UIElement * UIRoot = ui_->GetRoot();

    GameStateHandlerComponent * gamestatehandlercomponent_ = GetSubsystem<GameStateHandlerComponent>();

    /// get the button that was clicked
    Button* clicked = static_cast<Button*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());

    /// Get TheName
    String ClickedButton(clicked->GetName().ToLower());

    /// If exit was clicked
    if (ClickedButton.Contains("apply")==true)
    {
        /// Get parameters
        Slider * VideoBloomParam1= (Slider *)UIRoot->GetChild("VideoBloomParam1Slider",true);
        Slider * VideoBloomParam2= (Slider *)UIRoot->GetChild("VideoBloomParam2Slider",true);

        float VideoBloomParam1Value = VideoBloomParam1->GetValue();
        float VideoBloomParam2Value = VideoBloomParam2->GetValue();

        /// Set parameter
        effectRenderPath->SetShaderParameter("BloomMix", Vector2(VideoBloomParam1Value,VideoBloomParam2Value));

        return;
    }

    /// If exit was clicked
    if (ClickedButton.Contains("save")==true)
    {
        /// Get parameters
        Slider * VideoBloomParam1= (Slider *)UIRoot->GetChild("VideoBloomParam1Slider",true);
        Slider * VideoBloomParam2= (Slider *)UIRoot->GetChild("VideoBloomParam2Slider",true);
        CheckBox * GameForceTabletModeCheckBox = (CheckBox *) UIRoot->GetChild("GameForceTabletModeCheckBox",true);

        ///Create new config
        Configuration SaveNewConfig;

        /// Copy info
        SaveNewConfig.GameModeForceTablet=  GameForceTabletModeCheckBox->IsChecked();
        SaveNewConfig.VideoBloomParam1 = VideoBloomParam1->GetValue();
        SaveNewConfig.VideoBloomParam2 = VideoBloomParam2->GetValue();

        /// Save new config
        SaveConfiguration(SaveNewConfig);

        return;
    }

    return;
}
开发者ID:vivienneanthony,项目名称:Urho3D-gameeconomic,代码行数:58,代码来源:GameEconomicGameClient.cpp

示例2: HandleUpdate

void UIDrag::HandleUpdate(StringHash eventType, VariantMap& eventData)
{
    auto* ui = GetSubsystem<UI>();
    UIElement* root = ui->GetRoot();

    auto* input = GetSubsystem<Input>();

    unsigned n = input->GetNumTouches();
    for (unsigned i = 0; i < n; i++)
    {
        Text* t = (Text*)root->GetChild("Touch " + String(i));
        TouchState* ts = input->GetTouch(i);
        t->SetText("Touch " + String(ts->touchID_));

        IntVector2 pos = ts->position_;
        pos.y_ -= 30;

        t->SetPosition(pos);
        t->SetVisible(true);
    }

    for (unsigned i = n; i < 10; i++)
    {
        Text* t = (Text*)root->GetChild("Touch " + String(i));
        t->SetVisible(false);
    }

    if (input->GetKeyPress(KEY_SPACE))
    {
        PODVector<UIElement*> elements;
        root->GetChildrenWithTag(elements, "SomeTag");
        for (PODVector<UIElement*>::ConstIterator i = elements.Begin(); i != elements.End(); ++i)
        {
            UIElement* element = *i;
            element->SetVisible(!element->IsVisible());
        }
    }
}
开发者ID:BlueMagnificent,项目名称:Urho3D,代码行数:38,代码来源:UIDrag.cpp

示例3: UpdateNetworkStatusUI

void GameEconomicGameClient::UpdateNetworkStatusUI(bool online)
{
    /// Get Urho3D Subsystem
    UI* ui_ = GetSubsystem<UI>();

    /// load window
    UIElement * uiroot = ui_->	GetRoot ();

    Text * NetworkStatusUpdateText = (Text *) uiroot->GetChild("ServerStatusUpdateText",true);

    if(NetworkStatusUpdateText)
    {
        if(online)
        {
            NetworkStatusUpdateText->SetText("Online");
        }
        else
        {
            NetworkStatusUpdateText->SetText("Offline");
        }
    }

    return;
}
开发者ID:vivienneanthony,项目名称:Urho3D-gameeconomic,代码行数:24,代码来源:GameEconomicGameClient.cpp

示例4: Update

void Board::Update(float timeStep)
{
    if (gameOver_)
    {
        if (score_ > record_)
        {
            record_ = score_;
            SaveRecord();
        }
        Restart();
        return;
    }

    selectionNode_->Rotate(Quaternion(0.0f, timeStep * 50, 0.0f));
    if (Path::GetTotalCount() > 0)
        return;
    if (needCheckLines_)
    {
        if (CheckLines())
        {
            needSpawnBalls_ = false;
        }
        needCheckLines_ = false;
        // может быть что поле полностью занято, новых шаров спанить не надо и ходить некуда
        // не работает чот
        gameOver_ = true;
        for (int i = 0; i < height_; i++)
        {
            for (int j = 0; j < width_; j++)
            {
                if (!board_[i][j] || board_[i][j]->GetBallState() == BS_GHOST)
                {
                    gameOver_ = false;
                    break;
                }

            }
        }
        if (gameOver_)
            return;

    }
    if (needSpawnBalls_)
    {
        for (int i = 0; i < numAddBalls_; i++)
        {
            if (!SpawnBall())
            {
                gameOver_ = true;
                return;
            }
        }
        if (difficulty_ <= D_NORMAL)
        {
            for (int i = 0; i < numAddBalls_; i++)
                CreateBall(true);
        }
        needSpawnBalls_ = false;
    }

    UIElement* uiRoot = GetSubsystem<UI>()->GetRoot();
    Text* t = static_cast<Text*>(uiRoot->GetChild("Score", true));
    t->SetText("Score: " + String(score_));
    t = static_cast<Text*>(uiRoot->GetChild("Colors", true));
    t->SetText("Colors: " + String(numColors_));
    t = static_cast<Text*>(uiRoot->GetChild("LineLength", true));
    t->SetText("Line length: " + String(lineLength_));
    t = static_cast<Text*>(uiRoot->GetChild("Record", true));
    t->SetText("Record: " + String(record_));
    // нужно выбрасывать шары если после уделаения линий поле пустое
}
开发者ID:1vanK,项目名称:Urho3D-Color-Lines,代码行数:71,代码来源:Board.cpp


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