Add method returning specified screen part width

This commit is contained in:
Michał Czekański 2020-04-05 21:48:43 +02:00
parent 900e8e2203
commit aec4ddf2d3

View File

@ -7,6 +7,13 @@ import pygame
MARGIN = 300 MARGIN = 300
# screen locations enum
class Locations(Enum):
RIGHT_UI = 1
LEFT_UI = 2
MAP = 3
class Screen: class Screen:
def __init__(self, gameObject, windowConfig): def __init__(self, gameObject, windowConfig):
self.gameObject = gameObject self.gameObject = gameObject
@ -46,9 +53,10 @@ class Screen:
sprite.rect.x += self.mapCoord sprite.rect.x += self.mapCoord
self.gameObject.spritesList.add(sprite) self.gameObject.spritesList.add(sprite)
def getUiWidth(self, location: Locations):
# screen locations enum if location is Locations.RIGHT_UI:
class Locations(Enum): return self.winX - (self.mapCoord + self.mapSize)
RIGHT_UI = 1 elif location is Locations.LEFT_UI:
LEFT_UI = 2 return self.mapCoord
MAP = 3 elif location is Locations.MAP:
return self.mapSize