/* check whether Shift is pressed to switch between own and highest score */ void handle_display_switch() { int modstate = 0; modstate = SDL_GetModState(); if (!showing_best) { if (modstate&KMOD_RSHIFT||modstate&KMOD_LSHIFT) { display_set_text( display_player[0], best_name ); display_set_value_directly( display_score[0], best_score ); display_set_highlight( display_player[0], 1 ); display_set_highlight( display_score[0], 1 ); showing_best = 1; } } else { if (!(modstate&KMOD_RSHIFT||modstate&KMOD_LSHIFT)) { display_set_text( display_player[0], cur_player->name ); display_set_value_directly( display_score[0], game->paddles[0]->player->stats.total_score + game->paddles[0]->score ); display_set_highlight( display_player[0], 0 ); display_set_highlight( display_score[0], 0 ); showing_best = 0; } } }
unsigned int setup_code(void){ switch(setup_code_state){ case 0: setup_code_code_1=ui_input_code(); if(setup_code_code_1==-1){//code insert canceled setup_code_state=0; return 0; } if(setup_code_code_1==-2){//code still entered }else if(setup_code_code_1>=0){//code entered setup_code_state=1; } break; case 1: setup_code_code_2=ui_input_code(); if(setup_code_code_2==-1){//code insert canceled setup_code_state=0; return 0; } if(setup_code_code_2==-2){//code still entered }else if(setup_code_code_2>=0){//code entered if(setup_code_code_1==setup_code_code_2){ if(setup_code_code_1==0){ setup_code_code_1=-1; } ui_menues_set_code(setup_code_code_1); settings_save(SETTINGS_UI_MENUES_CODE_32,ui_menues_get_code()>>8); settings_save(SETTINGS_UI_MENUES_CODE_10,ui_menues_get_code()&0xFF); if(ui_menues_get_code()<0){ setup_code_state=3; }else{ setup_code_state=4; } clock_stop_stop_watch();clock_start_stop_watch(); }else{ setup_code_state=2;clock_stop_stop_watch();clock_start_stop_watch(); } } break; case 2:if(clock_get_stop_watch()*4>2000){//2seconds waiting setup_code_state=0; return 0; } display_set_text("Err "); break; case 3:if(clock_get_stop_watch()*4>2000){//2seconds waiting setup_code_state=0; return 0; } display_set_text("off "); break; case 4:if(clock_get_stop_watch()*4>2000){//2seconds waiting setup_code_state=0; return 0; } display_set_text("ok "); break; }
void display_ctor(Display* disp, Menu_enum menu_type, Display* left, Display* right, Display* select, Display* back, uint16_t value) { disp->menu_type = menu_type; disp->left = left; disp->right = right; disp->select = select; disp->back = back; disp->i = value; switch(menu_type){ case CHANNEL_DISPLAY:{//CHANNEL_DISPLAY: display_set_text(disp, CHANNEL_DISPLAY_TEXT, 16); break;} case CHANNEL_SELECT:{//CHANNEL_SELECT: display_set_text(disp, CHANNEL_SELECT_TEXT, 16); break;} case CHANNEL_VOLUME:{//CHANNEL_VOLUME: display_set_text(disp, VOLUME_TEXT, 16); break;} case AMP_TYPE:{//AMP_TYPE: display_set_text(disp, AMP_TYPE_TEXT, 16); break;} case CHANNEL_DISPLAY_2:{ switch(value){ case 1:{ display_set_text(disp,"L/Main Speaker",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 2:{ display_set_text(disp,"R Speaker",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 3:{ display_set_text(disp,"L SPDIF",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 4:{ display_set_text(disp,"R SPDIF",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 5:{ display_set_text(disp,"L XLR",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 6:{ display_set_text(disp,"R XLR",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 7:{ display_set_text(disp,"L Headphone",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } case 8:{ display_set_text(disp,"R Headphone",16); //this is just to load something onto the second line this will need to be replaced Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break; } } break;} case CHANNEL_SELECT_2:{ display_set_text(disp, CHANNEL_SELECT_TEXT, 16); Io_enum temp_io = OUTPUT; Channel* temp_channel = get_channel_from_memory(temp_io, value); display_set_text_line_2(disp, channel_get_name(temp_channel), 16); break;} case CHANNEL_VOLUME_2:{ display_set_text(disp, VOLUME_TEXT, 16); //volume TODO: volume display display_set_text_line_2(disp, "-123456789AB+", 16); break;} case AMP_TYPE_2:{ display_set_text(disp, AMP_TYPE_TEXT, 16); switch(value){ case 1: { display_set_text_line_2(disp, "Stereo", 16); break; } case 2: { display_set_text_line_2(disp, "Mono", 16); break; } } break;} case CHANNEL_SELECT_3:{ display_set_text(disp, "channel select 3", 16); switch(value){ case 1:{ display_set_text_line_2(disp,"L/Main Speaker",16); break; } case 2:{ display_set_text_line_2(disp,"R Speaker",16); break; } case 3:{ display_set_text_line_2(disp,"L SPDIF",16); break; } case 4:{ display_set_text_line_2(disp,"R SPDIF",16); break; } case 5:{ display_set_text_line_2(disp,"L XLR",16); break; } case 6:{ display_set_text_line_2(disp,"R XLR",16); break; } case 7:{ display_set_text_line_2(disp,"L Headphone",16); break; } case 8:{ display_set_text_line_2(disp,"R Headphone",16); break; } } break;} case HOME:{ display_set_text(disp, HOME_TEXT, 16); break;} default:{ printf("error disp_ctor"); break;} } }