#include <gmodule.h>
#include <clutter/clutter.h>
+ #include <cogl/cogl.h>
+ #include "pango/cogl-pango.h"
+#define INSTRUCTIONS \
+ "Press v\t\342\236\236\tSwitch horizontal/vertical\n" \
+ "Press p\t\342\236\236\tSwitch pack start/end\n" \
+ "Press s\t\342\236\236\tIncrement spacing (up to 12px)\n" \
+ "Press q\t\342\236\236\tQuit"
+
static ClutterActor *hover_actor = NULL;
+ static guint last_index = 0;
+
+ static void
+ on_paint (ClutterActor *actor,
+ gpointer user_data)
+ {
+ guint index_ = GPOINTER_TO_UINT (user_data);
+ gchar *text = g_strdup_printf ("%u", index_);
+ ClutterActorBox alloc = { 0, };
+ CoglColor color;
+ gint layout_width, layout_height;
+ gfloat width, height;
+ PangoLayout *layout;
+
+ clutter_actor_get_allocation_box (actor, &alloc);
+ clutter_actor_box_get_size (&alloc, &width, &height);
+
+ layout = clutter_actor_create_pango_layout (actor, text);
+ pango_layout_get_size (layout, &layout_width, &layout_height);
+
+ cogl_color_set_from_4ub (&color, 0, 0, 0, 255);
+ cogl_pango_render_layout (layout,
+ (width - (layout_width / 1024)) / 2,
+ (height - (layout_height / 1024)) / 2,
+ &color, 0);
+
+ g_object_unref (layout);
+ g_free (text);
+ }
static void
enter_event (ClutterActor *actor,
break;
case CLUTTER_plus:
- add_actor (layout);
+ add_actor (layout, last_index++);
break;
+ case CLUTTER_q:
+ clutter_main_quit ();
+ break;
+
default:
return FALSE;
}