Skip to content

Commit 1cf53b4

Browse files
committed
Add tcod.sdl package to setup.py.
1 parent 0165926 commit 1cf53b4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

examples/samples_tcod.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import numpy as np
2020
import tcod
21+
import tcod.render
2122
from numpy.typing import NDArray
2223

2324
if not sys.warnoptions:
@@ -1417,6 +1418,10 @@ def main() -> None:
14171418
global context, tileset
14181419
tileset = tcod.tileset.load_tilesheet(FONT, 32, 8, tcod.tileset.CHARMAP_TCOD)
14191420
context = init_context(tcod.RENDERER_SDL2)
1421+
sdl_renderer = context.sdl_renderer
1422+
assert sdl_renderer
1423+
atlas = tcod.render.SDLTilesetAtlas(sdl_renderer, tileset)
1424+
console_render = tcod.render.SDLConsoleRender(atlas)
14201425
try:
14211426
SAMPLES[cur_sample].on_enter()
14221427

@@ -1429,7 +1434,9 @@ def main() -> None:
14291434
SAMPLES[cur_sample].on_draw()
14301435
sample_console.blit(root_console, SAMPLE_SCREEN_X, SAMPLE_SCREEN_Y)
14311436
draw_stats()
1432-
context.present(root_console)
1437+
# context.present(root_console)
1438+
sdl_renderer.copy(console_render.render(root_console))
1439+
sdl_renderer.present()
14331440
handle_time()
14341441
handle_events()
14351442
finally:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def check_sdl_version() -> None:
109109
"Forum": "https://github.com/libtcod/python-tcod/discussions",
110110
},
111111
py_modules=["libtcodpy"],
112-
packages=["tcod", "tcod.__pyinstaller"],
112+
packages=["tcod", "tcod.sdl", "tcod.__pyinstaller"],
113113
package_data={"tcod": get_package_data()},
114114
python_requires=">=3.7",
115115
setup_requires=[

0 commit comments

Comments
 (0)