texture render pain

This commit is contained in:
Lukas Nöllemeyer 2024-08-19 17:28:36 +02:00
parent 6cfa795463
commit 06dda08e8e
3 changed files with 24 additions and 10 deletions

View file

@ -53,15 +53,21 @@ def main_draw() -> None:
if not g.screens:
return
g.background.clear()
g.foreground.clear()
g.foreground.rgba["bg"][:] = 0
g.foreground.rgba["fg"][:] = 0
g.screens[-1].on_draw(g.background)
# g.context.present(g.background)
g.sdl_renderer.copy(g.console_render.render(g.background))
# g.sdl_renderer.copy(g.console_render.render(g.background))
# g.foreground.blit(g.background, fg_alpha=1.0, bg_alpha=0.0)
bg_tex = g.console_render.render(g.background)
bg_tex.blend_mode = 1
g.sdl_renderer.copy(g.console_render.render(g.foreground))
g.foreground.blit(g.background, fg_alpha=1.0, bg_alpha=0.0)
g.sdl_renderer.copy(g.console_render.render(g.background))
with g.sdl_renderer.set_render_target(bg_tex):
fg_tex = g.console_render.render(g.foreground)
fg_tex.blend_mode = 1
g.sdl_renderer.copy(fg_tex)
g.sdl_renderer.copy(bg_tex)
g.sdl_renderer.present()
@ -114,5 +120,7 @@ def draw_previous_screens(screen: Screen, console: tcod.console.Console, dim: bo
return
prev_screen.on_draw(console)
if dim and screen is g.screens[-1]:
console.rgb["fg"] //= 4
console.rgb["bg"] //= 4
g.foreground.rgb["fg"] //= 4
g.foreground.rgb["bg"] //= 4
g.background.rgb["fg"] //= 4
g.background.rgb["bg"] //= 4

View file

@ -112,7 +112,7 @@ class MainScreen(Screen):
ch = VERTICAL_WALL_CHAR
if map.walkable[map_pos.y+1, map_pos.x] and world_pos+Position(0,1) not in doors:
ch = WALL_CHAR
console.rgba[["ch","fg"]][j, i] = ch, (255,255,255, 255)
console.rgba[["ch", "fg", "bg"]][j, i] = ch, (255,255,255, 255), (0,0,0,0)
# draw all entities that are not actors
for entity in g.world.Q.all_of(components=[Position, Graphic]).none_of(tags=[IsActor]):