X-Git-Url: https://plomlompom.com/repos/new_day?a=blobdiff_plain;f=client_prototype.py;h=ba9e54348af063f8d77b7b90f349759d8c7365bb;hb=512db83fc2b16a124ca25f22f0db6e4ed7ecabc0;hp=ab91e9ab4f8f2373fde7e187127177a2d4b61b0b;hpb=89ec3f0cbfd092942db51d2349ea4c2bb521b353;p=plomrogue diff --git a/client_prototype.py b/client_prototype.py index ab91e9a..ba9e543 100644 --- a/client_prototype.py +++ b/client_prototype.py @@ -184,6 +184,8 @@ def read_worldstate(): if read_anew: cursed_main.redraw = True world_data["turn"] = int(turn_string) + world_data["lifepoints"] = int(worldstate_file.readline()) + world_data["satiation"] = int(worldstate_file.readline()) worldstate_file.close() read_worldstate.last_checked_mtime = -1 @@ -242,11 +244,18 @@ def cursed_main(stdscr): read_worldstate() -def foo(): - #winmap = ['.', 'o', '.', 'o', 'O', 'o', '.', 'o', '.', 'x', 'y', 'x'] - #size = [4, 3] - winmap = str(world_data["turn"]).rjust(10) - size = [1, 10] +def win_foo(): + winmap = ['.', 'o', '.', 'o', 'O', 'o', '.', 'o', '.', 'x', 'y', 'x'] + size = [4, 3] + offset = [0, 0] + return offset, size, winmap + + +def win_info(): + winmap = "T: " + str(world_data["turn"]) \ + + " H: " + str(world_data["lifepoints"]) \ + + " S: " + str(world_data["satiation"]) + size = [1, len(winmap)] offset = [0, 0] return offset, size, winmap @@ -258,11 +267,11 @@ def command_quit(): windows = [ - {"config": [1, 33], "func": foo}, - {"config": [-7, 33], "func": foo}, - {"config": [4, 16], "func": foo}, - {"config": [4, 16], "func": foo}, - {"config": [0, -34], "func": foo} + {"config": [1, 33], "func": win_info}, + {"config": [-7, 33], "func": win_foo}, + {"config": [4, 16], "func": win_foo}, + {"config": [4, 16], "func": win_foo}, + {"config": [0, -34], "func": win_foo} ] io = { "path_out": "server/in", @@ -277,6 +286,8 @@ message_queue = { "messages": [] } world_data = { + "lifepoints": -1, + "satiation": -1, "turn": -1 } sep_size = 1 # Width of inter-window borders and title bars.