2009-03-11 18:26:30 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <gmodule.h>
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
2009-03-12 10:14:40 +00:00
|
|
|
|
|
|
|
static void size_change_cb (ClutterTexture *texture,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
clutter_actor_set_size (user_data, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *path = "redhand.png";
|
|
|
|
|
|
|
|
static gboolean task (gpointer foo)
|
2009-03-11 18:26:30 +00:00
|
|
|
{
|
|
|
|
ClutterTimeline *timeline;
|
|
|
|
ClutterAlpha *alpha;
|
|
|
|
ClutterBehaviour *depth_behavior;
|
|
|
|
ClutterActor *image[4];
|
2009-03-12 10:14:40 +00:00
|
|
|
ClutterActor *clone[4];
|
|
|
|
ClutterActor *stage;
|
2009-03-11 18:26:30 +00:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
stage = clutter_stage_get_default ();
|
2009-03-12 10:14:40 +00:00
|
|
|
#if 0
|
2009-03-11 18:26:30 +00:00
|
|
|
for (i=0;i<4;i++)
|
|
|
|
image[i] = g_object_new (CLUTTER_TYPE_TEXTURE,
|
|
|
|
"filename", path,
|
2009-03-12 10:14:40 +00:00
|
|
|
"load-async", TRUE,
|
|
|
|
NULL);
|
|
|
|
#else
|
|
|
|
/*for (i=0;i<4;i++)*/
|
|
|
|
image[0] = g_object_new (CLUTTER_TYPE_TEXTURE,
|
|
|
|
"filename", path,
|
2009-03-11 18:26:30 +00:00
|
|
|
NULL);
|
|
|
|
image[1] = g_object_new (CLUTTER_TYPE_TEXTURE,
|
|
|
|
"filename", path,
|
2009-03-12 10:38:39 +00:00
|
|
|
"load-data-async", TRUE,
|
2009-03-11 18:26:30 +00:00
|
|
|
NULL);
|
|
|
|
image[2] = g_object_new (CLUTTER_TYPE_TEXTURE,
|
|
|
|
"filename", path,
|
2009-03-12 10:38:39 +00:00
|
|
|
"load-async", TRUE,
|
2009-03-11 18:26:30 +00:00
|
|
|
NULL);
|
2009-03-12 10:14:40 +00:00
|
|
|
|
|
|
|
#endif
|
2009-03-12 10:38:39 +00:00
|
|
|
for (i=0;i<3;i++)
|
2009-03-12 10:14:40 +00:00
|
|
|
{
|
|
|
|
clutter_container_add (CLUTTER_CONTAINER (stage), image[i], NULL);
|
|
|
|
}
|
2009-03-12 10:38:39 +00:00
|
|
|
for (i=0;i<3;i++)
|
2009-03-12 10:14:40 +00:00
|
|
|
{
|
|
|
|
clutter_actor_set_position (image[i], 50+i*100, 0+i*50);
|
|
|
|
clone[i]=clutter_clone_new (image[i]);
|
2009-03-12 11:48:44 +00:00
|
|
|
g_signal_connect (image[i], "size-change",
|
|
|
|
G_CALLBACK (size_change_cb), clone[i]);
|
2009-03-12 10:14:40 +00:00
|
|
|
clutter_container_add (CLUTTER_CONTAINER (stage), clone[i], NULL);
|
|
|
|
clutter_actor_set_position (clone[i], 50+i*100, 150+i*50+100);
|
|
|
|
}
|
2009-03-11 18:26:30 +00:00
|
|
|
|
2009-03-12 10:38:39 +00:00
|
|
|
for (i=0; i<3; i++)
|
2009-03-11 18:26:30 +00:00
|
|
|
{
|
|
|
|
timeline = clutter_timeline_new (60*5, 60);
|
|
|
|
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
|
|
|
depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 0);
|
|
|
|
clutter_behaviour_apply (depth_behavior, image[i]);
|
|
|
|
clutter_timeline_start (timeline);
|
|
|
|
}
|
2009-03-12 10:14:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
G_MODULE_EXPORT gint
|
|
|
|
test_texture_async_main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
ClutterActor *stage;
|
|
|
|
ClutterColor stage_color = { 0x12, 0x34, 0x56, 0xff };
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
|
2009-03-12 11:48:44 +00:00
|
|
|
g_thread_init (NULL);
|
2009-03-12 10:14:40 +00:00
|
|
|
stage = clutter_stage_get_default ();
|
|
|
|
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
|
|
|
|
2009-03-11 18:26:30 +00:00
|
|
|
clutter_actor_show (stage);
|
2009-03-12 10:14:40 +00:00
|
|
|
g_signal_connect (stage,
|
|
|
|
"button-press-event", G_CALLBACK (clutter_main_quit),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
path = argv[1]?argv[1]:"redhand.png";
|
|
|
|
|
|
|
|
|
|
|
|
g_timeout_add (500, task, NULL);
|
2009-03-11 18:26:30 +00:00
|
|
|
|
|
|
|
clutter_main ();
|
|
|
|
|
|
|
|
/*g_object_unref (depth_behavior);
|
|
|
|
g_object_unref (timeline);*/
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|