Pass canvas to gr_{,u}string
This commit is contained in:
parent
1ef6b9d5bc
commit
5da784dbed
|
@ -122,7 +122,7 @@ static void print_clock()
|
|||
gr_get_string_size(*grd_curcanv->cv_font, message.data(), &w, &h, nullptr);
|
||||
const uint8_t color = CGREY;
|
||||
gr_rect(*grd_curcanv, 700, 0, 799, h + 1, color);
|
||||
gr_string(700, 0, message.data());
|
||||
gr_string(*grd_curcanv, 700, 0, message.data());
|
||||
gr_set_fontcolor( CBLACK, CWHITE );
|
||||
}
|
||||
|
||||
|
|
|
@ -272,15 +272,15 @@ namespace dcx {
|
|||
void gr_remap_color_fonts();
|
||||
void gr_set_curfont(const grs_font *);
|
||||
void gr_set_fontcolor(int fg_color, int bg_color);
|
||||
void gr_string(int x, int y, const char *s);
|
||||
void gr_string(grs_canvas &, int x, int y, const char *s, int w, int h);
|
||||
void gr_ustring(int x, int y, const char *s);
|
||||
template <void (&)(int, int, const char *)>
|
||||
void gr_printt(int x, int y, const char *format, ...) __attribute_format_printf(3, 4);
|
||||
void gr_string(grs_canvas &, int x, int y, const char *s);
|
||||
void gr_ustring(grs_canvas &, int x, int y, const char *s);
|
||||
template <void (&)(grs_canvas &, int, int, const char *)>
|
||||
void gr_printt(grs_canvas &, int x, int y, const char *format, ...) __attribute_format_printf(4, 5);
|
||||
#define gr_printfs(...) gr_printt<gr_string>(__VA_ARGS__)
|
||||
#define gr_printfus(...) gr_printt<gr_ustring>(__VA_ARGS__)
|
||||
#define gr_printf(A1,A2,F,...) dxx_call_printf_checked(gr_printfs,gr_string,(A1,A2),(F),##__VA_ARGS__)
|
||||
#define gr_uprintf(A1,A2,F,...) dxx_call_printf_checked(gr_printfus,gr_ustring,(A1,A2),(F),##__VA_ARGS__)
|
||||
#define gr_printf(A1,A2,F,...) dxx_call_printf_checked(gr_printfs,gr_string,(*grd_curcanv,A1,A2),(F),##__VA_ARGS__)
|
||||
#define gr_uprintf(A1,A2,F,...) dxx_call_printf_checked(gr_printfus,gr_ustring,(*grd_curcanv,A1,A2),(F),##__VA_ARGS__)
|
||||
std::pair<const char *, unsigned> gr_get_string_wrap(const char *s, unsigned limit);
|
||||
void gr_get_string_size(const grs_font &, const char *s, int *string_width, int *string_height, int *average_width);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void ui_draw_checkbox( UI_DIALOG *dlg, UI_GADGET_CHECKBOX * checkbox )
|
|||
ui_string_centered( Middle(checkbox->width)+1, Middle(checkbox->height)+1, " " );
|
||||
}
|
||||
|
||||
gr_ustring(checkbox->width+4, 2, checkbox->text.get());
|
||||
gr_ustring(*grd_curcanv, checkbox->width + 4, 2, checkbox->text.get());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -475,7 +475,7 @@ void (ui_dprintf_at)( UI_DIALOG * dlg, short x, short y, const char * format, ..
|
|||
void ui_dputs_at( UI_DIALOG * dlg, short x, short y, const char * buffer )
|
||||
{
|
||||
ui_dialog_set_current_canvas( dlg );
|
||||
gr_string( x, y, buffer );
|
||||
gr_string(*grd_curcanv, x, y, buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ void ui_draw_icon( UI_GADGET_ICON * icon )
|
|||
}
|
||||
|
||||
gr_set_fontcolor( CBLACK, -1 );
|
||||
gr_ustring(x, y, icon->text.get());
|
||||
gr_ustring(*grd_curcanv, x, y, icon->text.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ void ui_pad_draw(UI_DIALOG *dlg, int x, int y)
|
|||
const uint8_t color = CWHITE;
|
||||
gr_urect(*grd_curcanv, desc_x, desc_y, desc_x+ 56*4-1, desc_y+15, color);
|
||||
gr_set_fontcolor( CBLACK, CWHITE );
|
||||
gr_ustring(desc_x, desc_y, KeyPad[active_pad]->description.data());
|
||||
gr_ustring(*grd_curcanv, desc_x, desc_y, KeyPad[active_pad]->description.data());
|
||||
}
|
||||
|
||||
static void ui_pad_set_active( int n )
|
||||
|
|
|
@ -110,14 +110,14 @@ static void item_show( MENU * menu, int n )
|
|||
if ( menu != &Menu[0] )
|
||||
{
|
||||
if ( menu->Active)
|
||||
gr_ustring(item->x+1, item->y+1, item->Text.get());
|
||||
gr_ustring(*grd_curcanv, item->x + 1, item->y + 1, item->Text.get());
|
||||
else
|
||||
gr_ustring(item->x+1, item->y+1, item->InactiveText.get());
|
||||
gr_ustring(*grd_curcanv, item->x + 1, item->y + 1, item->InactiveText.get());
|
||||
} else {
|
||||
if ( menu->Active)
|
||||
gr_ustring(item->x, item->y, item->Text.get());
|
||||
gr_ustring(*grd_curcanv, item->x, item->y, item->Text.get());
|
||||
else
|
||||
gr_ustring(item->x, item->y, item->InactiveText.get());
|
||||
gr_ustring(*grd_curcanv, item->x, item->y, item->InactiveText.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,7 @@ void ui_draw_radio( UI_DIALOG *dlg, UI_GADGET_RADIO * radio )
|
|||
else
|
||||
ui_string_centered(Middle(radio->width) + 1, Middle(radio->height) + 1, " ");
|
||||
}
|
||||
|
||||
gr_ustring(radio->width+4, 2, radio->text.get());
|
||||
gr_ustring(*grd_curcanv, radio->width + 4, 2, radio->text.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ void ui_string_centered( short x, short y, const char * s )
|
|||
|
||||
//baseline = height-grd_curcanv->cv_font->ft_baseline;
|
||||
|
||||
gr_ustring(x-((width-1)/2), y-((height-1)/2), s );
|
||||
|
||||
gr_ustring(*grd_curcanv, x - ((width - 1) / 2), y - ((height - 1) / 2), s);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1836,7 +1836,7 @@ void show_escort_menu(const array<char, 300> &amsg)
|
|||
|
||||
nm_draw_background(x-BORDERX,y-BORDERY,x+w+BORDERX,y+h+BORDERY);
|
||||
|
||||
gr_ustring( x, y, msg );
|
||||
gr_ustring(*grd_curcanv, x, y, msg);
|
||||
|
||||
reset_cockpit();
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ static window_event_result show_pause_message(window *, const d_event &event, co
|
|||
|
||||
gr_set_fontcolor( 255, -1 );
|
||||
|
||||
gr_ustring( 0x8000, y, msg );
|
||||
gr_ustring(*grd_curcanv, 0x8000, y, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ static void draw_subtitles(int frame_num)
|
|||
range_for (const auto &t, partial_range(active_subtitles, num_active_subtitles))
|
||||
if (t != -1)
|
||||
{
|
||||
gr_string(0x8000, y, Subtitles[t].msg);
|
||||
gr_string(*grd_curcanv, 0x8000, y, Subtitles[t].msg);
|
||||
y += line_spacing;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -689,11 +689,11 @@ static int gr_internal_color_string(grs_canvas &canvas, const int x, const int y
|
|||
}
|
||||
#endif //OGL
|
||||
|
||||
void gr_string(const int x, const int y, const char *const s)
|
||||
void gr_string(grs_canvas &canvas, const int x, const int y, const char *const s)
|
||||
{
|
||||
int w, h;
|
||||
gr_get_string_size(*grd_curcanv->cv_font, s, &w, &h, nullptr);
|
||||
gr_string(*grd_curcanv, x, y, s, w, h);
|
||||
gr_get_string_size(*canvas.cv_font, s, &w, &h, nullptr);
|
||||
gr_string(canvas, x, y, s, w, h);
|
||||
}
|
||||
|
||||
static void gr_ustring_mono(grs_canvas &canvas, const int x, const int y, const char *const s)
|
||||
|
@ -757,21 +757,21 @@ void gr_string(grs_canvas &canvas, const int x, const int y, const char *const s
|
|||
gr_internal_string_clipped(*grd_curcanv, x, y, s);
|
||||
}
|
||||
|
||||
void gr_ustring(int x, int y, const char *s )
|
||||
void gr_ustring(grs_canvas &canvas, const int x, const int y, const char *const s)
|
||||
{
|
||||
#if DXX_USE_OGL
|
||||
if (TYPE==bm_mode::ogl)
|
||||
if (canvas.cv_bitmap.get_type() == bm_mode::ogl)
|
||||
{
|
||||
ogl_internal_string(*grd_curcanv, x, y, s);
|
||||
ogl_internal_string(canvas, x, y, s);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (grd_curcanv->cv_font->ft_flags & FT_COLOR) {
|
||||
gr_internal_color_string(*grd_curcanv, x, y, s);
|
||||
if (canvas.cv_font->ft_flags & FT_COLOR) {
|
||||
gr_internal_color_string(canvas, x, y, s);
|
||||
}
|
||||
else
|
||||
gr_ustring_mono(*grd_curcanv, x, y, s);
|
||||
gr_ustring_mono(canvas, x, y, s);
|
||||
}
|
||||
|
||||
void gr_get_string_size(const grs_font &cv_font, const char *s, int *const string_width, int *const string_height, int *const average_width)
|
||||
|
@ -832,8 +832,8 @@ std::pair<const char *, unsigned> gr_get_string_wrap(const char *s, unsigned lim
|
|||
return {s, static_cast<unsigned>(string_width_f)};
|
||||
}
|
||||
|
||||
template <void (&F)(int, int, const char *)>
|
||||
void (gr_printt)(int x, int y, const char *format, ...)
|
||||
template <void (&F)(grs_canvas &, int, int, const char *)>
|
||||
void (gr_printt)(grs_canvas &canvas, const int x, const int y, const char *const format, ...)
|
||||
{
|
||||
char buffer[1000];
|
||||
va_list args;
|
||||
|
@ -841,11 +841,11 @@ void (gr_printt)(int x, int y, const char *format, ...)
|
|||
va_start(args, format );
|
||||
vsnprintf(buffer, sizeof(buffer), format, args);
|
||||
va_end(args);
|
||||
F(x, y, buffer);
|
||||
F(canvas, x, y, buffer);
|
||||
}
|
||||
|
||||
template void gr_printt<gr_string>(int, int, const char *, ...);
|
||||
template void gr_printt<gr_ustring>(int, int, const char *, ...);
|
||||
template void gr_printt<gr_string>(grs_canvas &, int, int, const char *, ...);
|
||||
template void gr_printt<gr_ustring>(grs_canvas &, int, int, const char *, ...);
|
||||
|
||||
void gr_close_font(std::unique_ptr<grs_font> font)
|
||||
{
|
||||
|
|
|
@ -815,20 +815,20 @@ void draw_world(grs_canvas *screen_canvas,editor_view *v,const vsegptridx_t mine
|
|||
// Label the window
|
||||
gr_set_fontcolor((v==current_view)?CRED:CWHITE, -1 );
|
||||
if ( screen_canvas == LargeViewBox->canvas.get() ) {
|
||||
gr_ustring( 5, 5, "USER VIEW" );
|
||||
gr_ustring(*grd_curcanv, 5, 5, "USER VIEW");
|
||||
switch (Large_view_index) {
|
||||
case 0: gr_ustring( 85, 5, "-- TOP"); break;
|
||||
case 1: gr_ustring( 85, 5, "-- FRONT"); break;
|
||||
case 2: gr_ustring( 85, 5, "-- RIGHT"); break;
|
||||
case 0: gr_ustring(*grd_curcanv, 85, 5, "-- TOP"); break;
|
||||
case 1: gr_ustring(*grd_curcanv, 85, 5, "-- FRONT"); break;
|
||||
case 2: gr_ustring(*grd_curcanv, 85, 5, "-- RIGHT"); break;
|
||||
}
|
||||
} else
|
||||
#if ORTHO_VIEWS
|
||||
else if ( screen_canvas == TopViewBox->canvas )
|
||||
gr_ustring( 5, 5, "TOP" );
|
||||
gr_ustring(*grd_curcanv, 5, 5, "TOP");
|
||||
else if ( screen_canvas == FrontViewBox->canvas )
|
||||
gr_ustring( 5, 5, "FRONT" );
|
||||
gr_ustring(*grd_curcanv, 5, 5, "FRONT");
|
||||
else if ( screen_canvas == RightViewBox->canvas )
|
||||
gr_ustring( 5, 5, "RIGHT" );
|
||||
gr_ustring(*grd_curcanv, 5, 5, "RIGHT");
|
||||
#else
|
||||
Error("Ortho views have been removed, what gives?\n");
|
||||
#endif
|
||||
|
|
|
@ -83,7 +83,7 @@ static void texpage_print_name(d_fname name)
|
|||
name.back() = 0;
|
||||
|
||||
gr_set_current_canvas( TmapnameCanvas );
|
||||
gr_string( 0, 0, name );
|
||||
gr_string(*grd_curcanv, 0, 0, name);
|
||||
}
|
||||
|
||||
//Redraw the list of textures, based on TexturePage
|
||||
|
|
|
@ -519,7 +519,7 @@ static void name_frame(automap *am)
|
|||
else
|
||||
name_level = Current_level_name;
|
||||
|
||||
gr_string((SWIDTH/64),(SHEIGHT/48),name_level);
|
||||
gr_string(*grd_curcanv, (SWIDTH/64),(SHEIGHT/48),name_level);
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
char name_level_right[128];
|
||||
if (Current_level_num > 0)
|
||||
|
@ -533,7 +533,7 @@ static void name_frame(automap *am)
|
|||
else
|
||||
snprintf(name_level_right, sizeof(name_level_right), " %s", current_level_name);
|
||||
|
||||
gr_string((SWIDTH/64),(SHEIGHT/48),name_level_left);
|
||||
gr_string(*grd_curcanv, (SWIDTH / 64), (SHEIGHT / 48), name_level_left);
|
||||
int wr,h;
|
||||
gr_get_string_size(*grd_curcanv->cv_font, name_level_right, &wr, &h, nullptr);
|
||||
gr_string(*grd_curcanv, grd_curcanv->cv_bitmap.bm_w-wr-(SWIDTH/64),(SHEIGHT/48),name_level_right, wr, h);
|
||||
|
@ -635,7 +635,7 @@ static void draw_automap(automap *am)
|
|||
else
|
||||
#endif
|
||||
x = SWIDTH / 8, y = SHEIGHT / 16;
|
||||
gr_string(x, y, TXT_AUTOMAP);
|
||||
gr_string(*grd_curcanv, x, y, TXT_AUTOMAP);
|
||||
}
|
||||
gr_set_curfont(GAME_FONT);
|
||||
gr_set_fontcolor(BM_XRGB(20, 20, 20), -1);
|
||||
|
@ -668,9 +668,9 @@ static void draw_automap(automap *am)
|
|||
y1 = SHEIGHT / 1.083;
|
||||
y2 = SHEIGHT / 1.043;
|
||||
#endif
|
||||
gr_string(x, y0, TXT_TURN_SHIP);
|
||||
gr_string(x, y1, s1);
|
||||
gr_string(x, y2, s2);
|
||||
gr_string(*grd_curcanv, x, y0, TXT_TURN_SHIP);
|
||||
gr_string(*grd_curcanv, x, y1, s1);
|
||||
gr_string(*grd_curcanv, x, y2, s2);
|
||||
}
|
||||
|
||||
gr_set_current_canvas(&am->automap_view);
|
||||
|
|
|
@ -191,7 +191,7 @@ static void con_draw(void)
|
|||
gr_rect(*grd_curcanv, 0, 0, SWIDTH, line_spacing, color);
|
||||
gr_set_fontcolor(BM_XRGB(255,255,255),-1);
|
||||
gr_printf(fspacx1, fspacy1, "%s LOG", DESCENT_VERSION);
|
||||
gr_string(SWIDTH - fspacx(110), fspacy1, "PAGE-UP/DOWN TO SCROLL");
|
||||
gr_string(*grd_curcanv, SWIDTH - fspacx(110), fspacy1, "PAGE-UP/DOWN TO SCROLL");
|
||||
}
|
||||
|
||||
static window_event_result con_handler(window *wind,const d_event &event, const unused_window_userdata_t *)
|
||||
|
|
|
@ -205,7 +205,7 @@ static window_event_result credits_handler(window *, const d_event &event, credi
|
|||
const auto tempp = strchr( s, '\t' );
|
||||
if ( !tempp ) {
|
||||
// Wacky Fast Credits thing
|
||||
gr_string( 0x8000, y, s );
|
||||
gr_string(*grd_curcanv, 0x8000, y, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -525,7 +525,7 @@ static int HandleDemoKey(int key)
|
|||
gr_set_current_canvas(NULL);
|
||||
render_frame(0);
|
||||
gr_set_curfont(MEDIUM2_FONT);
|
||||
gr_string(SWIDTH-FSPACX(92),SHEIGHT-LINE_SPACING,"DXX-Rebirth\n");
|
||||
gr_string(*grd_curcanv, SWIDTH - FSPACX(92), SHEIGHT - LINE_SPACING, "DXX-Rebirth\n");
|
||||
gr_flip();
|
||||
save_screen_shot(0);
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ static window_event_result HandleSystemKey(int key)
|
|||
gr_set_current_canvas(NULL);
|
||||
render_frame(0);
|
||||
gr_set_curfont(MEDIUM2_FONT);
|
||||
gr_string(SWIDTH-FSPACX(92),SHEIGHT-LINE_SPACING,"DXX-Rebirth\n");
|
||||
gr_string(*grd_curcanv, SWIDTH - FSPACX(92), SHEIGHT - LINE_SPACING, "DXX-Rebirth\n");
|
||||
gr_flip();
|
||||
save_screen_shot(0);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ static void show_netplayerinfo()
|
|||
// general game information
|
||||
const auto &&line_spacing = LINE_SPACING;
|
||||
y += line_spacing;
|
||||
gr_string(0x8000,y,Netgame.game_name.data());
|
||||
gr_string(*grd_curcanv, 0x8000, y, Netgame.game_name.data());
|
||||
y += line_spacing;
|
||||
gr_printf(0x8000, y, "%s - lvl: %i", Netgame.mission_title.data(), Netgame.levelnum);
|
||||
|
||||
|
@ -177,13 +177,13 @@ static void show_netplayerinfo()
|
|||
|
||||
// player information (name, kills, ping, game efficiency)
|
||||
y += line_spacing * 2;
|
||||
gr_string(x,y,"player");
|
||||
gr_string(x + fspacx8 * 7, y, ((Game_mode & GM_MULTI_COOP)
|
||||
gr_string(*grd_curcanv, x, y, "player");
|
||||
gr_string(*grd_curcanv, x + fspacx8 * 7, y, ((Game_mode & GM_MULTI_COOP)
|
||||
? "score"
|
||||
: (gr_string(x + fspacx8 * 12, y, "deaths"), "kills")
|
||||
: (gr_string(*grd_curcanv, x + fspacx8 * 12, y, "deaths"), "kills")
|
||||
));
|
||||
gr_string(x + fspacx8 * 18, y, "ping");
|
||||
gr_string(x + fspacx8 * 23, y, "efficiency");
|
||||
gr_string(*grd_curcanv, x + fspacx8 * 18, y, "ping");
|
||||
gr_string(*grd_curcanv, x + fspacx8 * 23, y, "efficiency");
|
||||
|
||||
// process players table
|
||||
for (uint_fast32_t i = 0; i < MAX_PLAYERS; i++)
|
||||
|
@ -218,8 +218,8 @@ static void show_netplayerinfo()
|
|||
if (Game_mode & GM_TEAM)
|
||||
{
|
||||
gr_set_fontcolor(255,-1);
|
||||
gr_string(x,y,"team");
|
||||
gr_string(x + fspacx8 * 8, y, "score");
|
||||
gr_string(*grd_curcanv, x, y, "team");
|
||||
gr_string(*grd_curcanv, x + fspacx8 * 8, y, "score");
|
||||
y += line_spacing;
|
||||
gr_set_fontcolor(BM_XRGB(player_rgb[0].r,player_rgb[0].g,player_rgb[0].b),-1 );
|
||||
gr_printf(x,y,"%s:",static_cast<const char *>(Netgame.team_name[0]));
|
||||
|
@ -241,7 +241,7 @@ static void show_netplayerinfo()
|
|||
if (game_mode_hoard())
|
||||
{
|
||||
if (PhallicMan==-1)
|
||||
gr_string(0x8000,y,"There is no record yet for this level.");
|
||||
gr_string(*grd_curcanv, 0x8000, y, "There is no record yet for this level.");
|
||||
else
|
||||
gr_printf(0x8000,y,"%s has the record at %d points.", static_cast<const char *>(Players[PhallicMan].callsign), PhallicLimit);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ static void show_netplayerinfo()
|
|||
if (eff<60)
|
||||
gr_printf(0x8000,y,"is %s your ranking.",eff_strings[eff/10]);
|
||||
else
|
||||
gr_string(0x8000,y,"is serving you well.");
|
||||
gr_string(*grd_curcanv, 0x8000, y, "is serving you well.");
|
||||
y += line_spacing;
|
||||
gr_printf(0x8000,y,"your rank is: %s",RankStrings[GetMyNetRanking()]);
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ void game_render_frame_mono()
|
|||
gr_set_curfont( GAME_FONT );
|
||||
gr_set_fontcolor( BM_XRGB(27,0,0), -1 );
|
||||
|
||||
gr_string(0x8000, FSPACY(1), "Guided Missile View");
|
||||
gr_string(*grd_curcanv, 0x8000, FSPACY(1), "Guided Missile View");
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
show_reticle(player_info, RET_TYPE_CROSS_V1, 0);
|
||||
|
|
|
@ -880,7 +880,7 @@ static void hud_show_homing_warning(const int homing_object_dist)
|
|||
if (GameTime64 & 0x4000) {
|
||||
gr_set_curfont( GAME_FONT );
|
||||
gr_set_fontcolor(BM_XRGB(0,31,0),-1 );
|
||||
gr_string(0x8000, grd_curcanv->cv_bitmap.bm_h-LINE_SPACING,TXT_LOCK);
|
||||
gr_string(*grd_curcanv, 0x8000, grd_curcanv->cv_bitmap.bm_h - LINE_SPACING,TXT_LOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1562,7 +1562,7 @@ static void hud_show_cloak_invuln(const player_flags player_flags, const fix64 c
|
|||
if (cloak_invul_timer)
|
||||
gr_printf(fspacx1, y, "%s: %lu", txt, static_cast<unsigned long>(effect_end / F1_0));
|
||||
else
|
||||
gr_string(fspacx1, y, txt);
|
||||
gr_string(*grd_curcanv, fspacx1, y, txt);
|
||||
};
|
||||
|
||||
if (player_flags & PLAYER_FLAGS_CLOAKED)
|
||||
|
@ -2220,7 +2220,7 @@ static void draw_weapon_info_sub(const player_info &player_info, const int info_
|
|||
{
|
||||
gr_set_fontcolor(BM_XRGB(0,20,0),-1 );
|
||||
|
||||
gr_string(text_x,text_y,name);
|
||||
gr_string(*grd_curcanv, text_x, text_y, name);
|
||||
|
||||
// For laser, show level and quadness
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
|
@ -2232,7 +2232,7 @@ static void draw_weapon_info_sub(const player_info &player_info, const int info_
|
|||
const auto &&line_spacing = LINE_SPACING;
|
||||
gr_printf(text_x, text_y + line_spacing, "%s: %i", TXT_LVL, player_info.laser_level + 1);
|
||||
if (player_info.powerup_flags & PLAYER_FLAGS_QUAD_LASERS)
|
||||
gr_string(text_x, text_y + (line_spacing * 2), TXT_QUAD);
|
||||
gr_string(*grd_curcanv, text_x, text_y + (line_spacing * 2), TXT_QUAD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3314,7 +3314,7 @@ void draw_hud(const object &plrobj)
|
|||
HUD_render_message_frame();
|
||||
gr_set_curfont( GAME_FONT );
|
||||
gr_set_fontcolor(BM_XRGB(0,31,0),-1 );
|
||||
gr_string(0x8000,GHEIGHT-LINE_SPACING,TXT_REAR_VIEW);
|
||||
gr_string(*grd_curcanv, 0x8000, GHEIGHT - LINE_SPACING, TXT_REAR_VIEW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3522,7 +3522,7 @@ void do_cockpit_window_view(const int win, const vobjptr_t viewer, const int rea
|
|||
if (Color_0_31_0 == -1)
|
||||
Color_0_31_0 = BM_XRGB(0,31,0);
|
||||
gr_set_fontcolor(Color_0_31_0, -1);
|
||||
gr_string(0x8000,FSPACY(1),label);
|
||||
gr_string(*grd_curcanv, 0x8000, FSPACY(1), label);
|
||||
}
|
||||
|
||||
if (user == WBU_GUIDED)
|
||||
|
|
|
@ -119,7 +119,7 @@ void HUD_render_message_frame()
|
|||
for (; i != e; ++i ) {
|
||||
gr_set_fontcolor( HUD_color, -1);
|
||||
|
||||
gr_string(0x8000,y, &i->message[0] );
|
||||
gr_string(*grd_curcanv, 0x8000, y, &i->message[0]);
|
||||
y += line_spacing;
|
||||
}
|
||||
}
|
||||
|
@ -268,6 +268,6 @@ void player_dead_message(void)
|
|||
if (HUD_color == -1)
|
||||
HUD_color = BM_XRGB(0,28,0);
|
||||
gr_set_fontcolor( HUD_color, -1);
|
||||
gr_string(0x8000, GHEIGHT - LINE_SPACING, PlayerCfg.RespawnMode == RespawnPress::Any ? TXT_PRESS_ANY_KEY : "Press fire key or button to continue...");
|
||||
gr_string(*grd_curcanv, 0x8000, GHEIGHT - LINE_SPACING, PlayerCfg.RespawnMode == RespawnPress::Any ? TXT_PRESS_ANY_KEY : "Press fire key or button to continue...");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -890,11 +890,11 @@ static void kconfig_draw(kc_menu *menu)
|
|||
gr_set_curfont(MEDIUM3_FONT);
|
||||
|
||||
Assert(!strchr( menu->title, '\n' ));
|
||||
gr_string(0x8000, fspacy(8), menu->title);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(8), menu->title);
|
||||
|
||||
gr_set_curfont(GAME_FONT);
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
gr_string(0x8000, fspacy(21), "Enter changes, ctrl-d deletes, ctrl-r resets defaults, ESC exits");
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(21), "Enter changes, ctrl-d deletes, ctrl-r resets defaults, ESC exits");
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
|
||||
if ( menu->items == kc_keyboard )
|
||||
|
@ -924,11 +924,11 @@ static void kconfig_draw(kc_menu *menu)
|
|||
{
|
||||
gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK
|
||||
gr_string(0x8000, fspacy(30), TXT_BUTTONS);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(30), TXT_BUTTONS);
|
||||
#endif
|
||||
#if DXX_MAX_AXES_PER_JOYSTICK
|
||||
const auto &&fspacy145 = fspacy(145);
|
||||
gr_string(0x8000, fspacy(137), TXT_AXES);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(137), TXT_AXES);
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
kc_gr_2y_string(TXT_AXIS, fspacy145, fspacx(81), fspacx(230));
|
||||
kc_gr_2y_string(TXT_INVERT, fspacy145, fspacx(111), fspacx(260));
|
||||
|
@ -961,8 +961,8 @@ static void kconfig_draw(kc_menu *menu)
|
|||
else if ( menu->items == kc_mouse )
|
||||
{
|
||||
gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
|
||||
gr_string(0x8000, fspacy(35), TXT_BUTTONS);
|
||||
gr_string(0x8000, fspacy(137), TXT_AXES);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(35), TXT_BUTTONS);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(137), TXT_AXES);
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
const auto &&fspacy145 = fspacy(145);
|
||||
kc_gr_2y_string(TXT_AXIS, fspacy145, fspacx( 87), fspacx(242));
|
||||
|
@ -973,11 +973,11 @@ static void kconfig_draw(kc_menu *menu)
|
|||
gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
|
||||
|
||||
const auto &&fspacy60 = fspacy(60);
|
||||
gr_string(fspacx(152), fspacy60, "KEYBOARD");
|
||||
gr_string(*grd_curcanv, fspacx(152), fspacy60, "KEYBOARD");
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK
|
||||
gr_string(fspacx(210), fspacy60, "JOYSTICK");
|
||||
gr_string(*grd_curcanv, fspacx(210), fspacy60, "JOYSTICK");
|
||||
#endif
|
||||
gr_string(fspacx(273), fspacy60, "MOUSE");
|
||||
gr_string(*grd_curcanv, fspacx(273), fspacy60, "MOUSE");
|
||||
}
|
||||
|
||||
unsigned citem = menu->citem;
|
||||
|
@ -1023,7 +1023,7 @@ static void kconfig_draw(kc_menu *menu)
|
|||
break;
|
||||
}
|
||||
if (s)
|
||||
gr_string(0x8000, fspacy(INFO_Y), s);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(INFO_Y), s);
|
||||
kc_drawquestion( menu, &menu->items[menu->citem] );
|
||||
}
|
||||
|
||||
|
@ -1364,7 +1364,7 @@ static void kc_drawinput(const kc_item &item, kc_mitem& mitem, int is_current, c
|
|||
else
|
||||
r = 15 * 2, g = 15 * 2, b = 24 * 2;
|
||||
gr_set_fontcolor(gr_find_closest_color(r, g, b), -1);
|
||||
gr_string(fspacx(item.x), fspacy(item.y), label);
|
||||
gr_string(*grd_curcanv, fspacx(item.x), fspacy(item.y), label);
|
||||
}
|
||||
|
||||
btext = get_item_text(item, mitem, buf);
|
||||
|
|
|
@ -75,7 +75,7 @@ static void kmatrix_draw_item(int i, playernum_array_t &sorted)
|
|||
|
||||
y = FSPACY(50+i*9);
|
||||
const auto &&fspacx = FSPACX();
|
||||
gr_string(fspacx(CENTERING_OFFSET(N_players)), y, static_cast<const char *>(Players[sorted[i]].callsign));
|
||||
gr_string(*grd_curcanv, fspacx(CENTERING_OFFSET(N_players)), y, static_cast<const char *>(Players[sorted[i]].callsign));
|
||||
|
||||
const auto &&rgb10 = BM_XRGB(10, 10, 10);
|
||||
const auto &&rgb25 = BM_XRGB(25, 25, 25);
|
||||
|
@ -89,7 +89,7 @@ static void kmatrix_draw_item(int i, playernum_array_t &sorted)
|
|||
if (kmij == 0)
|
||||
{
|
||||
gr_set_fontcolor(rgb10, -1);
|
||||
gr_string(x, y, "0");
|
||||
gr_string(*grd_curcanv, x, y, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ static void kmatrix_draw_names(playernum_array_t &sorted)
|
|||
|
||||
x = fspacx(72 + CENTERING_OFFSET(N_players) + N_players * 25);
|
||||
gr_set_fontcolor(rgb31, -1);
|
||||
gr_string(x, fspacy(40), "K/E");
|
||||
gr_string(*grd_curcanv, x, fspacy(40), "K/E");
|
||||
}
|
||||
|
||||
static void kmatrix_draw_coop_names(playernum_array_t &)
|
||||
|
@ -153,8 +153,8 @@ static void kmatrix_draw_coop_names(playernum_array_t &)
|
|||
gr_set_fontcolor( BM_XRGB(63,31,31),-1 );
|
||||
const auto &&fspacy40 = FSPACY(40);
|
||||
const auto centerscreen = CENTERSCREEN;
|
||||
gr_string(centerscreen, fspacy40, "SCORE");
|
||||
gr_string(centerscreen + FSPACX(50), fspacy40, "DEATHS");
|
||||
gr_string(*grd_curcanv, centerscreen, fspacy40, "SCORE");
|
||||
gr_string(*grd_curcanv, centerscreen + FSPACX(50), fspacy40, "DEATHS");
|
||||
}
|
||||
|
||||
static void kmatrix_status_msg (fix time, int reactor)
|
||||
|
@ -207,7 +207,7 @@ static void kmatrix_redraw(kmatrix_screen *km)
|
|||
:
|
||||
#endif
|
||||
TXT_KILL_MATRIX_TITLE;
|
||||
gr_string(0x8000, FSPACY(10), title);
|
||||
gr_string(*grd_curcanv, 0x8000, FSPACY(10), title);
|
||||
|
||||
gr_set_curfont(GAME_FONT);
|
||||
multi_get_kill_list(sorted);
|
||||
|
@ -237,7 +237,7 @@ static void kmatrix_redraw_coop()
|
|||
|
||||
multi_sort_kill_list();
|
||||
gr_set_curfont(MEDIUM3_FONT);
|
||||
gr_string( 0x8000, FSPACY(10), "COOPERATIVE SUMMARY");
|
||||
gr_string(*grd_curcanv, 0x8000, FSPACY(10), "COOPERATIVE SUMMARY");
|
||||
gr_set_curfont(GAME_FONT);
|
||||
multi_get_kill_list(sorted);
|
||||
kmatrix_draw_coop_names(sorted);
|
||||
|
@ -264,7 +264,7 @@ static void kmatrix_redraw_coop()
|
|||
gr_set_fontcolor(gr_find_closest_color(r, g, b), -1);
|
||||
|
||||
const auto &&y = fspacy(50 + i * 9);
|
||||
gr_string(x_callsign, y, static_cast<const char *>(plr.callsign));
|
||||
gr_string(*grd_curcanv, x_callsign, y, static_cast<const char *>(plr.callsign));
|
||||
gr_set_fontcolor(rgb60_40_10, -1);
|
||||
auto &player_info = vcobjptr(plr.objnum)->ctype.player_info;
|
||||
gr_printf(x_centerscreen, y, "%d", player_info.mission.score);
|
||||
|
|
|
@ -458,9 +458,9 @@ static void draw_copyright()
|
|||
gr_set_curfont(GAME_FONT);
|
||||
gr_set_fontcolor(BM_XRGB(6,6,6),-1);
|
||||
const auto &&line_spacing = LINE_SPACING;
|
||||
gr_string(0x8000, SHEIGHT - line_spacing, TXT_COPYRIGHT);
|
||||
gr_string(*grd_curcanv, 0x8000, SHEIGHT - line_spacing, TXT_COPYRIGHT);
|
||||
gr_set_fontcolor( BM_XRGB(25,0,0), -1);
|
||||
gr_string(0x8000, SHEIGHT - (line_spacing * 2), DESCENT_VERSION);
|
||||
gr_string(*grd_curcanv, 0x8000, SHEIGHT - (line_spacing * 2), DESCENT_VERSION);
|
||||
}
|
||||
|
||||
namespace dsx {
|
||||
|
|
|
@ -248,7 +248,7 @@ class basic_show_rule_label
|
|||
public:
|
||||
static void show_item(int x1, int y, const char *label, int /* x2 */, const char * /* value */)
|
||||
{
|
||||
gr_string(x1, y, label);
|
||||
gr_string(*grd_curcanv, x1, y, label);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -257,7 +257,7 @@ class basic_show_rule_value
|
|||
public:
|
||||
static void show_item(int /* x1 */, int y, const char * /*label */, int x2, const char *value)
|
||||
{
|
||||
gr_string(x2, y, value);
|
||||
gr_string(*grd_curcanv, x2, y, value);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ static void nm_string( int w1,int x, int y, const char * s, int tabs_flag)
|
|||
}
|
||||
}
|
||||
else
|
||||
gr_string(x, y, s2.get());
|
||||
gr_string(*grd_curcanv, x, y, s2.get());
|
||||
|
||||
if (!tabs_flag && p && (w1>0) ) {
|
||||
int w, h;
|
||||
|
@ -283,7 +283,7 @@ static void nm_string_slider( int w1,int x, int y, char * s )
|
|||
s1 = p+1;
|
||||
}
|
||||
|
||||
gr_string( x, y, s );
|
||||
gr_string(*grd_curcanv, x, y, s);
|
||||
|
||||
if (p) {
|
||||
int w, h;
|
||||
|
@ -353,7 +353,7 @@ static void nm_string_inputbox( int w, int x, int y, const char * text, int curr
|
|||
nm_string_black( w, x, y, text );
|
||||
|
||||
if ( current && timer_query() & 0x8000 )
|
||||
gr_string( x+w1, y, CURSOR_STRING );
|
||||
gr_string(*grd_curcanv, x+w1, y, CURSOR_STRING);
|
||||
}
|
||||
|
||||
static void draw_item( newmenu_item *item, int is_current, int tiny, int tabs_flag, int scroll_offset )
|
||||
|
@ -1472,7 +1472,7 @@ static window_event_result newmenu_draw(window *wind, newmenu *menu)
|
|||
if ( menu->subtitle ) {
|
||||
gr_set_curfont(MEDIUM3_FONT);
|
||||
gr_set_fontcolor( BM_XRGB(21,21,21), -1 );
|
||||
gr_string( 0x8000, ty+th, menu->subtitle );
|
||||
gr_string(*grd_curcanv, 0x8000, ty + th, menu->subtitle);
|
||||
}
|
||||
|
||||
gr_set_curfont(menu->tiny_mode?GAME_FONT:MEDIUM1_FONT);
|
||||
|
@ -1493,12 +1493,12 @@ static window_event_result newmenu_draw(window *wind, newmenu *menu)
|
|||
const auto &&fspacx = FSPACX();
|
||||
sx = BORDERX - fspacx(12);
|
||||
|
||||
gr_string(sx, sy, menu->scroll_offset ? UP_ARROW_MARKER : " ");
|
||||
gr_string(*grd_curcanv, sx, sy, menu->scroll_offset ? UP_ARROW_MARKER : " ");
|
||||
|
||||
sy = menu->items[menu->scroll_offset + menu->max_displayable - 1].y - (line_spacing * menu->scroll_offset);
|
||||
sx = BORDERX - fspacx(12);
|
||||
|
||||
gr_string(sx, sy, (menu->scroll_offset + menu->max_displayable < menu->nitems) ? DOWN_ARROW_MARKER : " ");
|
||||
gr_string(*grd_curcanv, sx, sy, (menu->scroll_offset + menu->max_displayable < menu->nitems) ? DOWN_ARROW_MARKER : " ");
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1956,7 +1956,7 @@ static window_event_result listbox_draw(window *, listbox *lb)
|
|||
gr_set_current_canvas(NULL);
|
||||
nm_draw_background( lb->box_x-BORDERX,lb->box_y-lb->title_height-BORDERY,lb->box_x+lb->box_w+BORDERX,lb->box_y+lb->height+BORDERY );
|
||||
gr_set_curfont(MEDIUM3_FONT);
|
||||
gr_string( 0x8000, lb->box_y - lb->title_height, lb->title );
|
||||
gr_string(*grd_curcanv, 0x8000, lb->box_y - lb->title_height, lb->title);
|
||||
|
||||
const auto &&line_spacing = LINE_SPACING;
|
||||
for (i=lb->first_item; i<lb->first_item+LB_ITEMS_ON_SCREEN; i++ ) {
|
||||
|
@ -2017,7 +2017,7 @@ static window_event_result listbox_draw(window *, listbox *lb)
|
|||
{
|
||||
showstr = lb->item[i];
|
||||
}
|
||||
gr_string(lb->box_x + fspacx(5), y, showstr);
|
||||
gr_string(*grd_curcanv, lb->box_x + fspacx(5), y, showstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -315,14 +315,14 @@ static void scores_draw_item( int i, stats_info * stats )
|
|||
const auto &&fspacx66 = fspacx(66);
|
||||
const auto &&fspacy_y = FSPACY(y);
|
||||
if (strlen(stats->name)==0) {
|
||||
gr_string(fspacx66, fspacy_y, TXT_EMPTY);
|
||||
gr_string(*grd_curcanv, fspacx66, fspacy_y, TXT_EMPTY);
|
||||
return;
|
||||
}
|
||||
gr_string(fspacx66, fspacy_y, stats->name);
|
||||
gr_string(*grd_curcanv, fspacx66, fspacy_y, stats->name);
|
||||
int_to_string(stats->score, buffer);
|
||||
scores_rputs( 149, y, buffer );
|
||||
|
||||
gr_string(fspacx(166), fspacy_y, MENU_DIFFICULTY_TEXT(stats->diff_level));
|
||||
gr_string(*grd_curcanv, fspacx(166), fspacy_y, MENU_DIFFICULTY_TEXT(stats->diff_level));
|
||||
|
||||
if ( (stats->starting_level > 0 ) && (stats->ending_level > 0 ))
|
||||
scores_rprintf( 232, y, "%d-%d", stats->starting_level, stats->ending_level );
|
||||
|
@ -407,17 +407,17 @@ static window_event_result scores_handler(window *wind,const d_event &event, sco
|
|||
|
||||
gr_set_current_canvas(window_get_canvas(*wind));
|
||||
gr_set_curfont(MEDIUM3_FONT);
|
||||
gr_string(0x8000, fspacy(15), TXT_HIGH_SCORES);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(15), TXT_HIGH_SCORES);
|
||||
gr_set_curfont(GAME_FONT);
|
||||
gr_set_fontcolor( BM_XRGB(31,26,5), -1 );
|
||||
gr_string(fspacx( 71), fspacy(50), TXT_NAME);
|
||||
gr_string(fspacx(122), fspacy(50), TXT_SCORE);
|
||||
gr_string(fspacx(167), fspacy(50), TXT_SKILL);
|
||||
gr_string(fspacx(210), fspacy(50), TXT_LEVELS);
|
||||
gr_string(fspacx(253), fspacy(50), TXT_TIME);
|
||||
gr_string(*grd_curcanv, fspacx( 71), fspacy(50), TXT_NAME);
|
||||
gr_string(*grd_curcanv, fspacx(122), fspacy(50), TXT_SCORE);
|
||||
gr_string(*grd_curcanv, fspacx(167), fspacy(50), TXT_SKILL);
|
||||
gr_string(*grd_curcanv, fspacx(210), fspacy(50), TXT_LEVELS);
|
||||
gr_string(*grd_curcanv, fspacx(253), fspacy(50), TXT_TIME);
|
||||
|
||||
if ( menu->citem < 0 )
|
||||
gr_string(0x8000, fspacy(175), TXT_PRESS_CTRL_R);
|
||||
gr_string(*grd_curcanv, 0x8000, fspacy(175), TXT_PRESS_CTRL_R);
|
||||
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
|
||||
|
|
|
@ -987,7 +987,7 @@ static void redraw_messagestream(const msgstream &stream, unsigned &lastcolor)
|
|||
lastcolor = stream.color;
|
||||
gr_set_fontcolor(stream.color,-1);
|
||||
}
|
||||
gr_string(stream.x+1,stream.y,msgbuf);
|
||||
gr_string(*grd_curcanv, stream.x + 1, stream.y, msgbuf);
|
||||
}
|
||||
|
||||
static void flash_cursor(briefing *br, int cursor_flag)
|
||||
|
@ -997,7 +997,7 @@ static void flash_cursor(briefing *br, int cursor_flag)
|
|||
|
||||
gr_set_fontcolor((timer_query() % (F1_0 / 2)) > F1_0 / 4 ? Briefing_text_colors[Current_color] : Erase_color, -1);
|
||||
|
||||
gr_string(br->text_x, br->text_y, "_" );
|
||||
gr_string(*grd_curcanv, br->text_x, br->text_y, "_");
|
||||
}
|
||||
|
||||
#define EXIT_DOOR_MAX 14
|
||||
|
@ -1549,7 +1549,7 @@ static window_event_result briefing_handler(window *, const d_event &event, brie
|
|||
if (br->new_page || br->new_screen)
|
||||
flash_cursor(br, br->flashing_cursor);
|
||||
else if (br->flashing_cursor)
|
||||
gr_string(br->text_x, br->text_y, "_");
|
||||
gr_string(*grd_curcanv, br->text_x, br->text_y, "_");
|
||||
break;
|
||||
|
||||
case EVENT_WINDOW_CLOSE:
|
||||
|
|
Loading…
Reference in a new issue