Exemplo n.º 1
0
int main ()
{
  printf ("Results of xscene1_test:\n");

  try
  {
    MyServer custom_server;

    media::rms::ServerGroup server_group ("group1");
    
    server_group.Attach (custom_server);     

    SceneManager manager;
    
    manager.LoadScene ("data/test1.xscene", "", &print_log);
    
    Node::Pointer node = manager.CreateScene ("scene1");
  }
  catch (std::exception& e)
  {
    printf ("%s\n", e.what ());
  }

  return 0;
}
Exemplo n.º 2
0
void Player::Start()
{
#if URHO3D_SYSTEMUI
    ui::GetIO().IniFilename = nullptr;              // Disable of imgui.ini creation,
#endif
#if URHO3D_CSHARP
    if (Script* script = GetSubsystem<Script>())    // Graceful failure when managed runtime support is present but not in use.
        script->LoadRuntime();
#endif

    GetCache()->AddResourceRouter(new BakedResourceRouter(context_));

    context_->RegisterSubsystem(new SceneManager(context_));

    ea::shared_ptr<JSONFile> projectFile(GetCache()->GetResource<JSONFile>("Project.json", false));
    if (!projectFile)
    {
        projectFile = new JSONFile(context_);
        if (!projectFile->LoadFile(ToString("%s%s", APK, "Project.json")))
        {
            ErrorExit("Project.json missing.");
            return;
        }
    }

    const JSONValue& projectRoot = projectFile->GetRoot();
    if (!projectRoot.Contains("plugins"))
    {
        ErrorExit("Project.json does not have 'plugins' section.");
        return;
    }

    const JSONValue& plugins = projectRoot["plugins"];
    if (!LoadPlugins(plugins))
        ErrorExit("Loading of required plugins failed.");

    for (auto& plugin : plugins_)
        plugin->Start();

    // Load main scene.
    {
        SceneManager* manager = GetSubsystem<SceneManager>();
        Scene* scene = manager->CreateScene();

        if (scene->LoadFile(projectRoot["default-scene"].GetString()))
            manager->SetActiveScene(scene);
        else
            ErrorExit("Invalid scene file.");
    }
}