diff examples/dynamic/text.c @ 291:137a73822d48

Add sh_text_set_style support to change the style of text element.
author wycc
date Sun, 01 Feb 2009 01:45:53 +0800
parents 13ce87b6dbf5
children 433fa83d16f9
line wrap: on
line diff
--- a/examples/dynamic/text.c	Sat Jan 31 19:45:50 2009 +0800
+++ b/examples/dynamic/text.c	Sun Feb 01 01:45:53 2009 +0800
@@ -27,6 +27,9 @@
     MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
     mb_timeval_t timer,interval;
     shape_t *text = (shape_t *) MB_SPRITE_GET_OBJ(myApp->rootsprite,"mytext");
+    mb_textstyle_t style;
+
+    mb_textstyle_init(&style);
 
     
     get_now(&timer);
@@ -38,8 +41,12 @@
     printf("xxx\n");
     if (en->currentscene == 0) {
         sh_text_set_text(text,"This is 0");
+	mb_textstyle_set_color(&style, TEXTCOLOR_RGB(255,0,0));
+	sh_text_set_style(text,0,5,&style);
     } else {
         sh_text_set_text(text,"This is 1");
+	mb_textstyle_set_color(&style, TEXTCOLOR_RGB(0,255,0));
+	sh_text_set_style(text,0,5,&style);
     }
     rdman_shape_changed(MBAPP_RDMAN(myApp), text);
 #if 0