This email list is read-only. Emails sent to this list will be discarded
----------------------------------
helloworld/helloworld.c | 48 +++++++++++++++++++++++++++-------------------
1 files changed, 28 insertions(+), 20 deletions(-)
New commits:
commit 903856dbac9578109aba95fa7a3137ff95166d63
Author: Bob Spencer <[EMAIL PROTECTED]>
Date: Sun Aug 17 00:43:56 2008 -0700
Loads fullscreen. ESC or q to exit app
Diff in this email is a maximum of 400 lines.
diff --git a/helloworld/helloworld.c b/helloworld/helloworld.c
index 6b9318f..e1f6592 100644
--- a/helloworld/helloworld.c
+++ b/helloworld/helloworld.c
@@ -16,6 +16,10 @@ const guint32 colors[] = {0xFF0000FF/*red*/,
0x00FF00FF/*green*/,
const int NUM_COLORS = 8;
const int NUM_BEHAVIOURS = 3;
+
+
+
+
// Return the next color in the colors[] array
ClutterColor *get_next_color ()
{
@@ -154,21 +158,22 @@ void clean_up (ClutterActor *ca[], gint num_actors)
}
}
-/*
-// ret FALSE to close, TRUE to prevent
-static gboolean query_close ( GtkWidget *widget, GdkEvent *event,
- gpointer data )
+static gboolean key_pressed_cb (ClutterStage *stage,
+ ClutterEvent *event, gpointer data)
{
- g_print ("delete event occurred\n");
+ if (event->type == CLUTTER_KEY_RELEASE) {
+ ClutterKeyEvent *kev = (ClutterKeyEvent *) event;
+ guint symb = clutter_key_event_symbol (kev);
+ if (symb == CLUTTER_Escape || symb == CLUTTER_q) {
+ ClutterActor **ca = data;
+ clutter_main_quit ();
+ //clean_up(ca, strlen(MAIN_STR));
+ return TRUE;
+ }
+ }
return FALSE;
}
-static void close( GtkWidget *widget, gpointer data )
-{
- clutter_main_quit ();
-}
-*/
-
int main (int argc, char **argv)
{
const ClutterColor scn_bkgd = {0x00,0x00,0xFF,0xFF};
@@ -179,33 +184,36 @@ int main (int argc, char **argv)
clutter_init(&argc, &argv);
stage = clutter_stage_get_default();
+ clutter_stage_fullscreen (CLUTTER_STAGE(stage));
-/* g_signal_connect (G_OBJECT (stage), "delete_event",
- G_CALLBACK (query_close), NULL);
- g_signal_connect (G_OBJECT (window), "destroy",
- G_CALLBACK (close), NULL);
-*/
gint scn_width = SCN_WIDTH, scn_height = SCN_HEIGHT;
- clutter_actor_set_size (stage, scn_width, scn_height);
+ clutter_actor_get_size (stage, &scn_width, &scn_height);
clutter_stage_set_color (CLUTTER_STAGE(stage), &scn_bkgd);
//show MAIN_STR
gint num_actors = 0;
ClutterActor *actor;
ClutterActor *arrActors[strlen(MAIN_STR)];
- gint xpos = 0;
+ gint xpos = (scn_width - (FONT_SIZE/3 * strlen(MAIN_STR)))/2;
int i=0;
for (i=0; i<strlen(MAIN_STR); i++) {
- xpos += FONT_SIZE/3;
if (MAIN_STR[i]==' ') {
+ xpos += FONT_SIZE/3;
continue;
}
- actor = create_new_character (MAIN_STR[i], xpos,
(scn_height-FONT_SIZE)/2);
+ actor = create_new_character (MAIN_STR[i], xpos,
+ (scn_height-FONT_SIZE)/2);
arrActors[num_actors++] = actor;
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
+ xpos += FONT_SIZE/3;
}
clutter_actor_show_all (stage);
+
+ // ESC exits
+ g_signal_connect (stage, "key-release-event",
+ G_CALLBACK (key_pressed_cb), arrActors);
+
clutter_main ();
return EXIT_SUCCESS;
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits