Jump to content

Main loop in Editor2


photo

Recommended Posts

Hi,

I am implementing custom modules into engine as addition into code of main class:

main() {

...

Unigine::Engine* pEngine = Unigine::Engine::init(UNIGINE_VERSION, argc, argv);

  while (!pEngine->isDone())
  {
      pEngine->update();
	  pEngine->render();
	  pEngine->swap();
  }

...

}

which works well in game mode, but it holds at pEngine->Update() method in Editor2 (runned as argument -video_app auto -video_vsync 0 -video_refresh 0 -video_mode 1 -video_resizable 1 -video_fullscreen 0 -video_debug 0 -video_gamma 1.000000 -sound_app auto -data_path "../" -engine_config  "../data/unigine.cfg" -extern_plugin "Collada,Editor2" -console_command "config_readonly 0 && world_load \"xxx\""). It's going through pEngine->Update() after closing Editor2.

How can I make this loop:

while (isDone() == 0) { 
	update();  
	render(); 
	swap(); 
}

to work with Editor2 ?

If is not possible then do I should try to move my implementation into AppSystemLogic ? 

Link to comment

Hi, Jan.

Editor2`s instance intercepts and blocks the event loop inside the `main` function and calls `Engine::update|render|swap` methods inside its own loop. Move your code inside `AppSystemLogic` as you suggested. This should solve the issue.

  • Like 3
Link to comment
×
×
  • Create New...