Listen for clicks, detect which display was clicked
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
from json import JSONDecodeError
|
||||
from random import randint
|
||||
from typing import Any, Optional
|
||||
import curses
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
@ -15,7 +16,6 @@ from .resources import ResourceManager
|
||||
from .settings import Settings
|
||||
from . import menus
|
||||
from .translations import gettext as _, Translator
|
||||
from typing import Callable
|
||||
|
||||
|
||||
class Game:
|
||||
@ -25,7 +25,7 @@ class Game:
|
||||
map: Map
|
||||
player: Player
|
||||
# display_actions is a display interface set by the bootstrapper
|
||||
display_actions: Callable[[DisplayActions], None]
|
||||
display_actions: callable
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
@ -82,6 +82,11 @@ class Game:
|
||||
self.display_actions(DisplayActions.REFRESH)
|
||||
return
|
||||
|
||||
if key == KeyValues.MOUSE:
|
||||
_ignored1, x, y, _ignored2, _ignored3 = curses.getmouse()
|
||||
self.display_actions(DisplayActions.MOUSE, y, x)
|
||||
return
|
||||
|
||||
if self.state == GameMode.PLAY:
|
||||
self.handle_key_pressed_play(key)
|
||||
elif self.state == GameMode.INVENTORY:
|
||||
|
Reference in New Issue
Block a user