Merge remote-tracking branch 'origin/passingEvents' into passingEvents
This commit is contained in:
commit
325adc7de5
10
src/ui/Ui.py
10
src/ui/Ui.py
@ -80,10 +80,16 @@ class Ui():
|
|||||||
self.thirstBar.updateFill(statistics.thirst)
|
self.thirstBar.updateFill(statistics.thirst)
|
||||||
consoleLines.append("Stamina: " + str(statistics.thirst))
|
consoleLines.append("Stamina: " + str(statistics.thirst))
|
||||||
|
|
||||||
self.console.addLinesToConsoleAndScrollToDisplayThem(consoleLines)
|
if len(consoleLines) > 0:
|
||||||
|
self.console.addLinesToConsoleAndScrollToDisplayThem(consoleLines)
|
||||||
|
|
||||||
def updateBasedOnPygameEvent(self, event: pygame.event):
|
def updateBasedOnPygameEvent(self, event: pygame.event):
|
||||||
pass
|
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||||
|
console = self.console
|
||||||
|
if event.button == 4:
|
||||||
|
console.writeConsoleLines(console.topWrittenLineInd + 1)
|
||||||
|
elif event.button == 5:
|
||||||
|
console.writeConsoleLines(console.topWrittenLineInd - 1)
|
||||||
|
|
||||||
|
|
||||||
class Colors(Enum):
|
class Colors(Enum):
|
||||||
|
@ -35,8 +35,8 @@ class UiConsole(UiElement):
|
|||||||
self.image.fill(self.bgColor)
|
self.image.fill(self.bgColor)
|
||||||
if startingLineInd < 0:
|
if startingLineInd < 0:
|
||||||
startingLineInd = 0
|
startingLineInd = 0
|
||||||
elif startingLineInd > self.linesImagesCount:
|
elif startingLineInd >= self.linesImagesCount:
|
||||||
startingLineInd = self.linesImagesCount
|
startingLineInd = self.linesImagesCount - 1
|
||||||
self.topWrittenLineInd = startingLineInd
|
self.topWrittenLineInd = startingLineInd
|
||||||
writtenLines = 0
|
writtenLines = 0
|
||||||
for i in range(startingLineInd, min(self.maxLines + startingLineInd, self.linesImagesCount)):
|
for i in range(startingLineInd, min(self.maxLines + startingLineInd, self.linesImagesCount)):
|
||||||
|
Loading…
Reference in New Issue
Block a user