Move all the interface stuff to interface.Interface
Draw three windows with frames: - map window - info window (hit point bar; turn count) - message window Clean up the UI code in the Engine.
This commit is contained in:
parent
df4df06013
commit
6780b0495c
5 changed files with 114 additions and 21 deletions
25
erynrl/interface/window.py
Normal file
25
erynrl/interface/window.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
from tcod.console import Console
|
||||
|
||||
from ..geometry import Rect
|
||||
|
||||
|
||||
class Window:
|
||||
def __init__(self, bounds: Rect, *, framed: bool = True):
|
||||
self.bounds = bounds
|
||||
self.is_framed = framed
|
||||
|
||||
@property
|
||||
def drawable_area(self) -> Rect:
|
||||
if self.is_framed:
|
||||
return self.bounds.inset_rect(1, 1, 1, 1)
|
||||
return self.bounds
|
||||
|
||||
def draw(self, console: Console):
|
||||
if self.is_framed:
|
||||
console.draw_frame(
|
||||
self.bounds.origin.x,
|
||||
self.bounds.origin.y,
|
||||
self.bounds.size.width,
|
||||
self.bounds.size.height)
|
||||
Loading…
Add table
Add a link
Reference in a new issue