147
stop_and_quit (ClutterActor *stage,
150
clutter_timeline_stop (data->timeline);
152
clutter_main_quit ();
148
156
my_sine_wave (ClutterAlpha *alpha,
149
157
gpointer dummy G_GNUC_UNUSED)
180
187
return EXIT_FAILURE;
183
stage = clutter_stage_new ();
184
clutter_actor_set_size (stage, 800, 600);
185
clutter_actor_set_name (stage, "Default Stage");
186
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
188
clutter_stage_set_title (CLUTTER_STAGE (stage), "Actors");
189
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_LightSkyBlue);
190
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
192
190
oh = g_new (SuperOH, 1);
192
oh->stage = clutter_stage_new ();
193
clutter_actor_set_size (oh->stage, 800, 600);
194
clutter_actor_set_name (oh->stage, "Default Stage");
195
clutter_actor_set_background_color (oh->stage, CLUTTER_COLOR_LightSkyBlue);
196
g_signal_connect (oh->stage, "destroy", G_CALLBACK (stop_and_quit), oh);
198
clutter_stage_set_title (CLUTTER_STAGE (oh->stage), "Actors");
199
clutter_stage_set_user_resizable (CLUTTER_STAGE (oh->stage), TRUE);
195
201
/* Create a timeline to manage animation */
196
202
oh->timeline = clutter_timeline_new (6000);
197
clutter_timeline_set_loop (oh->timeline, TRUE);
203
clutter_timeline_set_repeat_count (oh->timeline, -1);
199
205
/* fire a callback for frame change */
200
206
g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh);
215
/* create a new group to hold multiple actors in a group */
216
oh->group = clutter_group_new();
221
/* create a new actor to hold other actors */
222
oh->group = clutter_actor_new ();
223
clutter_actor_set_layout_manager (oh->group, clutter_fixed_layout_new ());
217
224
clutter_actor_set_name (oh->group, "Group");
218
225
g_signal_connect (oh->group, "destroy", G_CALLBACK (on_group_destroy), oh);
219
clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
220
clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
221
clutter_actor_add_constraint (oh->group, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0f));
226
clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (oh->stage, CLUTTER_ALIGN_BOTH, 0.5));
227
clutter_actor_add_constraint (oh->group, clutter_bind_constraint_new (oh->stage, CLUTTER_BIND_SIZE, 0.0f));
223
229
oh->hand = g_new (ClutterActor*, n_hands);
225
oh->stage_width = clutter_actor_get_width (stage);
226
oh->stage_height = clutter_actor_get_height (stage);
231
oh->stage_width = clutter_actor_get_width (oh->stage);
232
oh->stage_height = clutter_actor_get_height (oh->stage);
227
233
oh->radius = (oh->stage_width + oh->stage_height)
285
291
/* Add the group to the stage */
286
clutter_container_add_actor (CLUTTER_CONTAINER (stage), oh->group);
292
clutter_container_add_actor (CLUTTER_CONTAINER (oh->stage), oh->group);
288
294
/* Show everying */
289
clutter_actor_show (stage);
295
clutter_actor_show (oh->stage);
291
g_signal_connect (stage, "key-release-event",
297
g_signal_connect (oh->stage, "key-release-event",
292
298
G_CALLBACK (input_cb),