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


C++ Layout::GetVariables方法代码示例

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


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

示例1: LoadFromSceneAndCustomInstances

bool RuntimeScene::LoadFromSceneAndCustomInstances( const gd::Layout & scene, const gd::InitialInstancesContainer & instances )
{
    std::cout << "Loading RuntimeScene from a scene.";
    if (!game)
    {
        std::cout << "..No valid gd::Project associated to the RuntimeScene. Aborting loading." << std::endl;
        return false;
    }

    //Copy inherited scene
    Scene::operator=(scene);

    //Clear RuntimeScene datas
    objectsInstances.Clear();
    timeManager.Reset();

    std::cout << ".";
    codeExecutionEngine->runtimeContext.scene = this;
    inputManager.DisableInputWhenFocusIsLost(IsInputDisabledWhenFocusIsLost());

    //Initialize variables
    variables = scene.GetVariables();

    //Initialize layers
    std::cout << ".";
    layers.clear();
    sf::View defaultView( sf::FloatRect( 0.0f, 0.0f, game->GetMainWindowDefaultWidth(), game->GetMainWindowDefaultHeight() ) );
    for (std::size_t i = 0;i<GetLayersCount();++i) {
        layers.push_back(RuntimeLayer(GetLayer(i), defaultView));
    }

    //Create object instances which are originally positioned on scene
    std::cout << ".";
    CreateObjectsFrom(instances);

    //Behaviors shared data
    std::cout << ".";
    behaviorsSharedDatas.LoadFrom(scene.behaviorsInitialSharedDatas);

    std::cout << ".";
    //Extensions specific initialization
	for (std::size_t i = 0;i<game->GetUsedExtensions().size();++i)
    {
        std::shared_ptr<gd::PlatformExtension> gdExtension = CppPlatform::Get().GetExtension(game->GetUsedExtensions()[i]);
        std::shared_ptr<ExtensionBase> extension = std::dynamic_pointer_cast<ExtensionBase>(gdExtension);
        if ( extension != std::shared_ptr<ExtensionBase>() )
        {
            extension->SceneLoaded(*this);
            if ( extension->ToBeNotifiedOnObjectDeletion() ) extensionsToBeNotifiedOnObjectDeletion.push_back(extension.get());
        }
    }

    std::cout << ".";
    if ( StopSoundsOnStartup() ) {game->GetSoundManager().ClearAllSoundsAndMusics(); }
    if ( renderWindow ) renderWindow->setTitle(GetWindowDefaultTitle());

    std::cout << " Done." << std::endl;

    return true;
}
开发者ID:UNIVERSAL-IT-SYSTEMS,项目名称:GD,代码行数:60,代码来源:RuntimeScene.cpp

示例2: LaunchEditor


//.........这里部分代码省略.........
        if ( retour == 3 )
            editCtrl->ChangeValue("-");
        if ( retour == 4 )
            editCtrl->ChangeValue("*");
        if ( retour == 5 )
            editCtrl->ChangeValue("/");

        return;
    }
    else if ( metadata.GetType() == "password" )
    {
        GeneratePassword dialog(parent);

        if ( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.mdp);

        return;
    }
    else if ( metadata.GetType() == "trueorfalse" )
    {
        TrueOrFalse dialog(parent, _("Choose True or False to fill the parameter"), _("True or False"));
        if ( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(_("True"));
        else
            editCtrl->ChangeValue(_("False"));
    }
    else if ( metadata.GetType() == "yesorno" )
    {
        if (wxMessageBox(_("Choose yes or no to fullfil parent parameter:"), _("Yes or no") ,wxYES_NO ) == wxYES)
            editCtrl->ChangeValue(_("yes"));
        else
            editCtrl->ChangeValue(_("no"));

        return;
    }
    else if ( metadata.GetType() == "layer" )
    {
        gd::ChooseLayerDialog dialog(parent, layout);
        if( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.GetChosenLayer());

        return;
    }
    else if ( metadata.GetType() == "joyaxis" )
    {
        ChoiceJoyAxis dialog(parent, editCtrl->GetValue(), project, layout);
        if( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.joyaxis);

        return;
    }
    else if ( metadata.GetType() == "file" )
    {
        ChoiceFile dialog(parent, editCtrl->GetValue(), project, layout);

        if ( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.file);

        return;
    }
    else if ( metadata.GetType() == "objectvar" )
    {
        if ( paramEdits.empty() ) return;

        gd::String objectWanted = paramEdits[0]->GetValue();
        gd::Object * object = NULL;

        if ( layout.HasObjectNamed(objectWanted) )
            object = &layout.GetObject(objectWanted);
        else if ( project.HasObjectNamed(objectWanted) )
            object = &project.GetObject(objectWanted);
        else
            return;

        gd::ChooseVariableDialog dialog(parent, object->GetVariables());
        dialog.SetAssociatedObject(&project, &layout, object);
        if ( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.GetSelectedVariable());

        return;
    }
    else if ( metadata.GetType() == "scenevar" )
    {
        gd::ChooseVariableDialog dialog(parent, layout.GetVariables());
        dialog.SetAssociatedLayout(&project, &layout);
        if ( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.GetSelectedVariable());

        return;
    }
    else if ( metadata.GetType() == "globalvar" )
    {
        gd::ChooseVariableDialog dialog(parent, project.GetVariables());
        dialog.SetAssociatedProject(&project);
        if ( dialog.ShowModal() == 1 )
            editCtrl->ChangeValue(dialog.GetSelectedVariable());

        return;
    }
}
开发者ID:sakelestemur,项目名称:GD,代码行数:101,代码来源:ParameterEditorLauncher.cpp


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