/* 玩家选择布 */ static void select_cloth( LCUI_Widget *widget, LCUI_WidgetEvent *unused ) { if(!Graph_IsValid(&left_cloth)) { Graph_HorizFlip( &cloth, &left_cloth ); } PictureBox_SetImage( me_pic_box, &left_cloth ); Widget_Disable( btn_j ); Widget_Disable( btn_s ); Widget_Disable( btn_b ); Widget_Enable( btn_next ); run_game(2); }
/* 玩家选择石头 */ static void select_stone( LCUI_Widget *widget, LCUI_WidgetEvent *unused ) { /* 如果没有存储已水平翻转的图像,就进行水平翻转 */ if(!Graph_IsValid(&left_stone)) { Graph_HorizFlip(&stone, &left_stone); } /* 设定显示的图像为石头 */ PictureBox_SetImage(me_pic_box, &left_stone); Widget_Disable(btn_j); Widget_Disable(btn_s); Widget_Disable(btn_b); Widget_Enable(btn_next); run_game(0);/* 进入游戏 */ }
static void view_result(LCUI_Widget *widget, LCUI_WidgetEvent *unused) { char str[256]; strcpy(str, "你的年龄段是: "); if(RadioButton_IsOn(age_rb[0])) { strcat(str, "15岁以下"); } if(RadioButton_IsOn(age_rb[1])) { strcat(str, "15-20岁"); } if(RadioButton_IsOn(age_rb[2])) { strcat(str, "21-25岁"); } if(RadioButton_IsOn(age_rb[3])) { strcat(str, "26-30岁"); } if(RadioButton_IsOn(age_rb[4])) { strcat(str, "31-40岁"); } if(RadioButton_IsOn(age_rb[5])) { strcat(str, "40岁以上"); } strcat(str, "。"); Label_Text(age_label, str); Widget_Disable(button); }
static void clear_game() /* 功能:清理游戏,恢复PictureBox部件显示的图像 */ { PictureBox_SetImage( me_pic_box, &think ); PictureBox_SetImage( cpu_pic_box, &think ); Widget_Disable(btn_next); }
static void next() /* 功能:进行下一局 */ { Widget_Enable( btn_j ); Widget_Enable( btn_s ); Widget_Enable( btn_b ); Widget_Disable( btn_next ); clear_game(); }