WIP sdl renderer

This commit is contained in:
Lukas Nöllemeyer 2024-08-19 16:06:29 +02:00
parent 68aa90cac8
commit ef3f64bfa2
3 changed files with 22 additions and 11 deletions

17
main.py
View file

@ -5,10 +5,13 @@ from __future__ import annotations
import tcod.console
import tcod.context
import tcod.render
import tcod.tileset
import game.tilesetmanager
import g
import tcod.sdl.video
import tcod.sdl.render
import g
import game.tilesetmanager
import game.screens
from game.screens.menu_screens import MainMenu
@ -20,17 +23,21 @@ def main() -> None:
g.screens = [MainMenu()]
g.background = tcod.console.Console(80, 35)
g.foreground = tcod.console.Console(80, 35)
g.sdl_window = tcod.sdl.video.new_window(
win = tcod.sdl.video.new_window(
g.background.width * g.tileset.tile_width,
g.background.height * g.tileset.tile_height,
flags=tcod.lib.SDL_WINDOW_RESIZABLE,
)
g.sdl_window = win
g.sdl_renderer = tcod.sdl.render.new_renderer(g.sdl_window, target_textures=True)
g.atlas = tcod.render.SDLTilesetAtlas(g.sdl_renderer, g.tileset)
g.console_render = tcod.render.SDLConsoleRender(atlas=g.atlas)
with tcod.context.new(console=g.background, tileset=g.tileset) as g.context:
game.screens.main_loop()