2010-03-07 11:34:28 -08:00
|
|
|
collections {
|
|
|
|
group { name: "main";
|
2010-10-06 16:03:28 -07:00
|
|
|
script {
|
|
|
|
public timer_cb(val) {
|
|
|
|
new x, y, w, h;
|
|
|
|
new buf[32];
|
|
|
|
|
|
|
|
/* set labels with object info */
|
|
|
|
get_geometry(PART:"red_rect", x, y, w, h);
|
|
|
|
snprintf(buf, sizeof(buf), "Timer called %d times.", val);
|
|
|
|
set_text(PART:"label1", buf)
|
|
|
|
snprintf(buf, sizeof(buf), "Object x: %d w: %d", x, w);
|
|
|
|
set_text(PART:"label2", buf)
|
|
|
|
|
|
|
|
/* renew the timer */
|
|
|
|
timer(1 / 30, "timer_cb", val + 1);
|
|
|
|
}
|
|
|
|
}
|
2010-03-07 11:34:28 -08:00
|
|
|
parts {
|
|
|
|
part { name: "bg";
|
|
|
|
type: RECT;
|
|
|
|
description { state: "default" 0.0;
|
|
|
|
color: 255 255 255 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
part { name: "label1";
|
|
|
|
type: TEXT;
|
|
|
|
description { state: "default" 0.0;
|
|
|
|
color: 0 0 0 255;
|
|
|
|
text {
|
2010-10-06 16:03:28 -07:00
|
|
|
text: "";
|
2010-03-07 11:34:28 -08:00
|
|
|
font: "Sans";
|
|
|
|
size: 12;
|
|
|
|
align: 0.0 0.7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
part { name: "label2";
|
|
|
|
type: TEXT;
|
|
|
|
description { state: "default" 0.0;
|
|
|
|
color: 0 0 0 255;
|
|
|
|
text {
|
|
|
|
font: "Sans";
|
|
|
|
size: 12;
|
|
|
|
align: 0.0 0.8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
part { name: "red_rect";
|
|
|
|
type: RECT;
|
|
|
|
description { state: "default" 0.0;
|
|
|
|
color: 255 0 0 255;
|
|
|
|
max: 30 30;
|
|
|
|
align: 0.1 0.2;
|
|
|
|
}
|
|
|
|
description { state: "default" 1.0;
|
|
|
|
inherit: "default" 0.0;
|
|
|
|
color: 0 0 255 255;
|
2010-10-06 16:03:28 -07:00
|
|
|
max: 50 30;
|
2010-03-07 11:34:28 -08:00
|
|
|
align: 0.9 0.2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
programs {
|
2010-10-06 16:03:28 -07:00
|
|
|
/* move the red rect back an forth in a loop */
|
2010-03-07 11:34:28 -08:00
|
|
|
program { name: "init";
|
|
|
|
signal: "load";
|
|
|
|
source: "";
|
|
|
|
action: STATE_SET "default" 1.0;
|
|
|
|
transition: SINUSOIDAL 1.0;
|
|
|
|
target: "red_rect";
|
|
|
|
after: "loop";
|
|
|
|
}
|
|
|
|
program { name: "loop";
|
|
|
|
action: STATE_SET "default" 0.0;
|
|
|
|
transition: SINUSOIDAL 1.0;
|
|
|
|
target: "red_rect";
|
|
|
|
after: "init";
|
|
|
|
}
|
2010-10-06 16:03:28 -07:00
|
|
|
/* run the timer_cb for the first time */
|
|
|
|
program { name: "init2";
|
2010-03-07 11:34:28 -08:00
|
|
|
signal: "load";
|
|
|
|
source: "";
|
2010-10-06 16:03:28 -07:00
|
|
|
script {
|
|
|
|
timer_cb(0);
|
2010-03-07 11:34:28 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|