2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
* tests/test-script.c: * tests/test-script.json: Rejig the test case and add a path behaviour to test the knot parsing code.
This commit is contained in:
parent
adb5d0275f
commit
14f1606d26
3 changed files with 64 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* tests/test-script.c:
|
||||||
|
* tests/test-script.json: Rejig the test case and add a
|
||||||
|
path behaviour to test the knot parsing code.
|
||||||
|
|
||||||
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/cogl/cogl.h: Do not include <clutter/clutter.h>.
|
* clutter/cogl/cogl.h: Do not include <clutter/clutter.h>.
|
||||||
|
|
|
@ -26,11 +26,19 @@ static const gchar *test_behaviour =
|
||||||
" {"
|
" {"
|
||||||
" \"id\" : \"main-timeline\","
|
" \"id\" : \"main-timeline\","
|
||||||
" \"type\" : \"ClutterTimeline\","
|
" \"type\" : \"ClutterTimeline\","
|
||||||
" \"num-frames\" : 300,"
|
" \"duration\" : 5000,"
|
||||||
" \"fps\" : 60,"
|
|
||||||
" \"loop\" : true"
|
" \"loop\" : true"
|
||||||
" },"
|
" },"
|
||||||
" {"
|
" {"
|
||||||
|
" \"id\" : \"path-behaviour\","
|
||||||
|
" \"type\" : \"ClutterBehaviourPath\","
|
||||||
|
" \"knots\" : [ [ 50, 50 ], { \"x\" : 100, \"y\" : 100 } ],"
|
||||||
|
" \"alpha\" : {"
|
||||||
|
" \"timeline\" : \"main-timeline\","
|
||||||
|
" \"function\" : \"ramp\""
|
||||||
|
" }"
|
||||||
|
" },"
|
||||||
|
" {"
|
||||||
" \"id\" : \"rotate-behaviour\","
|
" \"id\" : \"rotate-behaviour\","
|
||||||
" \"type\" : \"ClutterBehaviourRotate\","
|
" \"type\" : \"ClutterBehaviourRotate\","
|
||||||
" \"angle-begin\" : 0.0,"
|
" \"angle-begin\" : 0.0,"
|
||||||
|
@ -58,13 +66,35 @@ blue_button_press (ClutterActor *actor,
|
||||||
ClutterButtonEvent *event,
|
ClutterButtonEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
g_print ("[*] Unmerging objects with merge id: %d\n", merge_id);
|
||||||
|
|
||||||
clutter_script_unmerge_objects (script, merge_id);
|
clutter_script_unmerge_objects (script, merge_id);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
red_button_press (ClutterActor *actor,
|
||||||
|
ClutterButtonEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GObject *timeline;
|
||||||
|
|
||||||
|
timeline = clutter_script_get_object (script, "main-timeline");
|
||||||
|
g_assert (CLUTTER_IS_TIMELINE (timeline));
|
||||||
|
|
||||||
|
if (!clutter_timeline_is_playing (CLUTTER_TIMELINE (timeline)))
|
||||||
|
clutter_timeline_start (CLUTTER_TIMELINE (timeline));
|
||||||
|
else
|
||||||
|
clutter_timeline_pause (CLUTTER_TIMELINE (timeline));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GObject *stage, *timeline, *blue_button;
|
GObject *stage, *timeline, *blue_button, *red_button;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
@ -105,15 +135,18 @@ main (int argc, char *argv[])
|
||||||
stage = clutter_script_get_object (script, "main-stage");
|
stage = clutter_script_get_object (script, "main-stage");
|
||||||
clutter_actor_show (CLUTTER_ACTOR (stage));
|
clutter_actor_show (CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
|
red_button = clutter_script_get_object (script, "red-button");
|
||||||
|
g_signal_connect (red_button,
|
||||||
|
"button-press-event",
|
||||||
|
G_CALLBACK (red_button_press),
|
||||||
|
NULL);
|
||||||
|
|
||||||
blue_button = clutter_script_get_object (script, "blue-button");
|
blue_button = clutter_script_get_object (script, "blue-button");
|
||||||
g_signal_connect (blue_button,
|
g_signal_connect (blue_button,
|
||||||
"button-press-event",
|
"button-press-event",
|
||||||
G_CALLBACK (blue_button_press),
|
G_CALLBACK (blue_button_press),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
timeline = clutter_script_get_object (script, "main-timeline");
|
|
||||||
clutter_timeline_start (CLUTTER_TIMELINE (timeline));
|
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
g_object_unref (script);
|
g_object_unref (script);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"type" : "ClutterStage",
|
"type" : "ClutterStage",
|
||||||
"color" : "white",
|
"color" : "white",
|
||||||
"width" : 500,
|
"width" : 500,
|
||||||
"height" : 200,
|
"height" : 400,
|
||||||
"children" : [
|
"children" : [
|
||||||
{
|
{
|
||||||
"id" : "red-button",
|
"id" : "red-button",
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
"width" : 100,
|
"width" : 100,
|
||||||
"height" : 100,
|
"height" : 100,
|
||||||
"visible" : true,
|
"visible" : true,
|
||||||
|
"reactive" : true,
|
||||||
|
"behaviours" : [ "fade-behaviour", "path-behaviour" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "green-button",
|
"id" : "green-button",
|
||||||
|
@ -25,7 +27,7 @@
|
||||||
"width" : 100,
|
"width" : 100,
|
||||||
"height" : 100,
|
"height" : 100,
|
||||||
"visible" : true,
|
"visible" : true,
|
||||||
"behaviours" : [ "fade-behaviour" ]
|
"reactive" : true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "red-hand",
|
"id" : "red-hand",
|
||||||
|
@ -37,7 +39,21 @@
|
||||||
"visible" : true,
|
"visible" : true,
|
||||||
"behaviours" : [ "rotate-behaviour", "fade-behaviour" ]
|
"behaviours" : [ "rotate-behaviour", "fade-behaviour" ]
|
||||||
},
|
},
|
||||||
"blue-button"
|
{
|
||||||
|
"id" : "label",
|
||||||
|
"type" : "ClutterLabel",
|
||||||
|
"x" : 50,
|
||||||
|
"y" : 200,
|
||||||
|
"width" : 400,
|
||||||
|
"text" : "Clutter\tScript",
|
||||||
|
"font-name" : "Sans 24px",
|
||||||
|
"color" : "black",
|
||||||
|
"alignment" : "center",
|
||||||
|
"wrap" : false,
|
||||||
|
"ellipsize" : "none",
|
||||||
|
"visible" : true
|
||||||
|
}
|
||||||
|
"blue-button",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue