build
clutter
doc
common
cookbook
examples
Makefile.am
actors-composite-main.c
animations-complex-overlapping.json
animations-complex.c
animations-complex.json
animations-looping-animator.c
animations-looping-implicit.c
animations-looping-state.c
animations-moving-animator.c
animations-moving-implicit.c
animations-moving-state.c
animations-path-circle.c
animations-path-easing.c
animations-path.c
animations-reuse-animation.json
animations-reuse-ui.json
animations-reuse.c
animations-rotating.c
animations-scaling-zoom.c
animations-scaling.c
cb-background-effect.c
cb-background-effect.h
cb-border-effect.c
cb-border-effect.h
cb-button.c
cb-button.h
cb-page-fold-effect.c
cb-page-fold-effect.h
effects-basic.c
effects-built-in.c
effects-custom-deform.c
events-buttons-click.c
events-buttons-lasso.c
events-buttons.c
events-mouse-scroll.c
events-pointer-motion-crossing.c
events-pointer-motion-scribbler.c
events-pointer-motion-stacked.c
events-pointer-motion.c
layouts-bind-constraint-allocation.c
layouts-bind-constraint-overlay.c
layouts-bind-constraint-stage.c
layouts-box-menu.c
layouts-box-property-effects.c
layouts-box.c
layouts-stacking-diff-sized-actors.c
layouts-stacking.c
script-signals.c
script-signals.json
script-ui.c
script-ui.json
smiley.png
text-shadow.c
textures-crossfade-cogl.c
textures-crossfade-slideshow.c
textures-crossfade.c
textures-reflection.c
textures-split-go.c
textures-sub-texture.c
images
videos
Makefile.am
actors.xml
animations.xml
clutter-cookbook.xml.in
effects.xml
events.xml
introduction.xml
layouts.xml
recipe-template.xml
script.xml
text.xml
textures.xml
version.xml.in
manual
reference
AUTHORS.old
CODING_STYLE
HACKING
HACKING.backends
Makefile.am
RELEASING
clutter-actor-invariants.txt
po
tests
.gitignore
COPYING
ChangeLog.pre-git-import
Makefile.am
NEWS
README.in
README.md
autogen.sh
clutter.doap
configure.ac

Make sure users get the idea that clutter_init() has a return value that needs to be checked. These were fixed via sed magic: sed -i -s -e "s/clutter_init (.*)/\ if (& != CLUTTER_INIT_SUCCESS)\n return 1/"\ doc/*/*/*.{c,xml} doc/*/*.xml http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
71 lines
1.5 KiB
C
71 lines
1.5 KiB
C
#include <stdlib.h>
|
|
#include <clutter/clutter.h>
|
|
|
|
#define UI_FILE "animations-complex.json"
|
|
|
|
/*
|
|
* start the animation when a key is pressed;
|
|
* see the signals recipe in the Script chapter for more details
|
|
*/
|
|
gboolean
|
|
foo_key_pressed_cb (ClutterActor *actor,
|
|
ClutterEvent *event,
|
|
gpointer user_data)
|
|
{
|
|
ClutterScript *script = CLUTTER_SCRIPT (user_data);
|
|
|
|
ClutterAnimator *animator;
|
|
clutter_script_get_objects (script,
|
|
"animator", &animator,
|
|
NULL);
|
|
|
|
if (clutter_timeline_is_playing (clutter_animator_get_timeline (animator)))
|
|
return FALSE;
|
|
|
|
clutter_animator_start (animator);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
gchar *filename = UI_FILE;
|
|
|
|
ClutterScript *script;
|
|
ClutterActor *stage;
|
|
|
|
GError *error = NULL;
|
|
|
|
if (argc > 1)
|
|
filename = argv[1];
|
|
|
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
|
return 1;
|
|
|
|
script = clutter_script_new ();
|
|
clutter_script_load_from_file (script, filename, &error);
|
|
|
|
if (error != NULL)
|
|
{
|
|
g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message);
|
|
g_error_free (error);
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
|
|
/* connect signal handlers as defined in the script */
|
|
clutter_script_connect_signals (script, script);
|
|
|
|
clutter_script_get_objects (script,
|
|
"stage", &stage,
|
|
NULL);
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
clutter_main ();
|
|
|
|
g_object_unref (script);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|