mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-script.c (clutter_script_get_object): Construct the requested object if it hasn't been already. This allows referencing objects within the same snippet. * tests/test-script.c: Declare a timeline and use it inside multiple behaviours; apply multiple behaviours to various actors, then retrieve the timeline to start it when the test runs.
This commit is contained in:
parent
0d7184db20
commit
b0569d0f27
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-script.c (clutter_script_get_object): Construct
|
||||
the requested object if it hasn't been already. This allows
|
||||
referencing objects within the same snippet.
|
||||
|
||||
* tests/test-script.c: Declare a timeline and use it inside
|
||||
multiple behaviours; apply multiple behaviours to various
|
||||
actors, then retrieve the timeline to start it when the test
|
||||
runs.
|
||||
|
||||
2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-script-private.h:
|
||||
|
@ -196,12 +196,14 @@ resolve_alpha_func (const gchar *name)
|
||||
{
|
||||
c = name[i];
|
||||
/* skip if uppercase, first or previous is uppercase */
|
||||
if ((c == g_ascii_toupper (c) &&
|
||||
if ((c == '-') ||
|
||||
(c == g_ascii_toupper (c) &&
|
||||
i > 0 && name[i-1] != g_ascii_toupper (name[i-1])) ||
|
||||
(i > 2 && name[i] == g_ascii_toupper (name[i]) &&
|
||||
name[i-1] == g_ascii_toupper (name[i-1]) &&
|
||||
name[i-2] == g_ascii_toupper (name[i-2])))
|
||||
g_string_append_c (symbol_name, '_');
|
||||
|
||||
g_string_append_c (symbol_name, g_ascii_tolower (c));
|
||||
}
|
||||
g_string_append (symbol_name, "_func");
|
||||
@ -210,7 +212,7 @@ resolve_alpha_func (const gchar *name)
|
||||
|
||||
if (!g_module_symbol (module, symbol, (gpointer)&func))
|
||||
func = NULL;
|
||||
|
||||
|
||||
g_free (symbol);
|
||||
|
||||
return func;
|
||||
@ -1145,7 +1147,7 @@ clutter_script_get_object (ClutterScript *script,
|
||||
if (!oinfo)
|
||||
return NULL;
|
||||
|
||||
return oinfo->object;
|
||||
return clutter_script_construct_object (script, oinfo);
|
||||
}
|
||||
|
||||
static GList *
|
||||
|
@ -6,17 +6,36 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static const gchar *test_behaviour =
|
||||
"{"
|
||||
" \"id\" : \"rotate-behaviour\","
|
||||
" \"type\" : \"ClutterBehaviourRotate\","
|
||||
" \"angle-begin\" : 0.0,"
|
||||
" \"angle-end\" : 360.0,"
|
||||
" \"axis\" : \"z-axis\","
|
||||
" \"alpha\" : {"
|
||||
" \"timeline\" : { \"num-frames\" : 300, \"fps\" : 60, \"loop\" : true },"
|
||||
" \"function\" : \"sine\""
|
||||
"["
|
||||
" {"
|
||||
" \"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,"
|
||||
" \"axis\" : \"z-axis\","
|
||||
" \"alpha\" : {"
|
||||
" \"timeline\" : \"main-timeline\","
|
||||
" \"function\" : \"sine\""
|
||||
" }"
|
||||
" },"
|
||||
" {"
|
||||
" \"id\" : \"fade-behaviour\","
|
||||
" \"type\" : \"ClutterBehaviourOpacity\","
|
||||
" \"opacity-start\" : 255,"
|
||||
" \"opacity-end\" : 0,"
|
||||
" \"alpha\" : {"
|
||||
" \"timeline\" : \"main-timeline\","
|
||||
" \"function\" : \"ramp\""
|
||||
" }"
|
||||
" }"
|
||||
"}";
|
||||
"]";
|
||||
|
||||
static const gchar *test_ui =
|
||||
"{"
|
||||
@ -46,6 +65,7 @@ static const gchar *test_ui =
|
||||
" \"width\" : 100,"
|
||||
" \"height\" : 100,"
|
||||
" \"visible\" : true,"
|
||||
" \"behaviours\" : [ \"fade-behaviour\" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"id\" : \"blue-button\","
|
||||
@ -65,7 +85,7 @@ static const gchar *test_ui =
|
||||
" \"y\" : 50,"
|
||||
" \"opacity\" : 100,"
|
||||
" \"visible\" : true,"
|
||||
" \"behaviours\" : [ \"rotate-behaviour\" ]"
|
||||
" \"behaviours\" : [ \"rotate-behaviour\", \"fade-behaviour\" ]"
|
||||
" }"
|
||||
" ]"
|
||||
" }"
|
||||
@ -74,10 +94,8 @@ static const gchar *test_ui =
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *texture;
|
||||
ClutterBehaviour *rotate;
|
||||
ClutterScript *script;
|
||||
GObject *stage, *timeline;
|
||||
GError *error = NULL;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
@ -105,11 +123,11 @@ main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
stage = CLUTTER_ACTOR (clutter_script_get_object (script, "main-stage"));
|
||||
clutter_actor_show (stage);
|
||||
stage = clutter_script_get_object (script, "main-stage");
|
||||
clutter_actor_show (CLUTTER_ACTOR (stage));
|
||||
|
||||
rotate = CLUTTER_BEHAVIOUR (clutter_script_get_object (script, "rotate-behaviour"));
|
||||
clutter_timeline_start (clutter_alpha_get_timeline (clutter_behaviour_get_alpha (rotate)));
|
||||
timeline = clutter_script_get_object (script, "main-timeline");
|
||||
clutter_timeline_start (CLUTTER_TIMELINE (timeline));
|
||||
|
||||
clutter_main ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user