本文整理汇总了C++中UI_WINDOW::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ UI_WINDOW::draw方法的具体用法?C++ UI_WINDOW::draw怎么用?C++ UI_WINDOW::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI_WINDOW
的用法示例。
在下文中一共展示了UI_WINDOW::draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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;
}
示例4: 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();
}
示例5: 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();
}
示例6: chatbox_render
// render the chatbox for this frame
void chatbox_render()
{
if (!Chatbox_created){
return;
}
// clear the multiplayer chat window
// gr_set_clip(Chatbox_x1, Chatbox_y1, Chatbox_w, Chatbox_h, GR_RESIZE_MENU);
// gr_clear();
// gr_reset_clip();
// draw the background bitmap if we're supposed to
if ( (Chatbox_bitmap != -1) && (Chatbox_mode_flags & CHATBOX_FLAG_DRAW_BOX)) {
gr_set_bitmap( Chatbox_bitmap );
gr_bitmap(Chatbox_x1, Chatbox_y1, GR_RESIZE_MENU);
}
// render the chat lines
chatbox_render_chat_lines();
// render any UI window stuff
Chat_window.draw();
}
示例7: mission_hotkey_do_frame
//.........这里部分代码省略.........
}
if (List_buttons[i].double_clicked()) {
Selected_line = i + Scroll_offset;
hotkeys = -1;
switch (Hotkey_lines[Selected_line].type) {
case HOTKEY_LINE_WING:
hotkeys = get_wing_hotkeys(Hotkey_lines[Selected_line].index);
break;
case HOTKEY_LINE_SHIP:
case HOTKEY_LINE_SUBSHIP:
hotkeys = Hotkey_bits[Hotkey_lines[Selected_line].index];
break;
}
if (hotkeys != -1) {
if (hotkeys & (1 << Cur_hotkey))
remove_hotkey();
else
add_hotkey(Cur_hotkey);
}
}
}
GR_MAYBE_CLEAR_RES(Background_bitmap);
if (Background_bitmap >= 0) {
gr_set_bitmap(Background_bitmap);
gr_bitmap(0, 0, GR_RESIZE_MENU);
} else
gr_clear();
Ui_window.draw();
gr_init_color(&circle_color, 160, 160, 0);
// draw the big "F10" in the little box
font::set_font(font::FONT2);
gr_set_color_fast(&Color_text_normal);
strcpy_s(buf, Scan_code_text[Key_sets[Cur_hotkey]]);
gr_get_string_size(&w, &h, buf);
gr_printf_menu(Hotkey_function_name_coords[gr_screen.res][0] + (Hotkey_function_name_coords[gr_screen.res][2] - w) / 2, Hotkey_function_name_coords[gr_screen.res][1], buf);
font::set_font(font::FONT1);
line = Scroll_offset;
while (hotkey_line_query_visible(line)) {
z = Hotkey_lines[line].index;
y = Hotkey_list_coords[gr_screen.res][1] + Hotkey_lines[line].y - Hotkey_lines[Scroll_offset].y;
hotkeys = 0;
switch (Hotkey_lines[line].type) {
case HOTKEY_LINE_HEADING:
gr_set_color_fast(&Color_text_heading);
gr_get_string_size(&w, &h, Hotkey_lines[line].label);
i = y + h / 2 - 1;
gr_line(Hotkey_list_coords[gr_screen.res][0], i, Hotkey_ship_x[gr_screen.res] - 2, i, GR_RESIZE_MENU);
gr_line(Hotkey_ship_x[gr_screen.res] + w + 1, i, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2], i, GR_RESIZE_MENU);
break;
case HOTKEY_LINE_WING:
gr_set_bitmap(Wing_bmp);
bm_get_info(Wing_bmp, NULL, &h, NULL);
i = y + font_height / 2 - h / 2 - 1;
gr_bitmap(Hotkey_wing_icon_x[gr_screen.res], i, GR_RESIZE_MENU);
// i = y + font_height / 2 - 1;
示例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
//.........这里部分代码省略.........
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);
}
/*
if (CreditsWin01 != -1) {
gr_set_bitmap(CreditsWin01);
gr_bitmap(233, 5);
}
if (CreditsWin02 != -1) {
gr_set_bitmap(CreditsWin02);
gr_bitmap(616, 8);
}
if (CreditsWin03 != -1) {
gr_set_bitmap(CreditsWin03);
gr_bitmap(233, 299);
}
if (CreditsWin04 != -1) {
gr_set_bitmap(CreditsWin04);
gr_bitmap(215, 8);
}
*/
Ui_window.draw();
for (i=TECH_DATABASE_BUTTON; i<=CREDITS_BUTTON; i++){
if (Buttons[i][gr_screen.res].button.button_down()){
break;
}
}
if (i > CREDITS_BUTTON){
Buttons[CREDITS_BUTTON][gr_screen.res].button.draw_forced(2);
}
gr_set_clip(Credits_text_coords[gr_screen.res][CREDITS_X_COORD], Credits_text_coords[gr_screen.res][CREDITS_Y_COORD], Credits_text_coords[gr_screen.res][CREDITS_W_COORD], Credits_text_coords[gr_screen.res][CREDITS_H_COORD]);
gr_set_font(FONT1);
gr_set_color_fast(&Color_normal);
int sy;
if ( Credit_position > 0 ) {
sy = fl2i(Credit_position+0.5f);
} else {
sy = fl2i(Credit_position-0.5f);
}
gr_string(0x8000, sy, Credit_text);
int temp_time;
temp_time = timer_get_milliseconds();
Credits_frametime = temp_time - Credits_last_time;
Credits_last_time = temp_time;
timestamp_inc(Credits_frametime / 1000.0f);
float fl_frametime = i2fl(Credits_frametime) / 1000.f;
if (keyd_pressed[KEY_LSHIFT]) {
Credit_position -= fl_frametime * CREDITS_SCROLL_RATE * 4.0f;
} else {
Credit_position -= fl_frametime * CREDITS_SCROLL_RATE;
}
if (Credit_position < Credit_stop_pos){
Credit_position = Credit_start_pos;
}
Credits_counter += fl_frametime;
while (Credits_counter >= CREDITS_ARTWORK_DISPLAY_TIME) {
Credits_counter -= CREDITS_ARTWORK_DISPLAY_TIME;
Credits_artwork_index = next;
}
gr_flip();
}
示例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
//.........这里部分代码省略.........
} 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);
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);
auto alpha = (float)percent / 100.0f;
gr_set_bitmap(bm1, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f - alpha);
gr_bitmap(bx1, by1, GR_RESIZE_MENU);
gr_set_bitmap(bm2, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, alpha);
gr_bitmap(bx2, by2, GR_RESIZE_MENU);
}
Ui_window.draw();
for (i=TECH_DATABASE_BUTTON; i<=CREDITS_BUTTON; i++){
if (Buttons[i][gr_screen.res].button.button_down()){
break;
}
}
if (i > CREDITS_BUTTON){
Buttons[CREDITS_BUTTON][gr_screen.res].button.draw_forced(2);
}
gr_set_clip(Credits_text_coords[gr_screen.res][CREDITS_X_COORD], Credits_text_coords[gr_screen.res][CREDITS_Y_COORD], Credits_text_coords[gr_screen.res][CREDITS_W_COORD], Credits_text_coords[gr_screen.res][CREDITS_H_COORD], GR_RESIZE_MENU);
font::set_font(font::FONT1);
gr_set_color_fast(&Color_normal);
int y_offset = 0;
for (SCP_vector<SCP_string>::iterator iter = Credit_text_parts.begin(); iter != Credit_text_parts.end(); ++iter)
{
size_t currentPos = 0;
size_t lineEnd;
do
{
int height;
int width;
lineEnd = iter->find('\n', currentPos);
auto length = lineEnd - currentPos;
if (lineEnd == SCP_string::npos)
{
length = std::numeric_limits<size_t>::max();
}
示例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: pause_do
// pause do frame - will handle running multiplayer operations if necessary
void pause_do()
{
int k;
const char *pause_str = XSTR("Paused", 767);
int str_w, str_h;
// next two are for view resetting
static int previous_Viewer_mode = -1;
static int previous_hud_state = -1;
Assert( !(Game_mode & GM_MULTIPLAYER) );
// RENDER A GAME FRAME HERE AS THE BACKGROUND (if normal pause)
if(Pause_type == PAUSE_TYPE_NORMAL) {
// Fall back to viewer just incase saved screen is invalid
if(Pause_saved_screen == -1){
Pause_type = PAUSE_TYPE_VIEWER;
}
else if(Pause_type == PAUSE_TYPE_NORMAL) {
gr_restore_screen(Pause_saved_screen);
}
}
if(Pause_type == PAUSE_TYPE_NORMAL){
if (Pause_background_bitmap >= 0) {
gr_set_bitmap(Pause_background_bitmap);
// draw the bitmap
gr_bitmap(Please_wait_coords[gr_screen.res][0], Please_wait_coords[gr_screen.res][1], GR_RESIZE_MENU);
// draw "Paused" on it
gr_set_color_fast(&Color_normal);
gr_set_font(FONT2);
gr_get_string_size(&str_w, &str_h, pause_str);
gr_string((gr_screen.max_w_unscaled - str_w) / 2, (gr_screen.max_h_unscaled - str_h) / 2, pause_str, GR_RESIZE_MENU);
gr_set_font(FONT1);
}
}
if (Pause_type == PAUSE_TYPE_VIEWER) {
if (previous_Viewer_mode < 0)
previous_Viewer_mode = Viewer_mode;
if (previous_hud_state < 0)
previous_hud_state = hud_disabled();
}
// process the ui window here
k = Pause_win.process() & ~KEY_DEBUGGED;
switch (k)
{
case KEY_TAB:
hud_toggle_draw();
break;
// view from outside of the ship
case KEY_ENTER:
if (Pause_type == PAUSE_TYPE_VIEWER) {
button_function_demo_valid(VIEW_EXTERNAL);
}
break;
// view from target
case KEY_PADDIVIDE:
if (Pause_type == PAUSE_TYPE_VIEWER) {
button_function_demo_valid(VIEW_OTHER_SHIP);
}
break;
// change target
case KEY_PADMULTIPLY:
if (Pause_type == PAUSE_TYPE_VIEWER) {
button_function(TARGET_NEXT);
}
break;
case KEY_ESC:
case KEY_ALTED + KEY_PAUSE:
case KEY_PAUSE:
// reset previous view if we happened to be playing around with it during pause
if (Pause_type == PAUSE_TYPE_VIEWER) {
if (previous_Viewer_mode >= 0) {
Viewer_mode = previous_Viewer_mode;
}
// NOTE remember that hud state is reversed here (0 == on, 1 == off)
if ( (previous_hud_state >= 0) && (hud_disabled() != previous_hud_state) ) {
hud_set_draw( !previous_hud_state );
}
}
gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
break;
} // end switch
// draw the background window
Pause_win.draw();
// a very unique case where we shouldn't be doing the page flip because we're inside of popup code
//.........这里部分代码省略.........