void UI_WINDOW::render_tooltip(char *str) { int str_w, str_h; gr_get_string_size(&str_w, &str_h, str); Assert(str_w < gr_screen.max_w_unscaled - 4 && str_h < gr_screen.max_h_unscaled - 4); if (ttx < 2) ttx = 2; if (tty < 2) tty = 2; if (ttx + str_w + 2 > gr_screen.max_w_unscaled) ttx = gr_screen.max_w_unscaled - str_w; if (tty + str_h + 2 > gr_screen.max_h_unscaled) tty = gr_screen.max_h_unscaled - str_h; gr_set_color_fast(&Color_black); gr_rect(ttx - 1, tty - 1, str_w + 2, str_h + 1, GR_RESIZE_MENU); gr_set_color_fast(&Color_bright_white); gr_string(ttx, tty, str, GR_RESIZE_MENU); }
void kmatrix_redraw_coop() { int i, color; int sorted[MAX_PLAYERS]; multi_sort_kill_list(); grd_curcanv->cv_font = MEDIUM3_FONT; gr_string( 0x8000, FSPACY(10), "COOPERATIVE SUMMARY"); grd_curcanv->cv_font = GAME_FONT; multi_get_kill_list(sorted); kmatrix_draw_coop_names(sorted); for (i=0; i<N_players; i++ ) { color = sorted[i]; if (Players[sorted[i]].connected==CONNECT_DISCONNECTED) gr_set_fontcolor(gr_find_closest_color(31,31,31),-1); else gr_set_fontcolor(BM_XRGB(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b),-1 ); kmatrix_draw_coop_item( i, sorted ); } gr_palette_load(gr_palette); }
// Draw the button text nicely formatted in the popup void popup_draw_button_text(popup_info *pi, int flags) { int w, h, i, sx, sy; gr_set_color_fast(&Color_bright_blue); for ( i=0; i < pi->nchoices; i++ ) { gr_get_string_size(&w, &h, pi->button_text[i]); if ( (pi->nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) { sx = Button_regions[gr_screen.res][i+1][0]-w; sy = Button_regions[gr_screen.res][i+1][1]+4; } else { sx = Button_regions[gr_screen.res][i][0]-w; sy = Button_regions[gr_screen.res][i][1]+4; } gr_string(sx, sy, pi->button_text[i]); // figure out where to draw underline char if ( pi->shortcut_index[i] > 0 ) { int cut=pi->shortcut_index[i]; char save_char=pi->button_text[i][cut]; pi->button_text[i][cut] = 0; gr_get_string_size(&w, &h, pi->button_text[i]); pi->button_text[i][cut] = save_char; sx += w; } if ( pi->shortcut_index[i] >= 0 ) { gr_printf(sx, sy, NOX("%c"), 95); } } }
void red_alert_blit_title() { const char *str = XSTR("Incoming Transmission", 1406); int w, h; // get the string size gr_set_font(Ra_flash_font[gr_screen.res]); gr_get_string_size(&w, &h, str); // set alpha color color flash_color; if(Ra_flash_up){ gr_init_alphacolor(&flash_color, (int)(255.0f * (Ra_flash_time / RA_FLASH_CYCLE)), 0, 0, 255); } else { gr_init_alphacolor(&flash_color, (int)(255.0f * (1.0f - (Ra_flash_time / RA_FLASH_CYCLE))), 0, 0, 255); } // draw gr_set_color_fast(&flash_color); gr_string(Ra_brief_text_wnd_coords[gr_screen.res][0] + ((Ra_brief_text_wnd_coords[gr_screen.res][2] - w) / 2), Ra_flash_y[gr_screen.res] - h - 5, str, GR_RESIZE_MENU); gr_set_color_fast(&Color_normal); // increment flash time Ra_flash_time += flFrametime; if(Ra_flash_time >= RA_FLASH_CYCLE){ Ra_flash_time = 0.0f; Ra_flash_up = !Ra_flash_up; } // back to the original font gr_set_font(FONT1); }
void gr_string_win(int x, int y, char *s) { int old_bitmap = gr_screen.current_bitmap; gr_set_font(FONT1); gr_string(x,y,s); gr_screen.current_bitmap = old_bitmap; }
void kmatrix_draw_names(int *sorted) { int j, x, color; if(Netgame.FairColors) selected_player_rgb = player_rgb_all_blue; else if(Netgame.BlackAndWhitePyros) selected_player_rgb = player_rgb_alt; else selected_player_rgb = player_rgb; for (j=0; j<N_players; j++) { if (Game_mode & GM_TEAM) color = get_team(sorted[j]); else color = sorted[j]; x = FSPACX (70 + CENTERING_OFFSET(N_players) + j*25); if (Players[sorted[j]].connected==CONNECT_DISCONNECTED) gr_set_fontcolor(gr_find_closest_color(31,31,31),-1); else gr_set_fontcolor(BM_XRGB(selected_player_rgb[color].r,selected_player_rgb[color].g,selected_player_rgb[color].b),-1 ); gr_printf( x, FSPACY(40), "%c", Players[sorted[j]].callsign[0] ); } x = FSPACX(72 + CENTERING_OFFSET(N_players) + N_players*25); gr_set_fontcolor( BM_XRGB(31,31,31),-1 ); gr_string( x, FSPACY(40), "K/E"); }
// Draw the message text nicely formatted in the popup void popup_draw_msg_text(popup_info *pi, int flags) { int sx, sy, i, w, h; int line_index; int line_count; // figure out the starting display line_index = popup_calc_starting_index(pi); // figure out the starting y: sy = popup_calc_starting_y(pi, flags); // draw title if required if ( flags & (PF_TITLE | PF_TITLE_BIG) ) { popup_draw_title(sy, pi->title, flags); sy += gr_get_font_height(); } // draw body if ( flags & PF_BODY_BIG ) { gr_set_font(FONT2); } else { gr_set_font(FONT1); } popup_set_text_color(flags); line_count = 0; for ( i = line_index; i < pi->nlines; i++, line_count++ ) { // if we've already displayed the max # of lines if(line_count >= Popup_max_display[gr_screen.res]){ break; } gr_get_string_size(&w, &h, pi->msg_lines[i]); sx = fl2i(Title_coords[gr_screen.res][4] - w/2.0f + 0.5f); gr_string(sx, sy + line_count * h, pi->msg_lines[i], GR_RESIZE_MENU); } // maybe draw "more" h = 10; if(i < pi->nlines){ gr_set_color_fast(&Color_more_bright); gr_string(Title_coords[gr_screen.res][4], sy + (Popup_max_display[gr_screen.res]) * h, XSTR("More", 459), GR_RESIZE_MENU); } gr_set_font(FONT1); // reset back to regular font size }
void radar_draw_circle_std(int x, int y, int rad) { if (rad == Current_radar_global->Radar_blip_radius_target[gr_screen.res]) { if (radar_target_id_flags & RTIF_BLINK) { if (Missiontime & 8192) return; } gr_string(Large_blip_offset_x + x, Large_blip_offset_y + y, Large_blip_string); } else { // rad = RADAR_BLIP_RADIUS_NORMAL; gr_string(Small_blip_offset_x + x, Small_blip_offset_y + y, Small_blip_string); } }
void game_draw_hud_stuff() { #ifdef CROSSHAIR if ( Viewer->type == OBJ_PLAYER ) laser_do_crosshair(Viewer); #endif #ifndef NDEBUG draw_window_label(); #endif #ifdef NETWORK game_draw_multi_message(); #endif if ((Newdemo_state == ND_STATE_PLAYBACK) || (Newdemo_state == ND_STATE_RECORDING)) { char message[128]; int y; if (Newdemo_state == ND_STATE_PLAYBACK) { if (Newdemo_show_percentage) { sprintf(message, "%s (%d%%%% %s)", TXT_DEMO_PLAYBACK, newdemo_get_percent_done(), TXT_DONE); } else { sprintf (message, " "); } } else { extern int Newdemo_num_written; sprintf (message, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024)); } gr_set_curfont( GAME_FONT ); gr_set_fontcolor( BM_XRGB(27,0,0), -1 ); y = GHEIGHT-(LINE_SPACING*2); if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT) y = grd_curcanv->cv_bitmap.bm_h / 1.2 ; if (PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) gr_string(0x8000, y, message ); } render_countdown_gauge(); if (GameCfg.FPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) show_framerate(); if (Newdemo_state == ND_STATE_PLAYBACK) Game_mode = Newdemo_game_mode; draw_hud(); if (Newdemo_state == ND_STATE_PLAYBACK) Game_mode = GM_NORMAL; if ( Player_is_dead ) player_dead_message(); }
void hud_show_mini_ship_integrity(object *objp, int x_force, int y_force) { char text_integrity[64]; int numeric_integrity; float p_target_integrity,initial_hull; int nx, ny; initial_hull = Ship_info[Ships[objp->instance].ship_info_index].initial_hull_strength; if ( initial_hull <= 0 ) { Int3(); // illegal initial hull strength p_target_integrity = 0.0f; } else { p_target_integrity = objp->hull_strength / initial_hull; if (p_target_integrity < 0){ p_target_integrity = 0.0f; } } numeric_integrity = fl2i(p_target_integrity*100 + 0.5f); if(numeric_integrity > 100){ numeric_integrity = 100; } // Assert(numeric_integrity <= 100); // base coords nx = (x_force == -1) ? Hud_mini_base[gr_screen.res][0] : x_force; ny = (y_force == -1) ? Hud_mini_base[gr_screen.res][1] : y_force; // 3 digit hull strength if ( numeric_integrity == 100 ) { nx += Hud_mini_3digit[gr_screen.res][2]; } // 2 digit hull strength else if ( numeric_integrity < 10 ) { nx += Hud_mini_1digit[gr_screen.res][2]; } // 1 digit hull strength else { nx += Hud_mini_2digit[gr_screen.res][2]; } if ( numeric_integrity == 0 ) { if ( p_target_integrity > 0 ) { numeric_integrity = 1; } } nx += fl2i( HUD_offset_x ); ny += fl2i( HUD_offset_y ); sprintf(text_integrity, "%d", numeric_integrity); if ( numeric_integrity < 100 ) { hud_num_make_mono(text_integrity); } gr_string(nx, ny, text_integrity); }
static void con_draw(void) { int i = 0, y = 0; if (con_size <= 0) return; gr_set_default_canvas(); auto &canvas = *grd_curcanv; auto &game_font = *GAME_FONT; gr_set_curfont(canvas, GAME_FONT); const uint8_t color = BM_XRGB(0, 0, 0); gr_settransblend(canvas, 7, GR_BLEND_NORMAL); const auto &&fspacy1 = FSPACY(1); const auto &&line_spacing = LINE_SPACING(*canvas.cv_font, *GAME_FONT); y = fspacy1 + (line_spacing * con_size); gr_rect(canvas, 0, 0, SWIDTH, y, color); gr_settransblend(canvas, GR_FADE_OFF, GR_BLEND_NORMAL); i+=con_scroll_offset; gr_set_fontcolor(canvas, BM_XRGB(255, 255, 255), -1); y = cli_draw(y, line_spacing); const auto &&fspacx = FSPACX(); const auto &&fspacx1 = fspacx(1); for (;;) { auto &b = con_buffer[CON_LINES_MAX - 1 - i]; gr_set_fontcolor(canvas, get_console_color_by_priority(b.priority), -1); int w,h; gr_get_string_size(game_font, b.line, &w, &h, nullptr); y -= h + fspacy1; gr_string(canvas, game_font, fspacx1, y, b.line, w, h); i++; if (y<=0 || CON_LINES_MAX-1-i <= 0 || i < 0) break; } gr_rect(canvas, 0, 0, SWIDTH, line_spacing, color); gr_set_fontcolor(canvas, BM_XRGB(255, 255, 255),-1); gr_printf(canvas, game_font, fspacx1, fspacy1, "%s LOG", DESCENT_VERSION); gr_string(canvas, game_font, SWIDTH - fspacx(110), fspacy1, "PAGE-UP/DOWN TO SCROLL"); }
void ui_string_centered(int x, int y, char* s) { int height, width; gr_get_string_size(&width, &height, s); //baseline = height-grd_curcanv->cv_font->ft_baseline; gr_string(x - ((width - 1) / 2), y - ((height - 1) / 2), s); }
// ---------------------------------------------------------------------- // hud_display_escort() // // Display the data on ships in the escort list void hud_display_escort() { int i = 0; if (!Show_escort_view) { return; } if (!Num_escort_ships) { return; } // hud_set_default_color(); hud_set_gauge_color(HUD_ESCORT_VIEW); // draw the top of the escort view hud_aabitmap(Escort_gauges[0].first_frame, current_hud->Escort_coords[0], current_hud->Escort_coords[1]); gr_string(current_hud->Escort_htext_coords[0], current_hud->Escort_htext_coords[1], current_hud->Escort_htext); int x = current_hud->Escort_coords[0] + current_hud->Escort_list[0]; int y = current_hud->Escort_coords[1] + current_hud->Escort_list[1]; //This is temporary Num_escort_ships--; i = 0; if (Num_escort_ships) { for (; i < Num_escort_ships; i++) { if (i != 0) { x += current_hud->Escort_entry[0]; y += current_hud->Escort_entry[1]; } hud_aabitmap(Escort_gauges[1].first_frame, x, y); //Now we just show the ships info hud_escort_show_icon(x, y, i); } //Increment for last entry x += current_hud->Escort_entry_last[0]; y += current_hud->Escort_entry_last[1]; } //Back to right # Num_escort_ships++; //Show the last escort entry hud_aabitmap(Escort_gauges[2].first_frame, x, y); hud_escort_show_icon(x, y, i); }
// blit the pilot squadron logo void multi_pinfo_blit_squadron_logo() { char place_text[100]; int w; player* p = Multi_pinfo_popup_player->m_player; // if we don't have a bitmap handle, blit a placeholder if (Mp_squad.bitmap == -1) { gr_set_color_fast(&Color_normal); // if there is no image if (strlen(p->squad_filename) <= 0) { strcpy_s(place_text, XSTR("No/Invalid Image", 1053)); } // if the image is xferring else if (multi_xfer_lookup(p->squad_filename)) { strcpy_s(place_text, XSTR("Image Transferring", 691)); } // if we're not accepting images else if (!(Net_player->p_info.options.flags & MLO_FLAG_ACCEPT_PIX) || !(Netgame.options.flags & MSO_FLAG_ACCEPT_PIX)) { strcpy_s(place_text, XSTR("No Image", 692)); } // otherwise we wait else { strcpy_s(place_text, XSTR("Waiting", 690)); } // center the text gr_get_string_size(&w, NULL, place_text); gr_string(Multi_pinfo_squad_coords[gr_screen.res][0] + ((Multi_pinfo_squad_coords[gr_screen.res][2] - w) / 2), Multi_pinfo_squad_coords[gr_screen.res][1], place_text); } // otherwise blit the bitmap else { gr_set_bitmap(Mp_squad.bitmap); // gr_bitmap(MPI_SQUAD_X, MPI_SQUAD_Y); // get width and heigh int bm_w, bm_h; bm_get_info(Mp_squad.bitmap, &bm_w, &bm_h, NULL, NULL, NULL); gr_bitmap(Multi_pinfo_squad_coords[gr_screen.res][0] + ((Multi_pinfo_squad_coords[gr_screen.res][2] - bm_w) / 2), Multi_pinfo_squad_coords[gr_screen.res][1] + ((Multi_pinfo_squad_coords[gr_screen.res][3] - bm_h) / 2)); // g3_draw_2d_poly_bitmap(Multi_pinfo_squad_coords[gr_screen.res][0], Multi_pinfo_squad_coords[gr_screen.res][1], Multi_pinfo_squad_coords[gr_screen.res][2], Multi_pinfo_squad_coords[gr_screen.res][3]); } }
// write out the current description in the bottom window void techroom_render_desc(int xo, int yo, int ho) { int y, z, len, font_height; char line[MAX_TEXT_LINE_LEN + 1]; font_height = gr_get_font_height(); y = 0; z = Text_offset; while (y + font_height <= ho) { if (z >= Text_size){ break; } len = Text_line_size[z]; if (len > MAX_TEXT_LINE_LEN){ len = MAX_TEXT_LINE_LEN; } strncpy(line, Text_lines[z], len); line[len] = 0; gr_string(xo, yo + y, line, GR_RESIZE_MENU); y += font_height; z++; } // maybe output 'more' indicator if ( z < Text_size ) { // can be scrolled down int more_txt_x = Tech_desc_coords[gr_screen.res][0] + (Tech_desc_coords[gr_screen.res][2]/2) - 10; // FIXME should move these to constants since they don't move int more_txt_y = Tech_desc_coords[gr_screen.res][1] + Tech_desc_coords[gr_screen.res][3]; // located below brief text, centered int w, h; 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? } }
void print_status_bar( char message[DIAGNOSTIC_MESSAGE_MAX] ) { int w,h,aw; gr_set_current_canvas( NULL ); gr_set_curfont(editor_font); gr_set_fontcolor( CBLACK, CGREY ); gr_get_string_size( message, &w, &h, &aw ); gr_string( 4, 583, message ); gr_set_fontcolor( CBLACK, CWHITE ); gr_setcolor( CGREY ); gr_rect( 4+w, 583, 799, 599 ); }
void ui_dprintf( UI_DIALOG * dlg, const char * format, ... ) { char buffer[1000]; va_list args; va_start(args, format ); vsnprintf(buffer,sizeof(buffer),format,args); ui_dialog_set_current_canvas( dlg ); D_TEXT_X = gr_string( D_TEXT_X, D_TEXT_Y, buffer ); }
void ui_dprintf_at( UI_DIALOG * dlg, short x, short y, const char * format, ... ) { char buffer[1000]; va_list args; va_start(args, format ); vsnprintf(buffer,sizeof(buffer),format,args); ui_dialog_set_current_canvas( dlg ); gr_string( x, y, buffer ); }
void _cdecl gr_printf_menu_zoomed( int x, int y, const char * format, ... ) { va_list args; if ( !Current_font ) return; va_start(args, format); vsprintf(grx_printf_text,format,args); va_end(args); gr_string(x,y,grx_printf_text,GR_RESIZE_MENU_ZOOMED); }
void _cdecl gr_printf_no_resize( int x, int y, char * format, ... ) { va_list args; if ( !Current_font ) return; va_start(args, format); vsprintf(grx_printf_text,format,args); va_end(args); gr_string(x,y,grx_printf_text,false); }
void ML_render_objectives_key() { // display icon key at the bottom if (Lcl_gr) { gr_set_bitmap(Goal_complete_bitmap); gr_bitmap(Objective_key_icon_coords_gr[gr_screen.res][0][0], Objective_key_icon_coords_gr[gr_screen.res][0][1], GR_RESIZE_MENU); gr_set_bitmap(Goal_incomplete_bitmap); gr_bitmap(Objective_key_icon_coords_gr[gr_screen.res][1][0], Objective_key_icon_coords_gr[gr_screen.res][1][1], GR_RESIZE_MENU); gr_set_bitmap(Goal_failed_bitmap); gr_bitmap(Objective_key_icon_coords_gr[gr_screen.res][2][0], Objective_key_icon_coords_gr[gr_screen.res][2][1], GR_RESIZE_MENU); gr_string(Objective_key_text_coords_gr[gr_screen.res][0][0], Objective_key_text_coords_gr[gr_screen.res][0][1] , XSTR("Complete", 1437), GR_RESIZE_MENU); gr_string(Objective_key_text_coords_gr[gr_screen.res][1][0], Objective_key_text_coords_gr[gr_screen.res][1][1] , XSTR("Incomplete", 1438), GR_RESIZE_MENU); gr_string(Objective_key_text_coords_gr[gr_screen.res][2][0], Objective_key_text_coords_gr[gr_screen.res][2][1] , XSTR("Failed", 1439), GR_RESIZE_MENU); } else { gr_set_bitmap(Goal_complete_bitmap); gr_bitmap(Objective_key_icon_coords[gr_screen.res][0][0], Objective_key_icon_coords[gr_screen.res][0][1], GR_RESIZE_MENU); gr_set_bitmap(Goal_incomplete_bitmap); gr_bitmap(Objective_key_icon_coords[gr_screen.res][1][0], Objective_key_icon_coords[gr_screen.res][1][1], GR_RESIZE_MENU); gr_set_bitmap(Goal_failed_bitmap); gr_bitmap(Objective_key_icon_coords[gr_screen.res][2][0], Objective_key_icon_coords[gr_screen.res][2][1], GR_RESIZE_MENU); gr_string(Objective_key_text_coords[gr_screen.res][0][0], Objective_key_text_coords[gr_screen.res][0][1] , XSTR("Complete", 1437), GR_RESIZE_MENU); gr_string(Objective_key_text_coords[gr_screen.res][1][0], Objective_key_text_coords[gr_screen.res][1][1] , XSTR("Incomplete", 1438), GR_RESIZE_MENU); gr_string(Objective_key_text_coords[gr_screen.res][2][0], Objective_key_text_coords[gr_screen.res][2][1] , XSTR("Failed", 1439), GR_RESIZE_MENU); } }
void ML_render_objectives_key() { #ifndef MAKE_FS1 // display icon key at the bottom gr_set_bitmap(Goal_complete_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); if (Lcl_gr) { gr_bitmap(Objective_key_icon_coords_gr[gr_screen.res][0][0], Objective_key_icon_coords_gr[gr_screen.res][0][1]); gr_set_bitmap(Goal_incomplete_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); gr_bitmap(Objective_key_icon_coords_gr[gr_screen.res][1][0], Objective_key_icon_coords_gr[gr_screen.res][1][1]); gr_set_bitmap(Goal_failed_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); gr_bitmap(Objective_key_icon_coords_gr[gr_screen.res][2][0], Objective_key_icon_coords_gr[gr_screen.res][2][1]); gr_string(Objective_key_text_coords_gr[gr_screen.res][0][0], Objective_key_text_coords_gr[gr_screen.res][0][1] , XSTR("Complete", 1437)); gr_string(Objective_key_text_coords_gr[gr_screen.res][1][0], Objective_key_text_coords_gr[gr_screen.res][1][1] , XSTR("Incomplete", 1438)); gr_string(Objective_key_text_coords_gr[gr_screen.res][2][0], Objective_key_text_coords_gr[gr_screen.res][2][1] , XSTR("Failed", 1439)); } else { gr_set_bitmap(Goal_complete_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); gr_bitmap(Objective_key_icon_coords[gr_screen.res][0][0], Objective_key_icon_coords[gr_screen.res][0][1]); gr_set_bitmap(Goal_incomplete_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); gr_bitmap(Objective_key_icon_coords[gr_screen.res][1][0], Objective_key_icon_coords[gr_screen.res][1][1]); gr_set_bitmap(Goal_failed_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); gr_bitmap(Objective_key_icon_coords[gr_screen.res][2][0], Objective_key_icon_coords[gr_screen.res][2][1]); gr_string(Objective_key_text_coords[gr_screen.res][0][0], Objective_key_text_coords[gr_screen.res][0][1] , XSTR("Complete", 1437)); gr_string(Objective_key_text_coords[gr_screen.res][1][0], Objective_key_text_coords[gr_screen.res][1][1] , XSTR("Incomplete", 1438)); gr_string(Objective_key_text_coords[gr_screen.res][2][0], Objective_key_text_coords[gr_screen.res][2][1] , XSTR("Failed", 1439)); } #endif }
static void texpage_print_name( char name[13] ) { int w,h,aw; int i; for (i=strlen(name);i<12;i++) name[i]=' '; name[i]=0; gr_set_current_canvas( TmapnameCanvas ); gr_get_string_size( name, &w, &h, &aw ); gr_string( 0, 0, name ); }
void dc_draw(bool show_prompt = FALSE) { gr_clear(); gr_set_font(dc_font); gr_set_color_fast( &Color_bright ); gr_string( 0x8000, 3, dc_title.c_str(), GR_RESIZE_NONE ); gr_set_color_fast( &Color_normal ); dc_draw_window(show_prompt); gr_flip(); }
// Draw the button text nicely formatted in the popup void popupdead_draw_button_text() { int w,h,i,sx,sy; gr_set_color_fast(&Color_bright_blue); for ( i=0; i < Popupdead_num_choices; i++ ) { gr_get_string_size(&w, &h, Popupdead_button_text[i]); sx = Popupdead_region_coords[gr_screen.res][i][0]-w; sy = Popupdead_region_coords[gr_screen.res][i][1]+4; gr_string(sx, sy, Popupdead_button_text[i]); } }
// ---------------------------------------------------------------------------- // Writes a message on the HUD and checks its timer. void HUD_render_message_frame() { int i,j,y; HUD_toolong = 0; if (( HUD_nmessages < 0 ) || (HUD_nmessages > HUD_MAX_NUM_STOR)) Int3(); // Get Rob! if (HUD_nmessages < 1 ) return; for (i = 0; i < HUD_nmessages; i++) { HUD_messages[i].time -= FrameTime; // message expired - remove if (HUD_messages[i].time <= 0) { for (j = i; j < HUD_nmessages; j++) { if (j+1 < HUD_nmessages) memcpy(&HUD_messages[j], &HUD_messages[j+1], sizeof(struct hudmsg)); else memset(&HUD_messages[j], 0, sizeof(struct hudmsg)); } HUD_nmessages--; } } // display last $HUD_MAX_NUM_DISP messages on the list if (HUD_nmessages > 0 ) { int startmsg = ((HUD_nmessages-HUD_MAX_NUM_DISP<0)?0:HUD_nmessages-HUD_MAX_NUM_DISP); if (HUD_color == -1) HUD_color = BM_XRGB(0,28,0); gr_set_curfont( GAME_FONT ); y = FSPACY(1); for (i=startmsg; i<HUD_nmessages; i++ ) { gr_set_fontcolor( HUD_color, -1); if (i == startmsg && strlen(HUD_messages[i].message) > 38) HUD_toolong = 1; gr_string(0x8000,y, &HUD_messages[i].message[0] ); y += LINE_SPACING; } } gr_set_curfont( GAME_FONT ); }
void hud_show_mini_ship_integrity(object* objp, int x_force, int y_force) { char text_integrity[64]; int numeric_integrity; float p_target_integrity; int final_pos[2]; p_target_integrity = get_hull_pct(objp); numeric_integrity = fl2i(p_target_integrity * 100 + 0.5f); if (numeric_integrity > 100) { numeric_integrity = 100; } // Assert(numeric_integrity <= 100); // 3 digit hull strength if (numeric_integrity == 100) { memcpy(final_pos, current_hud->Hud_mini_3digit, sizeof(final_pos)); } // 1 digit hull strength else if (numeric_integrity < 10) { memcpy(final_pos, current_hud->Hud_mini_1digit, sizeof(final_pos)); } // 2 digit hull strength else { memcpy(final_pos, current_hud->Hud_mini_2digit, sizeof(final_pos)); } if (numeric_integrity == 0) { if (p_target_integrity > 0) { numeric_integrity = 1; } } final_pos[0] += fl2i(HUD_offset_x); final_pos[1] += fl2i(HUD_offset_y); sprintf(text_integrity, "%d", numeric_integrity); if (numeric_integrity < 100) { hud_num_make_mono(text_integrity); } gr_string(final_pos[0] + HUD_nose_x, final_pos[1] + HUD_nose_y, text_integrity); }
/** * Draws a character centered on x */ void gr_char_centered(int x, int y, char chr) { char str[2]; int w, sc; sc = Lcl_special_chars; if (chr == '1') chr = (char)(sc + 1); str[0] = chr; str[1] = 0; gr_get_string_size(&w, NULL, str); gr_string(x - w / 2, y, str); }
void pilot_manage_maybe_show_button_text() { pilot_manage_buttons *b; // skip the up/down arrows for (int i=0; i<PM_NUM_BUTTONS; i++) { b = &Buttons[gr_screen.res][i]; if (b->button.button_hilighted()) { gr_set_color_fast(&Color_bright_white); gr_string(Pilot_manage_text[gr_screen.res][i].x, Pilot_manage_text[gr_screen.res][i].y, Pilot_manage_text[gr_screen.res][i].xstr); } } }
void ui_wprintf( UI_WINDOW * wnd, char * format, ... ) { char buffer[1000]; va_list args; va_start(args, format ); vsprintf(buffer,format,args); gr_set_current_canvas( W_CANVAS ); ui_mouse_hide(); W_TEXT_X = gr_string( W_TEXT_X, W_TEXT_Y, buffer ); ui_mouse_show(); }