// ===================================
// Client
// ===================================
gClient.onInit = function()
{
	// Window : width, height, fullscreen
	this.setWindow(512,512,false);

	// Log
	this.enableLog(true);

	// UI
	this.showUI(false);

	// Load plug-ins
	var scenes		= new Array("scene/v3ga/basic/libbasic", "scene/2roqs/barbican/libscene_2roqs_barbican");
	var filters		= new Array("filter/v3ga/basic/libfilter_v3ga_basic");
	var blendings	= new Array("blending/v3ga/basic/libv3ga_basic");

	this.loadPlugins(scenes, filters, blendings);

	// Init network : listening port
	this.initNetwork(9000);
}

// ===================================
// LayerManager
// ===================================
gLayerManager.onInit = function()
{
	this.setScene	(0, "scene.v3ga.kaleidoscope");
	this.setFilter	(0, "filter.v3ga.ripple", 0);	// layer, id, position
	this.setScene	(1, "scene.v3ga.cube");
}

gLayerManager.onUpdate = function(dt)
{
	// Read values
	var rotCube		= parseFloat( this.getScenePropertyValue(1, "rotation") );
	var scaleCube	= parseFloat( this.getScenePropertyValue(1, "scale") );

	// Compute values
	rotCube		+= Math.PI/2*dt;
	scaleCube	= 1.0 + Math.cos(rotCube)/2.0;

	// Write values
	this.setScenePropertyValue(1, "rotation",	""+rotCube);
	this.setScenePropertyValue(1, "scale",		""+scaleCube);
}

