Jump to content

[SOLVED] How can I sync the master's Gui to slave?(sim vesion)


photo

Recommended Posts

        how to sync gui with sim vesion? 

 

I add a movie at master by WidgetSpriteVideo like this :

/***/

gui  = engine.getGui();

 

sprite_video = new WidgetSpriteVideo(gui,".../.../a.ogv");

 

gui.addChild(sprite_video,GUI_ALIGN_*);

/**/

 

but I cannot get the  same  movie at slave;

 

How can I sync the master Gui to slave? 

 

Link to comment

Hi!

 

Just use RPC call and pass current video time at the master to all slaves, that should do the trick.

 

So from the master side it should be something like this:

int render() {
	
	// typical syncker master code
	Unigine::Syncker::Master::syncFrame();
	Unigine::Syncker::Master::syncPlayer();
	Unigine::Syncker::Master::syncRender();
	Unigine::Syncker::Master::syncEnd();
	
	// sync video time via RPC call
	float video_time = sprite_video.getVideoTime();
	
	int ret[0];
	Unigine::Syncker::Master::worldCall(~0,"sync_video",(video_time),ret);
	
	return 1;
}

And on the slave side you should have sync_video function which will set video time to the WidgetSpriteVideo on slave machines:

int sync_video(float video_time) {
	sprite_video.setVideoTime(video_time);
	return 1;
}
Link to comment
×
×
  • Create New...