//
// Name: ScreenImageMgr Demo
// License: Public Domain
// Author: Matthew Gates
// Description: An example script showing how to use the ScreenImageMgr module.
//

include("status_label.inc");

function moveIt(x, y, duration, sleeptime)
{
	l = LabelMgr.labelScreen("("+x+","+y+") in " + duration + " sec (sleep=" + sleeptime + ")", x, y-14, true, 11, "#00ff00");
	ScreenImageMgr.setImageXY("logo", x, y, duration);
	core.wait(sleeptime);
	LabelMgr.deleteLabel(l);
}

testData = Array(Array(300,80), Array(300,300), Array(0,300), Array(0,80));

useStatusLabel("ScreenImageMgr test 4: ", 50, 50, 16, "#ff0000");
status("Moving an image around the screen");
ScreenImageMgr.createScreenImage("logo", "../textures/earthmap.png", 0, 80, 0.8, true, 0.4, 0.5);
core.wait(0.5);

status("first some instantaneous moves...");
core.wait(0.5);
for(i=0; i<testData.length; i++)
{
	moveIt(testData[i][0], testData[i][1], 0, 1);
}

core.wait(0.5);
status("now some with a 1.5 second duration, waiting for the move to complete...");
core.wait(0.5);
for(i=0; i<testData.length; i++)
{
	moveIt(testData[i][0], testData[i][1], 1.5, 2);
}

core.wait(0.5);
status("now doing the next move before the previous one is complete...");
core.wait(0.5);
for(i=0; i<testData.length; i++)
{
	moveIt(testData[i][0], testData[i][1], 3.0, 1.5);
}

core.wait(1);
ScreenImageMgr.deleteAllImages();
LabelMgr.deleteAllLabels();

