Refactor map rendering
- Move all map rendering to a new MapWindow class - Clip map rendering to the bounds of the Window - Pass in Entities list from the Engine and render them relative to the window The map doesn't scroll yet, so it'll always be clipped on the bottom and right.
This commit is contained in:
parent
ec28f984da
commit
8efd3ce207
4 changed files with 109 additions and 40 deletions
|
@ -47,6 +47,20 @@ class Map:
|
|||
'''The size of the map'''
|
||||
return self.configuration.map_size
|
||||
|
||||
@property
|
||||
def composited_tiles(self) -> np.ndarray:
|
||||
# TODO: Hold onto the result here so that this doen't have to be done every time this property is called.
|
||||
return np.select(
|
||||
condlist=[
|
||||
self.highlighted,
|
||||
self.visible,
|
||||
self.explored],
|
||||
choicelist=[
|
||||
self.tiles['highlighted'],
|
||||
self.tiles['light'],
|
||||
self.tiles['dark']],
|
||||
default=Shroud)
|
||||
|
||||
def random_walkable_position(self) -> Point:
|
||||
'''Return a random walkable point on the map.'''
|
||||
if not self.__walkable_points:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue