1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
//
// 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();
|