From 967146e45cff5d8ebf31541ee6e76e79203ede3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sun, 5 Apr 2020 22:58:32 +0200 Subject: [PATCH] Add drawing all Ui elems in on screen init --- src/game/Screen.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/game/Screen.py b/src/game/Screen.py index ee93aab..d24d34b 100644 --- a/src/game/Screen.py +++ b/src/game/Screen.py @@ -2,6 +2,7 @@ import math from enum import Enum import pygame +from src.ui.Ui import Ui # minimum UI width MARGIN = 300 @@ -31,6 +32,8 @@ class Screen: # draw a white rect to resemble map pygame.draw.rect(self.pygameScreen, (255, 255, 255), [self.mapCoord, 0, self.mapSize, self.mapSize]) + self.__initUi__() + def calculateMapDimensions(self): result = 0 expectedSize = self.winY @@ -60,3 +63,18 @@ class Screen: return self.mapCoord elif location is Locations.MAP: return self.mapSize + + def __initUi__(self): + self.ui = Ui(self.getUiWidth(Locations.RIGHT_UI), self.getUiWidth(Locations.LEFT_UI), self.winY, + self.gameObject.ingameTimer) + self.draw(self.ui.timerTextView, Locations.LEFT_UI, 0, 0) + self.draw(self.ui.isDayTextView, Locations.LEFT_UI, 0, 0) + self.draw(self.ui.console, Locations.LEFT_UI, 0, 0) + self.draw(self.ui.healthTextView, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.healthBar, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.hungerTextView, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.hungerBar, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.staminaTextView, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.staminaBar, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.thirstTextView, Locations.RIGHT_UI, 0, 0) + self.draw(self.ui.thirstBar, Locations.RIGHT_UI, 0, 0)