From 3ea5a9fb6797a438f6f9847c2c442613bc8b0d1c Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 19 Dec 2020 04:42:14 +0100 Subject: [PATCH] Re-design face pop-up format. --- rogue_chat.html | 18 +++++++++--------- rogue_chat_curses.py | 17 +++++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/rogue_chat.html b/rogue_chat.html index ba5ecd2..4e5da8b 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -1213,24 +1213,24 @@ let tui = { return; } const start_x = tui.window_width - 10; - let t_char = ' '; - if (t.thing_char) { - t_char = t.thing_char; - } function draw_body_part(body_part, end_y) { - terminal.write(end_y - 4, start_x, ' _[ @' + t_char + ' ]_ '); - terminal.write(end_y - 3, start_x, '| |'); + terminal.write(end_y - 3, start_x, '----------'); terminal.write(end_y - 2, start_x, '| ' + body_part.slice(0, 6) + ' |'); terminal.write(end_y - 1, start_x, '| ' + body_part.slice(6, 12) + ' |'); terminal.write(end_y, start_x, '| ' + body_part.slice(12, 18) + ' |'); } if (t.face) { - draw_body_part(t.face, terminal.rows - 2); + draw_body_part(t.face, terminal.rows - 3); } if (t.hat) { - draw_body_part(t.hat, terminal.rows - 5); + draw_body_part(t.hat, terminal.rows - 6); + } + terminal.write(terminal.rows - 2, start_x, '----------'); + let name = t.name_; + if (name.length > 6) { + name = name.slice(0, 6) + '…'; } - terminal.write(terminal.rows - 1, start_x, '| |'); + terminal.write(terminal.rows - 1, start_x, '@' + t.thing_char + ':' + name); }, draw_mode_line: function() { let help = 'hit [' + this.keys.help + '] for help'; diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 07f7ada..a6f152c 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -1076,21 +1076,22 @@ class TUI: return start_x = self.window_width - 10 - t_char = ' ' - if hasattr(t, 'thing_char'): - t_char = t.thing_char def draw_body_part(body_part, end_y): - safe_addstr(end_y - 4, start_x, ' _[ @' + t_char + ' ]_ ') - safe_addstr(end_y - 3, start_x, '| |') + safe_addstr(end_y - 3, start_x, '----------') safe_addstr(end_y - 2, start_x, '| ' + body_part[0:6] + ' |') safe_addstr(end_y - 1, start_x, '| ' + body_part[6:12] + ' |') safe_addstr(end_y, start_x, '| ' + body_part[12:18] + ' |') if hasattr(t, 'face'): - draw_body_part(t.face, self.size.y - 2) + draw_body_part(t.face, self.size.y - 3) if hasattr(t, 'hat'): - draw_body_part(t.hat, self.size.y - 5) - safe_addstr(self.size.y - 1, start_x, '| |') + draw_body_part(t.hat, self.size.y - 6) + safe_addstr(self.size.y - 2, start_x, '----------') + name = t.name[:] + if len(name) > 6: + name = name[:6] + '…' + safe_addstr(self.size.y - 1, start_x, + '@%s:%s' % (t.thing_char, name)) def draw_help(): content = "%s help\n\n%s\n\n" % (self.mode.short_desc, -- 2.30.2