moved render stuff

This commit is contained in:
Lukas Nöllemeyer 2024-08-19 21:30:29 +02:00
parent 733c6ec30e
commit 5b2a68ff2c
6 changed files with 109 additions and 100 deletions

View file

@ -64,7 +64,7 @@ def _draw_entity(entity: tcod.ecs.Entity, camera_pos, camera_radius_x, camera_ra
graphic = entity.components[Graphic]
r,gg,b,_ = graphic.fg
fg = (r,gg,b,255)
g.foreground.rgba[["ch", "fg"]][screen_pos.y + camera_radius_y, screen_pos.x + camera_radius_x] = graphic.ch, fg
g.renderer.foreground.rgba[["ch", "fg"]][screen_pos.y + camera_radius_y, screen_pos.x + camera_radius_x] = graphic.ch, fg
@attrs.define()
@ -86,9 +86,9 @@ class MainScreen(Screen):
case _:
return None
def on_draw(self, console: tcod.console.Console) -> None:
def on_draw(self) -> None:
"""Draw the standard screen."""
console = g.background
console = g.renderer.background
centers = [a.components[Position] for a in g.world.Q.all_of(tags=[IsPlayer])]
camera_pos = sum(centers, start=Position(0,0))
camera_pos = camera_pos.mod(len(centers))