mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
df92202c5f
* clutter/Makefile.am: * clutter/clutter-actor.c: * clutter/clutter-actor.h: * clutter/clutter-clone-texture.c: * clutter/clutter-clone-texture.h: * clutter/clutter-element.c: * clutter/clutter-element.h: * clutter/clutter-group.c: * clutter/clutter-group.h: * clutter/clutter-label.c: * clutter/clutter-label.h: * clutter/clutter-main.c: * clutter/clutter-main.h: * clutter/clutter-rectangle.c: * clutter/clutter-rectangle.h: * clutter/clutter-stage.c: * clutter/clutter-stage.h: * clutter/clutter-texture.c: * clutter/clutter-texture.h: * clutter/clutter-video-texture.c: * clutter/clutter-video-texture.h: * clutter/clutter.h: * examples/super-oh.c: * examples/test-text.c: * examples/test-video.c: * examples/test.c: * examples/video-cube.c: * gtk/gtk-clutter-test.c: * gtk/gtk-clutter.c: * gtk/gtk-clutter.h: Element to Actor Renaming.
59 lines
1.5 KiB
C
59 lines
1.5 KiB
C
#include <clutter/clutter.h>
|
|
|
|
void
|
|
frame_cb (ClutterTimeline *timeline,
|
|
gint frame_num,
|
|
gpointer data)
|
|
{
|
|
ClutterActor *label = (ClutterActor*)data;
|
|
|
|
clutter_actor_set_depth(label, -400 + (frame_num * 40));
|
|
clutter_actor_set_opacity (label, 255 - frame_num );
|
|
}
|
|
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
ClutterTimeline *timeline;
|
|
ClutterActor *label;
|
|
ClutterActor *stage;
|
|
gchar *text;
|
|
gsize size;
|
|
ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
|
|
ClutterColor label_color = { 0x11, 0xdd, 0x11, 0xaa };
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
stage = clutter_stage_get_default ();
|
|
|
|
if (!g_file_get_contents ("test-text.c", &text, &size, NULL))
|
|
g_error("g_file_get_contents() of test-text.c failed");
|
|
|
|
clutter_actor_set_size (stage, 800, 600);
|
|
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
|
|
|
label = clutter_label_new_with_text ("Mono 8", text);
|
|
clutter_label_set_color (CLUTTER_LABEL (label), &label_color);
|
|
|
|
clutter_group_add (CLUTTER_GROUP (stage), label);
|
|
clutter_group_show_all (CLUTTER_GROUP (stage));
|
|
|
|
timeline = clutter_timeline_new (400, 60); /* num frames, fps */
|
|
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
|
|
|
|
g_signal_connect(timeline, "new-frame", G_CALLBACK (frame_cb), label);
|
|
|
|
/* and start it */
|
|
clutter_timeline_start (timeline);
|
|
|
|
g_signal_connect (stage, "key-press-event",
|
|
G_CALLBACK (clutter_main_quit), NULL);
|
|
|
|
g_object_unref (stage);
|
|
|
|
clutter_main();
|
|
|
|
return 0;
|
|
}
|