diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -679,22 +679,27 @@ void gfx_draw_user(User *user, Arena *scratch) { int box_height = 3 + GFX_TEXT_MARGIN_Y; int box_width = MAX((int)strlen(binks), MAX(fast_utf8_width(user->name), fast_utf8_width(user->pronouns))); - int total_height = (user->banner.lines ? user->banner.lines + 1 : 0) + MAX(box_height, user->pfp.lines) + GFX_TEXT_MARGIN_Y * 2; - int total_width = MAX(user->banner.cols, user->pfp.cols + 2 + box_width) + GFX_TEXT_MARGIN_X * 2; - gfx_cleared_box(cy - user->banner.lines - 2 - GFX_TEXT_MARGIN_Y, cx - (total_width >> 1) - 2 - GFX_TEXT_MARGIN_X, + int bh = MIN(user->banner.lines, getmaxy(stdscr) - 3 - GFX_TEXT_MARGIN_Y * 2 - 4); + int bw = MIN(user->banner.cols, getmaxx(stdscr) - GFX_TEXT_MARGIN_X * 2 - 4); + + int total_height = (bh ? bh + 1 : 0) + MAX(box_height, user->pfp.lines) + GFX_TEXT_MARGIN_Y * 2; + int total_width = MAX(bw, user->pfp.cols + 2 + box_width) + GFX_TEXT_MARGIN_X * 2; + gfx_cleared_box(cy - (total_height >> 1) - 2 - GFX_TEXT_MARGIN_Y, cx - (total_width >> 1) - 2 - GFX_TEXT_MARGIN_X, total_height + 4, total_width + 4); - if (user->banner.lines > 0) { + cy -= (total_height >> 1); + if (bh > 0) { color_set(CPAIR_BANNER, 0); - gfx_draw_pic(&user->banner, cy, cx, cy, cx, PIC_CTR_X | PIC_TOP); - } else { - //cy -= MAX(user->pfp.lines, box_height) >> 1; - cy--; + gfx_draw_pic(&user->banner, cy, cx, bh, bw, PIC_CTR_X); + cy += bh + 1; } int left = cx - (total_width >> 1); + + if (bw > box_width + user->pfp.cols) left += (bw - box_width - user->pfp.cols) >> 1; + color_set(CPAIR_PFP, 0); - int pfpy = cy + 1; + int pfpy = cy; if (box_height > user->pfp.lines) { pfpy += (box_height - user->pfp.lines) >> 1; } @@ -706,7 +711,7 @@ void gfx_draw_user(User *user, Arena *scratch) { cy += (user->pfp.lines - box_height) >> 1; } - int y = cy + 1; + int y = cy; mvaddnstr(y++, left + GFX_TEXT_MARGIN_X, user->name.s, user->name.n); if (user->pronouns.n > 0) { color_set(CPAIR_PRONOUNS, 0); |