sdl rendering progress?

This commit is contained in:
Lukas Nöllemeyer 2024-08-19 18:17:25 +02:00
parent 467c6606da
commit af941dc848
5 changed files with 22 additions and 13 deletions

View file

@ -62,7 +62,7 @@ def _draw_entity(entity: tcod.ecs.Entity, camera_pos, camera_radius_x, camera_ra
map_pos = world_pos_to_map_pos(pos)
if g.world[None].components[Map].fov[map_pos.y, map_pos.x]:
graphic = entity.components[Graphic]
g.foreground.rgba[["ch", "fg", "bg"]][screen_pos.y + camera_radius_y, screen_pos.x + camera_radius_x] = graphic.ch, graphic.fg, graphic.bg
g.foreground.rgba[["ch", "fg"]][screen_pos.y + camera_radius_y, screen_pos.x + camera_radius_x] = graphic.ch, graphic.fg
@attrs.define()
@ -86,6 +86,7 @@ class MainScreen(Screen):
def on_draw(self, console: tcod.console.Console) -> None:
"""Draw the standard screen."""
console = g.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))