squirrel-battle/dungeonbattle/display/display.py

18 lines
496 B
Python

import curses
from typing import Any, Union
from dungeonbattle.tests.screen import FakePad
class Display:
def __init__(self, screen: Any):
self.screen = screen
self.rows = curses.LINES if screen else 42
self.cols = curses.COLS * 4 // 5 if screen else 42
def refresh(self) -> None:
raise NotImplementedError
def newpad(self, height: int, width: int) -> Union[FakePad, Any]:
return curses.newpad(height, width) if self.screen else FakePad()