37 lines
855 B
Python
37 lines
855 B
Python
import curses
|
|
from typing import Any, Union
|
|
|
|
from typing import Any
|
|
from dungeonbattle.tests.screen import FakePad
|
|
|
|
|
|
class Display:
|
|
def __init__(self, screen: Any, pack: Any):
|
|
self.screen = screen
|
|
self.pack = pack
|
|
|
|
def newpad(self, height: int, width: int) -> Union[FakePad, Any]:
|
|
return curses.newpad(height, width) if self.screen else FakePad()
|
|
|
|
def resize(self, y, x, height, width):
|
|
self.x = x
|
|
self.y = y
|
|
self.width = width
|
|
self.height = height
|
|
|
|
def refresh(self, *args):
|
|
if len(args) == 4:
|
|
self.resize(*args)
|
|
self.display()
|
|
|
|
def display(self):
|
|
pass
|
|
|
|
@property
|
|
def rows(self) -> int:
|
|
return curses.LINES if self.screen else 42
|
|
|
|
@property
|
|
def cols(self) -> int:
|
|
return curses.COLS if self.screen else 42
|