本文整理汇总了C++中UI_WINDOW::process方法的典型用法代码示例。如果您正苦于以下问题:C++ UI_WINDOW::process方法的具体用法?C++ UI_WINDOW::process怎么用?C++ UI_WINDOW::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI_WINDOW
的用法示例。
在下文中一共展示了UI_WINDOW::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chatbox_process
// process this frame for the chatbox
int chatbox_process(int key_in)
{
int key_out;
key_out = key_in;
// if the chatbox hasn't explicitly been created, we can't do any processing
if(!Chatbox_created){
return key_out;
}
// process the incoming key appropriately
if (key_in == -1) {
key_out = Chat_window.process();
} else {
key_out = Chat_window.process(key_in);
}
// look for special keypresses
switch(key_out){
// line recall up one
case KEY_UP:
chatbox_recall_up();
key_out = 0;
break;
// line recall down one
case KEY_DOWN:
chatbox_recall_down();
key_out = 0;
break;
}
// if we're supposed to be checking our own scroll buttons
if((Chatbox_mode_flags & CHATBOX_FLAG_BUTTONS) && (Chatbox_mode_flags & CHATBOX_FLAG_DRAW_BOX)){
if ( Chatbox_buttons[gr_screen.res][CHATBOX_SCROLL_UP].button.pressed() ) {
chatbox_scroll_up();
}
if ( Chatbox_buttons[gr_screen.res][CHATBOX_SCROLL_DOWN].button.pressed() ) {
chatbox_scroll_down();
}
if ( Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE].button.pressed() ){
chatbox_toggle_size();
}
}
// check to see if the enter text button has been pressed
if ( Chat_enter_text.pressed() ) {
Chat_inputbox.set_focus();
}
// check to see if the current input text needs to be split up and sent automaticall
chatbox_autosplit_line();
return key_out;
}
示例2: red_alert_do_frame
// called once per frame when game state is GS_STATE_RED_ALERT
void red_alert_do_frame(float frametime)
{
int i, k;
// ensure that the red alert interface has been initialized
if (!Red_alert_inited) {
Int3();
return;
}
// commit if skipping briefing, but not in multi - Goober5000
if (!(Game_mode & GM_MULTIPLAYER)) {
if (The_mission.flags[Mission::Mission_Flags::No_briefing])
{
red_alert_button_pressed(RA_CONTINUE);
return;
}
}
k = Ui_window.process() & ~KEY_DEBUGGED;
switch (k) {
case KEY_ESC:
// gameseq_post_event(GS_EVENT_ENTER_GAME);
gameseq_post_event(GS_EVENT_MAIN_MENU);
break;
} // end switch
for (i=0; i<NUM_BUTTONS; i++){
if (Buttons[gr_screen.res][i].button.pressed()){
red_alert_button_pressed(i);
}
}
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
Ui_window.draw();
// hud_anim_render(&Flash_anim, frametime);
font::set_font(font::FONT1);
if ( timestamp_elapsed(Text_delay) ) {
int finished_wipe = 0;
if ( Briefing->num_stages > 0 ) {
finished_wipe = brief_render_text(0, Ra_brief_text_wnd_coords[gr_screen.res][RA_X_COORD], Ra_brief_text_wnd_coords[gr_screen.res][RA_Y_COORD], Ra_brief_text_wnd_coords[gr_screen.res][RA_H_COORD], frametime, 0);
}
if (finished_wipe) {
red_alert_voice_play();
}
}
// blit incoming transmission
red_alert_blit_title();
gr_flip();
}
示例3: gameplay_help_do_frame
// gameplay_help_do_frame() is the function that displays help when acutally playing the game
void gameplay_help_do_frame(float frametime)
{
int i, k;
// ensure the gameplay help interface has been initialized
if (!Gameplay_help_inited) {
Int3();
return;
}
// make sure game sounds are paused
weapon_pause_sounds();
audiostream_pause_all();
k = Ui_window.process() & ~KEY_DEBUGGED;
gameplay_help_process_key(k);
for (i=0; i<NUM_BUTTONS; i++){
if (Buttons[gr_screen.res][i].button.pressed()){
gameplay_help_button_pressed(i);
}
}
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
Ui_window.draw();
gameplay_help_draw_text();
gr_flip();
}
示例4: popup_do_with_condition
int popup_do_with_condition(popup_info *pi, int flags, int(*condition)())
{
int screen_id, choice = -1, done = 0;
int test;
screen_id = gr_save_screen();
if ( popup_init(pi, flags) == -1 )
return -1;
int old_max_w_unscaled = gr_screen.max_w_unscaled;
int old_max_h_unscaled = gr_screen.max_h_unscaled;
int old_max_w_unscaled_zoomed = gr_screen.max_w_unscaled_zoomed;
int old_max_h_unscaled_zoomed = gr_screen.max_h_unscaled_zoomed;
gr_reset_screen_scale();
while(!done) {
int k;
os_poll();
game_set_frametime(-1);
game_do_state_common(gameseq_get_state()); // do stuff common to all states
gr_restore_screen(screen_id);
// draw one frame first
Popup_window.draw();
popup_force_draw_buttons(pi);
popup_draw_msg_text(pi, flags);
popup_draw_button_text(pi, flags);
gr_flip();
// test the condition function or process for the window
if ((test = condition()) > 0) {
done = 1;
choice = test;
} else {
k = Popup_window.process(); // poll for input, handle mouse
choice = popup_process_keys(pi, k, flags);
if ( choice != POPUP_NOCHANGE ) {
done=1;
}
if ( !done ) {
choice = popup_check_buttons(pi);
if ( choice != POPUP_NOCHANGE ) {
done=1;
}
}
}
}
gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
popup_close(pi,screen_id);
return choice;
}
示例5: mission_show_goals_do_frame
// called once a frame during show goals state to process events and render the screen
void mission_show_goals_do_frame(float frametime)
{
int k, i, y, z;
int font_height = gr_get_font_height();
k = Goals_screen_ui_window.process();
switch (k) {
case KEY_ESC:
mission_goal_exit();
break;
case KEY_DOWN:
goal_screen_scroll_down();
break;
case KEY_UP:
goal_screen_scroll_up();
break;
default:
// do nothing
break;
} // end switch
for (i=0; i<NUM_GOAL_SCREEN_BUTTONS; i++){
if (Goal_buttons[i].button.pressed()){
goal_screen_button_pressed(i);
}
}
GR_MAYBE_CLEAR_RES(Goals_screen_bg_bitmap);
if (Goals_screen_bg_bitmap >= 0) {
gr_set_bitmap(Goals_screen_bg_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
Goals_screen_ui_window.draw();
y = 0;
z = Scroll_offset;
while (y + font_height <= Goal_screen_text_h) {
Goal_text.display(z, y);
y += font_height;
z++;
}
Primary_goal_list.icons_display(Scroll_offset);
Secondary_goal_list.icons_display(Scroll_offset);
Bonus_goal_list.icons_display(Scroll_offset);
gr_flip();
}
示例6: multi_df_debrief_do
// do frame
void multi_df_debrief_do()
{
int k, new_k;
char buf[256];
k = chatbox_process();
new_k = Multi_df_window.process(k, 0);
// process keypresses
switch(new_k){
case KEY_ESC:
multi_debrief_esc_hit();
break;
}
// process buttons
multi_df_process_buttons();
// music stuff
common_music_do();
// process debriefing details
multi_debrief_do_frame();
// draw the background
GR_MAYBE_CLEAR_RES(Multi_df_background_bitmap);
if (Multi_df_background_bitmap >= 0) {
gr_set_bitmap(Multi_df_background_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
// draw the window
Multi_df_window.draw();
// kill matrix
multi_df_blit_kill_matrix();
// render the chatbox
chatbox_render();
// draw the mission title
strcpy_s(buf, The_mission.name);
font::force_fit_string(buf, 255, Kill_matrix_title_coords[gr_screen.res][2]);
gr_set_color_fast(&Color_bright_white);
gr_string(Kill_matrix_title_coords[gr_screen.res][0], Kill_matrix_title_coords[gr_screen.res][1], buf, GR_RESIZE_MENU);
// flip
gr_flip();
}
示例7: mission_hotkey_do_frame
// ---------------------------------------------------------------------
// mission_hotkey_do_frame()
//
// Called once per frame to process user input for the Hotkey Assignment Screen
//
void mission_hotkey_do_frame(float frametime)
{
char buf[256];
int i, k, w, h, y, z, line, hotkeys;
int font_height = gr_get_font_height();
int select_tease_line = -1; // line mouse is down on, but won't be selected until button released
color circle_color;
if ( help_overlay_active(Hotkey_overlay_id) ) {
Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
Ui_window.set_ignore_gadgets(1);
}
k = Ui_window.process() & ~KEY_DEBUGGED;
if ( (k > 0) || B1_JUST_RELEASED ) {
if ( help_overlay_active(Hotkey_overlay_id) ) {
help_overlay_set_state(Hotkey_overlay_id, gr_screen.res, 0);
Ui_window.set_ignore_gadgets(0);
k = 0;
}
}
if ( !help_overlay_active(Hotkey_overlay_id) ) {
Ui_window.set_ignore_gadgets(0);
}
switch (k) {
case KEY_DOWN: // scroll list down
hotkey_scroll_line_down();
break;
case KEY_UP: // scroll list up
hotkey_scroll_line_up();
break;
case KEY_PAGEDOWN: // scroll list down
hotkey_scroll_screen_down();
break;
case KEY_PAGEUP: // scroll list up
hotkey_scroll_screen_up();
break;
case KEY_CTRLED | KEY_ENTER:
save_hotkeys();
// fall through to next state -- allender changed this behavior since ESC should always cancel, no?
case KEY_ESC:
mission_hotkey_exit();
break;
case KEY_TAB:
case KEY_ENTER:
case KEY_PADENTER:
expand_wing();
break;
case KEY_EQUAL:
case KEY_PADPLUS:
add_hotkey(Cur_hotkey);
break;
case KEY_MINUS:
case KEY_PADMINUS:
remove_hotkey();
break;
case KEY_F2:
gameseq_post_event(GS_EVENT_OPTIONS_MENU);
break;
case KEY_CTRLED | KEY_R:
reset_hotkeys();
break;
case KEY_CTRLED | KEY_C:
clear_hotkeys();
break;
} // end switch
// ?
for (i=0; i<MAX_KEYED_TARGETS; i++) {
if (k == Key_sets[i])
Cur_hotkey = i;
if (k == (Key_sets[i] | KEY_SHIFTED))
add_hotkey(i);
}
// handle pressed buttons
for (i=0; i<NUM_BUTTONS; i++) {
if (Buttons[gr_screen.res][i].button.pressed()) {
hotkey_button_pressed(i);
break; // only need to handle 1 button @ a time
//.........这里部分代码省略.........
示例8: popupdead_do_frame
// Called once per frame to run the dead popup
int popupdead_do_frame(float frametime)
{
int k, choice;
if ( !Popupdead_active ) {
return -1;
}
// maybe show skip mission popup
if ((!Popupdead_skip_already_shown) && (Player->show_skip_popup) && (Game_mode & GM_NORMAL) && (Game_mode & GM_CAMPAIGN_MODE) && (Player->failures_this_session >= PLAYER_MISSION_FAILURE_LIMIT)) {
int popup_choice = popup(0, 3, XSTR("Do Not Skip This Mission", 1473),
XSTR("Advance To The Next Mission", 1474),
XSTR("Don't Show Me This Again", 1475),
XSTR("You have failed this mission five times. If you like, you may advance to the next mission.", 1472) );
switch (popup_choice) {
case 0:
// stay on this mission, so proceed to normal death popup
// in other words, do nothing.
break;
case 1:
// skip this mission
Popupdead_active = 0;
mission_campaign_skip_to_next();
gameseq_post_event(GS_EVENT_START_GAME);
return -1;
case 2:
// don't show this again
Player->show_skip_popup = 0;
break;
}
Popupdead_skip_already_shown = 1;
}
k = Popupdead_window.process();
choice = popupdead_process_keys(k);
if ( choice >= 0 ) {
// do something different for single/multiplayer
if ( Game_mode & GM_NORMAL ) {
Popupdead_choice=choice;
} else {
Assert( Popupdead_multi_type != -1 );
switch ( Popupdead_multi_type ) {
case POPUPDEAD_OBS_ONLY:
case POPUPDEAD_OBS_QUIT:
Popupdead_choice = POPUPDEAD_DO_OBSERVER;
if ( (Popupdead_multi_type == POPUPDEAD_OBS_QUIT) && (choice == 1) )
Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
break;
case POPUPDEAD_RESPAWN_ONLY:
case POPUPDEAD_RESPAWN_QUIT:
Popupdead_choice = POPUPDEAD_DO_RESPAWN;
if ( (Popupdead_multi_type == POPUPDEAD_RESPAWN_QUIT) && (choice == 1) )
Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
break;
default:
Int3();
break;
}
}
}
choice = popupdead_check_buttons();
if ( choice >= 0 ) {
// do something different for single/multiplayer
if ( Game_mode & GM_NORMAL ) {
Popupdead_choice=choice;
} else {
Assert( Popupdead_multi_type != -1 );
switch ( Popupdead_multi_type ) {
case POPUPDEAD_OBS_ONLY:
case POPUPDEAD_OBS_QUIT:
Popupdead_choice = POPUPDEAD_DO_OBSERVER;
if ( (Popupdead_multi_type == POPUPDEAD_OBS_QUIT) && (choice == 1) )
Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
break;
case POPUPDEAD_RESPAWN_ONLY:
case POPUPDEAD_RESPAWN_QUIT:
Popupdead_choice = POPUPDEAD_DO_RESPAWN;
if ( (Popupdead_multi_type == POPUPDEAD_RESPAWN_QUIT) && (choice == 1) )
Popupdead_choice = POPUPDEAD_DO_MAIN_HALL;
break;
default:
Int3();
break;
}
}
}
Popupdead_window.draw();
popupdead_force_draw_buttons();
//.........这里部分代码省略.........
示例9: credits_do_frame
void credits_do_frame(float frametime)
{
int i, k, next, percent, bm1, bm2;
int bx1, by1, bw1, bh1;
int bx2, by2, bw2, bh2;
// Use this id to trigger the start of music playing on the credits screen
if ( timestamp_elapsed(Credits_music_begin_timestamp) ) {
Credits_music_begin_timestamp = 0;
credits_start_music();
}
k = Ui_window.process();
switch (k) {
case KEY_ESC:
gameseq_post_event(GS_EVENT_MAIN_MENU);
key_flush();
break;
case KEY_CTRLED | KEY_UP:
case KEY_SHIFTED | KEY_TAB:
if ( !(Player->flags & PLAYER_FLAGS_IS_MULTI) ) {
credits_screen_button_pressed(CUTSCENES_BUTTON);
break;
}
// else, react like tab key.
case KEY_CTRLED | KEY_DOWN:
case KEY_TAB:
credits_screen_button_pressed(TECH_DATABASE_BUTTON);
break;
default:
break;
} // end switch
for (i=0; i<NUM_BUTTONS; i++){
if (Buttons[i][gr_screen.res].button.pressed()){
if (credits_screen_button_pressed(i)){
return;
}
}
}
gr_reset_clip();
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0);
}
percent = (int) (100.0f - (CREDITS_ARTWORK_DISPLAY_TIME - Credits_counter) * 100.0f / CREDITS_ARTWORK_FADE_TIME);
if (percent < 0){
percent = 0;
}
next = Credits_artwork_index + 1;
if (next >= NUM_IMAGES){
next = 0;
}
if (Credits_bmps[Credits_artwork_index] < 0) {
char buf[40];
if (gr_screen.res == GR_1024) {
sprintf(buf, NOX("2_CrIm%.2d"), Credits_artwork_index);
} else {
sprintf(buf, NOX("CrIm%.2d"), Credits_artwork_index);
}
Credits_bmps[Credits_artwork_index] = bm_load(buf);
}
if (Credits_bmps[next] < 0) {
char buf[40];
if (gr_screen.res == GR_1024) {
sprintf(buf, NOX("2_CrIm%.2d"), Credits_artwork_index);
} else {
sprintf(buf, NOX("CrIm%.2d"), next);
}
Credits_bmps[next] = bm_load(buf);
}
bm1 = Credits_bmps[Credits_artwork_index];
bm2 = Credits_bmps[next];
if((bm1 != -1) && (bm2 != -1)){
Assert(percent >= 0 && percent <= 100);
// get width and height
bm_get_info(bm1, &bw1, &bh1, NULL, NULL, NULL);
bm_get_info(bm2, &bw2, &bh2, NULL, NULL, NULL);
// determine where to draw the coords
bx1 = Credits_image_coords[gr_screen.res][CREDITS_X_COORD] + ((Credits_image_coords[gr_screen.res][CREDITS_W_COORD] - bw1)/2);
by1 = Credits_image_coords[gr_screen.res][CREDITS_Y_COORD] + ((Credits_image_coords[gr_screen.res][CREDITS_H_COORD] - bh1)/2);
bx2 = Credits_image_coords[gr_screen.res][CREDITS_X_COORD] + ((Credits_image_coords[gr_screen.res][CREDITS_W_COORD] - bw2)/2);
by2 = Credits_image_coords[gr_screen.res][CREDITS_Y_COORD] + ((Credits_image_coords[gr_screen.res][CREDITS_H_COORD] - bh2)/2);
gr_cross_fade(bm1, bm2, bx1, by1, bx2, by2, (float)percent / 100.0f);
//.........这里部分代码省略.........
示例10: fiction_viewer_do_frame
// do
void fiction_viewer_do_frame(float frametime)
{
int i, k, w, h;
// make sure we exist
if (!Fiction_viewer_inited)
{
fiction_viewer_exit();
return;
}
// process keys
k = Fiction_viewer_window.process() & ~KEY_DEBUGGED;
switch (k)
{
case KEY_ESC:
common_music_close();
gameseq_post_event(GS_EVENT_MAIN_MENU);
return;
}
// process button presses
for (i = 0; i < NUM_FVW_BUTTONS; i++)
if (Fiction_viewer_buttons[Fiction_viewer_ui][gr_screen.res][i].button.pressed())
fiction_viewer_button_pressed(i);
common_music_do();
// clear
GR_MAYBE_CLEAR_RES(Fiction_viewer_bitmap);
if (Fiction_viewer_bitmap >= 0)
{
gr_set_bitmap(Fiction_viewer_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
// draw the window
Fiction_viewer_window.draw();
// render the briefing text
brief_render_text(Top_fiction_viewer_text_line, Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][0], Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][1], Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3], frametime);
// maybe output the "more" indicator
if ((Fiction_viewer_text_max_lines + Top_fiction_viewer_text_line) < Num_brief_text_lines[0])
{
use_std_font();
// can be scrolled down
int more_txt_x = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][0] + (Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][2]/2) - 10;
int more_txt_y = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][1] + Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3]; // located below text, centered
gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469)));
gr_set_color_fast(&Color_black);
gr_rect(more_txt_x-2, more_txt_y, w+3, h, GR_RESIZE_MENU);
gr_set_color_fast(&Color_more_indicator);
gr_string(more_txt_x, more_txt_y, XSTR("more", 1469), GR_RESIZE_MENU); // base location on the input x and y?
use_fv_font();
}
gr_flip();
}
示例11: popup_do
// exit: -1 => error
// 0..nchoices-1 => choice
int popup_do(popup_info *pi, int flags)
{
int screen_id, choice = -1, done = 0;
if ( popup_init(pi, flags) == -1 ){
return -1;
}
screen_id = gr_save_screen();
int old_max_w_unscaled = gr_screen.max_w_unscaled;
int old_max_h_unscaled = gr_screen.max_h_unscaled;
int old_max_w_unscaled_zoomed = gr_screen.max_w_unscaled_zoomed;
int old_max_h_unscaled_zoomed = gr_screen.max_h_unscaled_zoomed;
gr_reset_screen_scale();
while(!done) {
int k;
os_poll();
// if we were killed by a call to popup_kill_any_active(), kill the popup
if(Popup_should_die){
choice = -1;
break;
}
// if we're flagged as should be running the state underneath, then do so
if(flags & PF_RUN_STATE){
game_do_state(gameseq_get_state());
}
// otherwise just run the common functions (for networking,etc)
else {
game_set_frametime(-1);
game_do_state_common(gameseq_get_state(),flags & PF_NO_NETWORKING); // do stuff common to all states
}
k = Popup_window.process(); // poll for input, handle mouse
choice = popup_process_keys(pi, k, flags);
if ( choice != POPUP_NOCHANGE ) {
done=1;
}
if ( !done ) {
choice = popup_check_buttons(pi);
if ( choice != POPUP_NOCHANGE ) {
done=1;
}
}
// don't draw anything
if(!(flags & PF_RUN_STATE)){
gr_restore_screen(screen_id);
}
// if this is an input popup, store the input text
if(flags & PF_INPUT){
Popup_input.get_text(pi->input_text);
}
Popup_window.draw();
popup_force_draw_buttons(pi);
popup_draw_msg_text(pi, flags);
popup_draw_button_text(pi, flags);
gr_flip();
}
gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
popup_close(pi,screen_id);
return choice;
}
示例12: cmd_brief_do_frame
void cmd_brief_do_frame(float frametime)
{
char buf[40];
int i, k, w, h, x, y;
// if no command briefing exists, skip this screen.
if (!Cmd_brief_inited) {
cmd_brief_exit();
return;
}
if ( help_overlay_active(CMD_BRIEF_OVERLAY) ) {
Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_HELP].button.reset_status();
Ui_window.set_ignore_gadgets(1);
}
k = Ui_window.process() & ~KEY_DEBUGGED;
if ( (k > 0) || B1_JUST_RELEASED ) {
if ( help_overlay_active(CMD_BRIEF_OVERLAY) ) {
help_overlay_set_state(CMD_BRIEF_OVERLAY, 0);
Ui_window.set_ignore_gadgets(0);
k = 0;
}
}
if ( !help_overlay_active(CMD_BRIEF_OVERLAY) ) {
Ui_window.set_ignore_gadgets(0);
}
switch (k) {
case KEY_ESC:
common_music_close();
gameseq_post_event(GS_EVENT_MAIN_MENU);
break;
} // end switch
for (i=0; i<NUM_CMD_BRIEF_BUTTONS; i++){
if (Cmd_brief_buttons[gr_screen.res][i].button.pressed()){
cmd_brief_button_pressed(i);
}
}
cmd_brief_voice_play(Cur_stage);
common_music_do();
if (cmd_brief_check_stage_done() && Player->auto_advance && (Cur_stage < Cur_cmd_brief->num_stages - 1)){
if((Cur_Anim.num_frames <= 1) || Cur_Anim.done_playing) {
cmd_brief_new_stage(Cur_stage + 1);
}
}
GR_MAYBE_CLEAR_RES(Cmd_brief_background_bitmap);
if (Cmd_brief_background_bitmap >= 0) {
gr_set_bitmap(Cmd_brief_background_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
if(Cur_Anim.num_frames > 0) {
bm_get_info((Cur_Anim.streaming) ? Cur_Anim.bitmap_id : Cur_Anim.first_frame, &x, &y, NULL, NULL, NULL);
x = Cmd_image_center_coords[gr_screen.res][CMD_X_COORD] - x / 2;
y = Cmd_image_center_coords[gr_screen.res][CMD_Y_COORD] - y / 2;
generic_anim_render(&Cur_Anim, (Cmd_brief_paused) ? 0 : frametime, x, y, true);
}
Ui_window.draw();
if (!Player->auto_advance){
Cmd_brief_buttons[gr_screen.res][CMD_BRIEF_BUTTON_PAUSE].button.draw_forced(2);
}
gr_set_font(FONT1);
gr_set_color_fast(&Color_text_heading);
sprintf(buf, XSTR( "Stage %d of %d", 464), Cur_stage + 1, Cur_cmd_brief->num_stages);
gr_get_string_size(&w, NULL, buf);
gr_string(Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_X_COORD] + Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_W_COORD] - w, Cmd_stage_y[gr_screen.res], buf, GR_RESIZE_MENU);
if (brief_render_text(Top_cmd_brief_text_line, Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_X_COORD], Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_Y_COORD], Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_H_COORD], frametime, 0, 1)){
Voice_good_to_go = 1;
}
if (gr_screen.res == 1) {
Max_cmdbrief_Lines = 166/gr_get_font_height(); //Make the max number of lines dependent on the font height. 225 and 85 are magic numbers, based on the window size in retail.
} else {
Max_cmdbrief_Lines = 116/gr_get_font_height();
}
// maybe output the "more" indicator
if ( Max_cmdbrief_Lines < Num_brief_text_lines[0] ) {
// can be scrolled down
int more_txt_x = Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_X_COORD] + (Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_W_COORD]/2) - 10;
int more_txt_y = Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_Y_COORD] + Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_H_COORD] - 2; // located below brief text, centered
gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469)));
gr_set_color_fast(&Color_black);
gr_rect(more_txt_x-2, more_txt_y, w+3, h, GR_RESIZE_MENU);
gr_set_color_fast(&Color_red);
gr_string(more_txt_x, more_txt_y, XSTR("more", 1469), GR_RESIZE_MENU); // base location on the input x and y?
}
//.........这里部分代码省略.........
示例13: credits_do_frame
void credits_do_frame(float frametime)
{
GR_DEBUG_SCOPE("Credits do frame");
int i, k, next, percent, bm1, bm2;
int bx1, by1, bw1, bh1;
int bx2, by2, bw2, bh2;
// Use this id to trigger the start of music playing on the credits screen
if ( timestamp_elapsed(Credits_music_begin_timestamp) ) {
Credits_music_begin_timestamp = 0;
credits_start_music();
}
k = Ui_window.process();
switch (k) {
case KEY_ESC:
gameseq_post_event(GS_EVENT_MAIN_MENU);
key_flush();
break;
case KEY_CTRLED | KEY_UP:
case KEY_SHIFTED | KEY_TAB:
if ( !(Player->flags & PLAYER_FLAGS_IS_MULTI) ) {
credits_screen_button_pressed(CUTSCENES_BUTTON);
break;
}
// else, react like tab key.
case KEY_CTRLED | KEY_DOWN:
case KEY_TAB:
credits_screen_button_pressed(TECH_DATABASE_BUTTON);
break;
default:
break;
} // end switch
for (i=0; i<NUM_BUTTONS; i++){
if (Buttons[i][gr_screen.res].button.pressed()){
if (credits_screen_button_pressed(i)){
return;
}
}
}
gr_reset_clip();
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
percent = (int) (100.0f - (Credits_artwork_display_time - Credits_counter) * 100.0f / Credits_artwork_fade_time);
if (percent < 0){
percent = 0;
}
next = Credits_artwork_index + 1;
if (next >= Credits_num_images){
next = 0;
}
if (Credits_bmps[Credits_artwork_index] < 0) {
char buf[40];
if (gr_screen.res == GR_1024) {
sprintf(buf, NOX("2_CrIm%.2d"), Credits_artwork_index);
} else {
sprintf(buf, NOX("CrIm%.2d"), Credits_artwork_index);
}
Credits_bmps[Credits_artwork_index] = bm_load(buf);
}
if (Credits_bmps[next] < 0) {
char buf[40];
if (gr_screen.res == GR_1024) {
sprintf(buf, NOX("2_CrIm%.2d"), next);
} else {
sprintf(buf, NOX("CrIm%.2d"), next);
}
Credits_bmps[next] = bm_load(buf);
}
bm1 = Credits_bmps[Credits_artwork_index];
bm2 = Credits_bmps[next];
if((bm1 != -1) && (bm2 != -1)){
GR_DEBUG_SCOPE("Render credits bitmap");
Assert(percent >= 0 && percent <= 100);
// get width and height
bm_get_info(bm1, &bw1, &bh1, NULL, NULL, NULL);
bm_get_info(bm2, &bw2, &bh2, NULL, NULL, NULL);
// determine where to draw the coords
bx1 = Credits_image_coords[gr_screen.res][CREDITS_X_COORD] + ((Credits_image_coords[gr_screen.res][CREDITS_W_COORD] - bw1)/2);
by1 = Credits_image_coords[gr_screen.res][CREDITS_Y_COORD] + ((Credits_image_coords[gr_screen.res][CREDITS_H_COORD] - bh1)/2);
//.........这里部分代码省略.........
示例14: player_select_do
void player_select_do()
{
int k;
// Goober5000 - display a popup warning about problems in the mod
if ((Global_warning_count > 10 || Global_error_count > 0) && !Startup_warning_dialog_displayed) {
char text[512];
sprintf(text, "Warning!\n\nThe currently active mod has generated %d warnings and/or errors during program startup. These could have been caused by anything from incorrectly formated table files to corrupt models. While FreeSpace Open will attempt to compensate for these issues, it cannot guarantee a trouble-free gameplay experience. Source Code Project staff cannot provide assistance or support for these problems, as they are caused by the mod's data files, not FreeSpace Open's source code.", Global_warning_count + Global_error_count);
popup(PF_TITLE_BIG | PF_TITLE_RED | PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, text);
Startup_warning_dialog_displayed = true;
}
// set the input box at the "virtual" line 0 to be active so the player can enter a callsign
if (Player_select_input_mode) {
Player_select_input_box.set_focus();
}
// process any ui window stuff
k = Player_select_window.process();
if (k) {
extern void game_process_cheats(int k);
game_process_cheats(k);
}
switch (k) {
// switch between single and multiplayer modes
case KEY_TAB: {
if (Player_select_input_mode) {
gamesnd_play_iface(SND_GENERAL_FAIL);
break;
}
// play a little sound
gamesnd_play_iface(SND_USER_SELECT);
if (Player_select_mode == PLAYER_SELECT_MODE_MULTI) {
player_select_set_bottom_text(XSTR( "Single-Player Mode", 376));
// reinitialize as single player mode
player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
} else if (Player_select_mode == PLAYER_SELECT_MODE_SINGLE) {
player_select_set_bottom_text(XSTR( "Multiplayer Mode", 377));
// reinitialize as multiplayer mode
player_select_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
}
break;
}
case KEY_ESC: {
// we can hit ESC to get out of text input mode, and we don't want
// to set this var in that case since it will crash on a NULL Player
// ptr when going to the mainhall
if ( !Player_select_input_mode ) {
Player_select_no_save_pilot = 1;
}
break;
}
}
// draw the player select pseudo-dialog over it
GR_MAYBE_CLEAR_RES(Player_select_background_bitmap);
gr_set_bitmap(Player_select_background_bitmap);
gr_bitmap(0,0,GR_RESIZE_MENU);
// press the accept button
if (Player_select_autoaccept) {
Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.press_button();
}
// draw any ui window stuf
Player_select_window.draw();
// light up the correct mode button (single or multi)
if (Player_select_mode == PLAYER_SELECT_MODE_SINGLE) {
Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button.draw_forced(2);
} else {
Player_select_buttons[gr_screen.res][MULTI_BUTTON].button.draw_forced(2);
}
// draw the pilot list text
player_select_draw_list();
// draw copyright message on the bottom on the screen
player_select_display_copyright();
if (!Player_select_input_mode) {
player_select_process_noninput(k);
} else {
player_select_process_input(k);
}
// draw any pending messages on the bottom or middle of the screen
player_select_display_all_text();
gr_flip();
}
示例15: multi_pause_do
void multi_pause_do()
{
int k;
// make sure we don't enter this state unless we're in the mission itself
Netgame.game_state = NETGAME_STATE_PAUSED;
// server of the game should periodically be sending pause packets for good measure
if (Net_player->flags & NETINFO_FLAG_AM_MASTER) {
}
if (!(Game_mode & GM_STANDALONE_SERVER)) {
// restore saved screen data if any
if (Multi_paused_screen_id >= 0) {
gr_restore_screen(Multi_paused_screen_id);
}
// set the background image
if (Multi_paused_background >= 0) {
gr_set_bitmap(Multi_paused_background);
gr_bitmap(0, 0, GR_RESIZE_MENU);
}
// if we're inside of popup code right now, don't process the window
if(!popup_active()){
// process chatbox and window stuff
k = chatbox_process();
k = Multi_paused_window.process(k);
switch (k) {
case KEY_ESC:
case KEY_PAUSE:
multi_pause_request(0);
break;
}
}
// check for any button presses
multi_pause_check_buttons();
// render the callsign of the guy who paused
multi_pause_render_callsign();
// render the chatbox
chatbox_render();
// draw tooltips
// Multi_paused_window.draw_tooltip();
Multi_paused_window.draw();
// display the voice status indicator
multi_common_voice_display_status();
// don't flip screen if we are in the popup code right now
if (!popup_active()) {
gr_flip();
}
}
// standalone pretty much does nothing here
else {
os_sleep(1);
}
}