void player_select_process_noninput(int k) { int idx; // check for pressed buttons for (idx=0; idx<NUM_PLAYER_SELECT_BUTTONS; idx++) { if (Player_select_buttons[gr_screen.res][idx].button.pressed()) { player_select_button_pressed(idx); } } // check for keypresses switch (k) { // quit the game entirely case KEY_ESC: gameseq_post_event(GS_EVENT_QUIT_GAME); break; case KEY_ENTER | KEY_CTRLED: player_select_button_pressed(ACCEPT_BUTTON); break; // delete the currently highlighted pilot case KEY_DELETE: player_select_button_pressed(DELETE_BUTTON); break; } // check to see if the user has clicked on the "list region" button // and change the selected pilot appropriately if (Player_select_list_region.pressed()) { int click_y; // get the mouse position Player_select_list_region.get_mouse_pos(NULL, &click_y); // determine what index to select //idx = (click_y+5) / 10; idx = click_y / gr_get_font_height(); // if he selected a valid item if ( ((idx + Player_select_list_start) < Player_select_num_pilots) && (idx >= 0) ) { Player_select_pilot = idx + Player_select_list_start; } } // if the player has double clicked on a valid pilot, choose it and hit the accept button if (Player_select_list_region.double_clicked()) { if ((Player_select_pilot >= 0) && (Player_select_pilot < Player_select_num_pilots)) { player_select_button_pressed(ACCEPT_BUTTON); } } }
void player_select_process_noninput(int k) { int idx; // check for pressed buttons for (idx=0; idx<NUM_PLAYER_SELECT_BUTTONS; idx++) { if (Player_select_buttons[gr_screen.res][idx].button.pressed()) { player_select_button_pressed(idx); } } // check for keypresses switch (k) { // quit the game entirely case KEY_ESC: gameseq_post_event(GS_EVENT_QUIT_GAME); break; case KEY_ENTER | KEY_CTRLED: player_select_button_pressed(ACCEPT_BUTTON); break; // delete the currently highlighted pilot case KEY_DELETE: if (Player_select_pilot >= 0) { int ret; if (Player_select_mode == PLAYER_SELECT_MODE_MULTI) { popup(PF_TITLE_BIG | PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Pilots can only be deleted from the single player menu!", 1611)); } else { // display a popup requesting confirmation ret = popup(PF_USE_AFFIRMATIVE_ICON | PF_USE_NEGATIVE_ICON,2,POPUP_NO,POPUP_YES,XSTR( "Are you sure you want to delete this pilot?", 383)); // delete the pilot if (ret == 1) { player_select_delete_pilot(); } } } break; } // check to see if the user has clicked on the "list region" button // and change the selected pilot appropriately if (Player_select_list_region.pressed()) { int click_y; // get the mouse position Player_select_list_region.get_mouse_pos(NULL, &click_y); // determine what index to select //idx = (click_y+5) / 10; idx = click_y / gr_get_font_height(); // if he selected a valid item if ( ((idx + Player_select_list_start) < Player_select_num_pilots) && (idx >= 0) ) { Player_select_pilot = idx + Player_select_list_start; } } // if the player has double clicked on a valid pilot, choose it and hit the accept button if (Player_select_list_region.double_clicked()) { if ((Player_select_pilot >= 0) && (Player_select_pilot < Player_select_num_pilots)) { player_select_button_pressed(ACCEPT_BUTTON); } } }