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