Better interaction with inventory menu
This commit is contained in:
parent
089a247b2f
commit
1afa397fec
@ -48,7 +48,7 @@ class MenuDisplay(Display):
|
|||||||
"""
|
"""
|
||||||
We can select a menu item with the mouse.
|
We can select a menu item with the mouse.
|
||||||
"""
|
"""
|
||||||
self.menu.position = y - 1
|
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 1))
|
||||||
game.handle_key_pressed(KeyValues.ENTER)
|
game.handle_key_pressed(KeyValues.ENTER)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -136,3 +136,10 @@ class InventoryDisplay(MenuDisplay):
|
|||||||
@property
|
@property
|
||||||
def trueheight(self) -> int:
|
def trueheight(self) -> int:
|
||||||
return 2 + super().trueheight
|
return 2 + super().trueheight
|
||||||
|
|
||||||
|
def handle_click(self, y: int, x: int, game: Game) -> None:
|
||||||
|
"""
|
||||||
|
We can select a menu item with the mouse.
|
||||||
|
"""
|
||||||
|
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 3))
|
||||||
|
game.handle_key_pressed(KeyValues.ENTER)
|
||||||
|
Loading…
Reference in New Issue
Block a user