26 lines
835 B
Python
Raw Normal View History

2020-11-06 15:34:24 +01:00
import curses
2020-11-06 21:15:09 +01:00
from typing import Any
2020-11-06 15:34:24 +01:00
from .mapdisplay import MapDisplay
2020-11-06 17:43:30 +01:00
from .texturepack import TexturePack
2020-11-06 15:34:24 +01:00
class Display:
2020-11-06 21:17:31 +01:00
# game is a game, can't import to avoid circulary includes
def __init__(self, game: Any, screen: Any):
2020-11-06 15:34:24 +01:00
self.screen = screen
self.game = game
2020-11-06 20:28:10 +01:00
lines = curses.LINES if screen else 4
cols = curses.COLS * 4 // 5 if screen else 4
2020-11-06 20:24:19 +01:00
self.map_display = MapDisplay(game.m,
TexturePack.get_pack(
2020-11-06 21:15:09 +01:00
game.settings.TEXTURE_PACK
),
2020-11-06 20:28:10 +01:00
lines, cols, screen is not None)
2020-11-06 17:43:30 +01:00
2020-11-06 21:15:09 +01:00
def refresh(self) -> None:
2020-11-06 20:24:19 +01:00
self.map_display.update_pad()
2020-11-06 21:15:09 +01:00
def display(self, y: int, x: int) -> None:
2020-11-06 20:24:19 +01:00
self.map_display.display(y, x)