home · contact · privacy
New client: Scroll map window with player avatar.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 29 Nov 2015 22:06:07 +0000 (23:06 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 29 Nov 2015 22:06:07 +0000 (23:06 +0100)
client_prototype.py

index 2fc7a44aa164261dadb5a7f2d6525076f6575940..02f63b9846832f541014e1c383479c02aa37ee56 100644 (file)
@@ -298,7 +298,16 @@ def win_foo():
 
 
 def win_map():
+    win_size = next(win["size"] for win in windows if win["func"] == win_map)
     offset = [0, 0]
+    for i in range(2):
+        if world_data["position"][i] * (i + 1) > win_size[i] / 2:
+            if world_data["position"][i] * (i + 1) \
+                < world_data["map_size"] * (i + 1) - win_size[i] / 2:
+                offset[i] = world_data["position"][i] * (i + 1) \
+                    - int(win_size[i] / 2)
+            else:
+                offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i
     winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1]
     winmap = []
     for y in range(world_data["map_size"]):