X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/gitweb.css?a=blobdiff_plain;f=new%2Fexample_client.py;h=5fc3063da146b2a4be1a26e47bc7f61169de903d;hb=1ed87907733a1d3f3646c4b1a94fb17e3cff500f;hp=54435460ab1411140fa9c1b011893e392980f6b7;hpb=88bb64ff4ad07e53f7a6b4e3ec9226ee52ac59a2;p=plomrogue2-experiments diff --git a/new/example_client.py b/new/example_client.py index 5443546..5fc3063 100755 --- a/new/example_client.py +++ b/new/example_client.py @@ -412,6 +412,8 @@ class MapWidget(Widget): chars_with_attrs += [(c, curses.color_pair(2))] elif c in {'x', 'X', '#'}: chars_with_attrs += [(c, curses.color_pair(3))] + elif c == '?': + chars_with_attrs += [(c, curses.color_pair(5))] else: chars_with_attrs += [c] return chars_with_attrs @@ -584,10 +586,14 @@ class TUI: curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_GREEN) curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_BLUE) curses.init_pair(4, curses.COLOR_BLACK, curses.COLOR_YELLOW) + curses.init_pair(5, curses.COLOR_BLACK, curses.COLOR_WHITE) + # Basic curses initialization work. setup_screen(stdscr) curses.curs_set(False) # hide cursor init_colors() + + # With screen initialized, set up widgets with their curses windows. edit_widget = TextLineWidget('SEND:', self, (0, 0), (1, 20)) edit_line_widget = EditWidget(self, (0, 6), (1, 14), ['edit']) edit_widget.children += [edit_line_widget] @@ -605,10 +611,12 @@ class TUI: descriptor_widget, map_widget, inventory_widget, pickable_items_widget] popup_widget = PopUpWidget(self, (0, 0), (1, 1), visible=False) - write_mode = False + + # Ensure initial window state before loop starts. for w in top_widgets: w.ensure_freshness(True) self.socket.send('GET_GAMESTATE') + write_mode = False while True: # Draw screen.