Created
August 15, 2009 21:38
-
-
Save magcius/168464 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <clutter/clutter.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
static gboolean | |
enter (ClutterRectangle *rect, ClutterEvent *event, gpointer data) | |
{ | |
g_object_set(G_OBJECT(rect), "scale-gravity", CLUTTER_GRAVITY_CENTER, NULL); | |
g_object_set(G_OBJECT(rect), "scale-x", 1.2, "scale-y", 1.2, NULL); | |
return TRUE; | |
} | |
static gboolean | |
leave (ClutterRectangle *rect, ClutterEvent *event, gpointer data) | |
{ | |
g_object_set(G_OBJECT(rect), "scale-x", 1.0, "scale-y", 1.0, NULL); | |
return TRUE; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff }; | |
ClutterColor actor_color = { 0xff, 0xff, 0xff, 0x99 }; | |
clutter_init (&argc, &argv); | |
ClutterActor *stage = clutter_stage_get_default (); | |
clutter_actor_set_size (stage, 200, 200); | |
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); | |
ClutterActor *rect = clutter_rectangle_new_with_color (&actor_color); | |
clutter_actor_set_size (rect, 100, 100); | |
clutter_actor_set_position (rect, 75, 75); | |
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); | |
clutter_actor_show (rect); | |
clutter_actor_set_reactive (rect, TRUE); | |
g_object_set(G_OBJECT(rect), "scale-x", 0.5, "scale-y", 0.5, NULL); | |
g_signal_connect(rect, "enter-event", G_CALLBACK(enter), NULL); | |
g_signal_connect(rect, "leave-event", G_CALLBACK(leave), NULL); | |
clutter_actor_show (stage); | |
clutter_main (); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment