35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from .interfaces import Map
|
|
from .mapdisplay import MapDisplay
|
|
from .term_manager import TermManager
|
|
|
|
|
|
class Game:
|
|
INSTANCE = None
|
|
|
|
def init(self) -> None:
|
|
Game.INSTANCE = self
|
|
with TermManager() as term_manager:
|
|
self._start_game(term_manager.screen)
|
|
|
|
def _start_game(self, screen):
|
|
# TODO Generate map, or make the possibility to load another one
|
|
m = Map.load("example_map.txt")
|
|
d = MapDisplay(m)
|
|
screen.refresh()
|
|
while True:
|
|
d.display(1, 6)
|
|
screen.refresh()
|
|
key = screen.getkey()
|
|
self.handle_key_pressed(key)
|
|
|
|
def handle_key_pressed(self, key):
|
|
# TODO load keys from settings
|
|
if key == 'z' or key == 'KEY_UP':
|
|
pass # TODO Go up
|
|
if key == 's' or key == 'KEY_DOWN':
|
|
pass # TODO Go down
|
|
if key == 'q' or key == 'KEY_LEFT':
|
|
pass # TODO Go left
|
|
if key == 'd' or key == 'KEY_RIGHT':
|
|
pass # TODO Go right
|