From: Christian Heller Date: Fri, 11 Dec 2020 06:20:21 +0000 (+0100) Subject: Improve chat face pop-up usability. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/balance?a=commitdiff_plain;h=b3274c1e3219d50cc67487684608c7b4bd456675;p=plomrogue2 Improve chat face pop-up usability. --- diff --git a/rogue_chat.html b/rogue_chat.html index 5e66398..781fc63 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -778,6 +778,7 @@ let tui = { if (this.mode && this.mode.name == 'control_tile_draw') { tui.log_msg('@ finished tile protection drawing.') } + this.draw_face = false; this.tile_draw = false; if (mode_name == 'command_thing' && (!game.player.carrying || !game.player.carrying.commandable)) { @@ -1137,20 +1138,21 @@ let tui = { this.draw_face = false; return; } + const start_x = tui.window_width - 10; function draw_body_part(body_part, end_y) { - const start_x = tui.window_width - 10; - terminal.write(end_y - 4, start_x, '+--------+'); + terminal.write(end_y - 4, 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 - 1); + draw_body_part(t.face, terminal.rows - 2); } if (t.hat) { - draw_body_part(t.hat, terminal.rows - 4); + draw_body_part(t.hat, terminal.rows - 5); } + terminal.write(terminal.rows - 1, start_x, '| |'); }, draw_mode_line: function() { let help = 'hit [' + this.keys.help + '] for help'; @@ -1503,7 +1505,6 @@ document.onclick = function() { }; tui.inputEl.addEventListener('keydown', (event) => { tui.show_help = false; - tui.draw_face = false; if (event.key == 'Enter') { event.preventDefault(); } diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 2858892..983a422 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -549,7 +549,6 @@ class TUI: self.fov = '' self.flash = False self.map_lines = [] - self.draw_face = False self.offset = YX(0,0) curses.wrapper(self.loop) @@ -644,6 +643,7 @@ class TUI: if self.mode and self.mode.name == 'control_tile_draw': self.log_msg('@ finished tile protection drawing.') + self.draw_face = False self.tile_draw = False if mode_name == 'command_thing' and\ (not self.game.player.carrying or @@ -970,18 +970,19 @@ class TUI: self.draw_face = False return + start_x = self.window_width - 10 def draw_body_part(body_part, end_y): - start_x = self.window_width - 10 - safe_addstr(end_y - 4, start_x, '+--------+') + safe_addstr(end_y - 4, 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 - 1) + draw_body_part(t.face, self.size.y - 2) if hasattr(t, 'hat'): - draw_body_part(t.hat, self.size.y - 4) + draw_body_part(t.hat, self.size.y - 5) + safe_addstr(self.size.y - 1, start_x, '| |') def draw_help(): content = "%s help\n\n%s\n\n" % (self.mode.short_desc,