summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/__init__.py
diff options
context:
space:
mode:
authortroido <troido@hotmail.com>2017-10-29 23:31:46 +0100
committertroido <troido@hotmail.com>2017-10-29 23:31:46 +0100
commitd1f84633cff02d9d43c321814364b2c30c4fa3a9 (patch)
treecf7fc926e0bc6c8dad5774d79cdb03f841fb675b /asciifarm/client/display/__init__.py
parenta8fd6fc77a3c5af06727a68684e61c63553679a8 (diff)
merged recent changes into package branch again
Diffstat (limited to 'asciifarm/client/display/__init__.py')
-rw-r--r--asciifarm/client/display/__init__.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/asciifarm/client/display/__init__.py b/asciifarm/client/display/__init__.py
index dc553a8..870571e 100644
--- a/asciifarm/client/display/__init__.py
+++ b/asciifarm/client/display/__init__.py
@@ -7,6 +7,7 @@ from .healthpad import HealthPad
from .inventorypad import InventoryPad
from .screen import Screen
from .colours import Colours
+from .messagepad import MessagePad
SIDEWIDTH = 20
@@ -33,6 +34,7 @@ class Display:
self.groundPad = InventoryPad("Ground", 8)
self.lastinfostring = None
self.changed = False
+ self.messagePad = messagepad.MessagePad(5)
def resizeField(self, size):
@@ -65,6 +67,10 @@ class Display:
def setGround(self, items):
self.groundPad.setInventory(items)
self.change()
+
+ def addMessage(self, message):
+ self.messagePad.addMessage(message)
+ self.change()
def getChar(self, sprite):
char = self.characters.get(sprite, self.defaultChar)
@@ -78,14 +84,17 @@ class Display:
def update(self):
if self.changed:
fieldRight = min(self.fieldPad.getWidth(), self.screen.getWidth()-SIDEWIDTH-1)
+ fieldBottom = min(self.fieldPad.getHeight(), self.screen.getHeight()-self.messagePad.getHeight())
healthBottom = self.healthPad.getHeight()
inventoryBottom = healthBottom + self.inventoryPad.getHeight()
groundBottom = inventoryBottom + self.groundPad.getHeight()
- self.fieldPad.update(self, 0,0,fieldRight, min(self.fieldPad.getHeight(), self.screen.getHeight()))
+ self.fieldPad.update(self, 0,0,fieldRight, fieldBottom)
+ self.messagePad.update(self, 0,fieldBottom, fieldRight, min(self.screen.getHeight(), fieldBottom+self.messagePad.getHeight()))
self.healthPad.update(self, fieldRight+1,0, self.screen.getWidth(), healthBottom)
self.inventoryPad.update(self, fieldRight+1, healthBottom, self.screen.getWidth(), min(self.screen.getHeight(), inventoryBottom))
self.groundPad.update(self, fieldRight+1, inventoryBottom, self.screen.getWidth(), min(self.screen.getHeight(), groundBottom))
self.infoPad.update(self, fieldRight+1,groundBottom+1, self.screen.getWidth(), self.screen.getHeight())
+
curses.doupdate()
self.changed = False