2007-10-08 11:03:22 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
2007-10-09 09:29:03 -04:00
|
|
|
static const gchar *test_behaviour =
|
2007-10-09 12:21:04 -04:00
|
|
|
"["
|
|
|
|
" {"
|
|
|
|
" \"id\" : \"main-timeline\","
|
|
|
|
" \"type\" : \"ClutterTimeline\","
|
|
|
|
" \"num-frames\" : 300,"
|
|
|
|
" \"fps\" : 60,"
|
|
|
|
" \"loop\" : true"
|
|
|
|
" },"
|
|
|
|
" {"
|
|
|
|
" \"id\" : \"rotate-behaviour\","
|
|
|
|
" \"type\" : \"ClutterBehaviourRotate\","
|
|
|
|
" \"angle-begin\" : 0.0,"
|
|
|
|
" \"angle-end\" : 360.0,"
|
2007-10-10 10:29:29 -04:00
|
|
|
" \"axis\" : \"y-axis\","
|
2007-10-09 12:21:04 -04:00
|
|
|
" \"alpha\" : {"
|
|
|
|
" \"timeline\" : \"main-timeline\","
|
|
|
|
" \"function\" : \"sine\""
|
|
|
|
" }"
|
|
|
|
" },"
|
|
|
|
" {"
|
|
|
|
" \"id\" : \"fade-behaviour\","
|
|
|
|
" \"type\" : \"ClutterBehaviourOpacity\","
|
|
|
|
" \"opacity-start\" : 255,"
|
|
|
|
" \"opacity-end\" : 0,"
|
|
|
|
" \"alpha\" : {"
|
|
|
|
" \"timeline\" : \"main-timeline\","
|
2007-10-09 16:04:23 -04:00
|
|
|
" \"function\" : \"ramp-inc\""
|
2007-10-09 12:21:04 -04:00
|
|
|
" }"
|
2007-10-09 09:29:03 -04:00
|
|
|
" }"
|
2007-10-09 12:21:04 -04:00
|
|
|
"]";
|
2007-10-09 09:29:03 -04:00
|
|
|
|
2007-10-08 11:03:22 -04:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
ClutterScript *script;
|
2007-10-09 12:21:04 -04:00
|
|
|
GObject *stage, *timeline;
|
2007-10-09 09:29:03 -04:00
|
|
|
GError *error = NULL;
|
2007-10-08 11:03:22 -04:00
|
|
|
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
|
|
|
|
script = clutter_script_new ();
|
2007-10-09 09:29:03 -04:00
|
|
|
g_assert (CLUTTER_IS_SCRIPT (script));
|
|
|
|
|
|
|
|
clutter_script_load_from_data (script, test_behaviour, -1, &error);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_print ("*** Error:\n"
|
|
|
|
"*** %s\n", error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
g_object_unref (script);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2007-10-09 12:44:44 -04:00
|
|
|
clutter_script_load_from_file (script, "test-script.json", &error);
|
2007-10-08 11:03:22 -04:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_print ("*** Error:\n"
|
|
|
|
"*** %s\n", error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
g_object_unref (script);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2007-10-09 12:21:04 -04:00
|
|
|
stage = clutter_script_get_object (script, "main-stage");
|
|
|
|
clutter_actor_show (CLUTTER_ACTOR (stage));
|
2007-10-08 11:03:22 -04:00
|
|
|
|
2007-10-09 12:21:04 -04:00
|
|
|
timeline = clutter_script_get_object (script, "main-timeline");
|
|
|
|
clutter_timeline_start (CLUTTER_TIMELINE (timeline));
|
2007-10-09 09:29:03 -04:00
|
|
|
|
2007-10-08 11:03:22 -04:00
|
|
|
clutter_main ();
|
|
|
|
|
|
|
|
g_object_unref (script);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|