Pass grs_font& to gr_set_curfont
This commit is contained in:
parent
916eb7a0f9
commit
c1d6150015
|
@ -281,7 +281,7 @@ namespace dcx {
|
|||
|
||||
//remap (by re-reading) all the color fonts
|
||||
void gr_remap_color_fonts();
|
||||
void gr_set_curfont(grs_canvas &, const grs_font *);
|
||||
void gr_set_curfont(grs_canvas &, const grs_font &);
|
||||
void gr_string(grs_canvas &, const grs_font &, int x, int y, const char *s, int w, int h);
|
||||
void gr_string(grs_canvas &, const grs_font &, int x, int y, const char *s);
|
||||
void gr_ustring(grs_canvas &, const grs_font &, int x, int y, const char *s);
|
||||
|
|
|
@ -336,12 +336,6 @@ struct font_delete
|
|||
};
|
||||
}
|
||||
|
||||
// Writes a string using current font. Returns the next column after last char.
|
||||
static inline void gr_set_curfont(grs_canvas &canvas, const grs_font_ptr &p)
|
||||
{
|
||||
gr_set_curfont(canvas, p.get());
|
||||
}
|
||||
|
||||
static inline void (gr_set_current_canvas)(grs_canvas_ptr &canv DXX_DEBUG_CURRENT_CANVAS_FILE_LINE_COMMA_L_DECL_VARS)
|
||||
{
|
||||
(gr_set_current_canvas)(canv.get() DXX_DEBUG_CURRENT_CANVAS_FILE_LINE_COMMA_L_PASS_VARS);
|
||||
|
|
|
@ -618,7 +618,7 @@ static void draw_subtitles(const d_subtitle_state &SubtitleState, const int fram
|
|||
if (frame_num == 0) {
|
||||
num_active_subtitles = 0;
|
||||
next_subtitle = 0;
|
||||
gr_set_curfont(*grd_curcanv, GAME_FONT);
|
||||
gr_set_curfont(*grd_curcanv, *GAME_FONT);
|
||||
gr_set_fontcolor(*grd_curcanv, 255, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1079,9 +1079,9 @@ void gr_remap_font(grs_font *font, const char *fontname)
|
|||
#endif
|
||||
}
|
||||
|
||||
void gr_set_curfont(grs_canvas &canvas, const grs_font *n)
|
||||
void gr_set_curfont(grs_canvas &canvas, const grs_font &n)
|
||||
{
|
||||
canvas.cv_font = n;
|
||||
canvas.cv_font = &n;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -442,7 +442,7 @@ void init_editor()
|
|||
current_view = &LargeView;
|
||||
|
||||
gr_set_current_canvas( GameViewBox->canvas );
|
||||
gr_set_curfont(*grd_curcanv, editor_font);
|
||||
gr_set_curfont(*grd_curcanv, *editor_font);
|
||||
// No font scaling!
|
||||
FNTScaleX.reset(1);
|
||||
FNTScaleY.reset(1);
|
||||
|
@ -756,7 +756,7 @@ static void init_editor_screen(grs_canvas &canvas)
|
|||
CBRIGHT = gr_find_closest_color( 60, 60, 60 );
|
||||
CRED = gr_find_closest_color( 63, 0, 0 );
|
||||
|
||||
gr_set_curfont(canvas, editor_font);
|
||||
gr_set_curfont(canvas, *editor_font);
|
||||
gr_set_fontcolor(canvas, CBLACK, CWHITE);
|
||||
|
||||
EditorWindow = window_create<editor_dialog>(0, 0, ED_SCREEN_W, ED_SCREEN_H, DF_FILLED);
|
||||
|
|
|
@ -231,7 +231,7 @@ int texpage_do(const d_event &event)
|
|||
if (event.type == EVENT_UI_DIALOG_DRAW)
|
||||
{
|
||||
gr_set_current_canvas( TmapnameCanvas );
|
||||
gr_set_curfont(*grd_curcanv, ui_small_font.get());
|
||||
gr_set_curfont(*grd_curcanv, *ui_small_font.get());
|
||||
gr_set_fontcolor(*grd_curcanv, CBLACK, CWHITE);
|
||||
|
||||
texpage_redraw();
|
||||
|
|
|
@ -300,7 +300,7 @@ static void con_draw(void)
|
|||
gr_set_default_canvas();
|
||||
auto &canvas = *grd_curcanv;
|
||||
auto &game_font = *GAME_FONT;
|
||||
gr_set_curfont(canvas, 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);
|
||||
|
|
|
@ -430,7 +430,7 @@ static void game_draw_hud_stuff(grs_canvas &canvas, const control_info &Controls
|
|||
int y;
|
||||
|
||||
auto &game_font = *GAME_FONT;
|
||||
gr_set_curfont(canvas, GAME_FONT);
|
||||
gr_set_curfont(canvas, game_font);
|
||||
gr_set_fontcolor(canvas, BM_XRGB(27, 0, 0), -1);
|
||||
|
||||
y = canvas.cv_bitmap.bm_h - (LINE_SPACING(*canvas.cv_font, *GAME_FONT) * 2);
|
||||
|
|
|
@ -1851,14 +1851,14 @@ static void hud_show_lives(const hud_draw_context_hs_mr hudctx, const hud_ar_sca
|
|||
: static_cast<int>(FSPACX(2));
|
||||
|
||||
auto &canvas = hudctx.canvas;
|
||||
auto &game_font = *GAME_FONT;
|
||||
if (Game_mode & GM_MULTI) {
|
||||
gr_set_fontcolor(canvas, BM_XRGB(0, 31, 0), -1);
|
||||
auto &game_font = *GAME_FONT;
|
||||
gr_printf(canvas, game_font, x, FSPACY(1), "%s: %d", TXT_DEATHS, player_info.net_killed_total);
|
||||
}
|
||||
else if (const uint16_t lives = get_local_player().lives - 1)
|
||||
{
|
||||
gr_set_curfont(canvas, GAME_FONT);
|
||||
gr_set_curfont(canvas, game_font);
|
||||
gr_set_fontcolor(canvas, BM_XRGB(0, 20, 0), -1);
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
auto &multires_gauge_graphic = hudctx.multires_gauge_graphic;
|
||||
|
@ -2694,7 +2694,7 @@ static void draw_secondary_ammo_info(const hud_draw_context_hs_mr hudctx, const
|
|||
static void draw_weapon_box(const hud_draw_context_hs_mr hudctx, const player_info &player_info, const unsigned weapon_num, const gauge_inset_window_view wt)
|
||||
{
|
||||
auto &canvas = hudctx.canvas;
|
||||
gr_set_curfont(canvas, GAME_FONT);
|
||||
gr_set_curfont(canvas, *GAME_FONT);
|
||||
|
||||
const auto laser_level_changed = (wt == gauge_inset_window_view::primary && weapon_num == primary_weapon_index_t::LASER_INDEX && (player_info.laser_level != old_laser_level));
|
||||
|
||||
|
@ -3723,7 +3723,7 @@ void render_gauges()
|
|||
if (shields < 0 ) shields = 0;
|
||||
|
||||
gr_set_default_canvas();
|
||||
gr_set_curfont(*grd_curcanv, GAME_FONT);
|
||||
gr_set_curfont(*grd_curcanv, *GAME_FONT);
|
||||
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
{
|
||||
|
|
|
@ -450,7 +450,7 @@ static void draw_item(grs_canvas &canvas, newmenu_item &item, int is_current, co
|
|||
}
|
||||
else
|
||||
{
|
||||
gr_set_curfont(canvas, is_current?MEDIUM2_FONT:MEDIUM1_FONT);
|
||||
gr_set_curfont(canvas, *(is_current ? MEDIUM2_FONT : MEDIUM1_FONT));
|
||||
}
|
||||
|
||||
const int line_spacing = static_cast<int>(LINE_SPACING(*canvas.cv_font, *GAME_FONT));
|
||||
|
@ -1502,7 +1502,7 @@ static window_event_result newmenu_draw(newmenu *menu)
|
|||
gr_string(*grd_curcanv, medium3_font, 0x8000, ty + th, menu->subtitle);
|
||||
}
|
||||
|
||||
gr_set_curfont(*grd_curcanv, menu->tiny_mode != tiny_mode_flag::normal ? GAME_FONT : MEDIUM1_FONT);
|
||||
gr_set_curfont(*grd_curcanv, *(menu->tiny_mode != tiny_mode_flag::normal ? GAME_FONT : MEDIUM1_FONT));
|
||||
|
||||
// Redraw everything...
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue