|
18 | 18 |
|
19 | 19 | import numpy as np |
20 | 20 |
|
| 21 | +import tcod.bsp |
21 | 22 | import tcod.cffi |
| 23 | +import tcod.console |
22 | 24 | import tcod.context |
23 | 25 | import tcod.event |
| 26 | +import tcod.image |
| 27 | +import tcod.los |
| 28 | +import tcod.map |
24 | 29 | import tcod.noise |
| 30 | +import tcod.path |
25 | 31 | import tcod.render |
26 | 32 | import tcod.sdl.mouse |
27 | 33 | import tcod.sdl.render |
| 34 | +import tcod.tileset |
28 | 35 | from tcod import libtcodpy |
29 | 36 | from tcod.sdl.video import WindowFlags |
30 | 37 |
|
@@ -103,15 +110,10 @@ def ev_keydown(self, event: tcod.event.KeyDown) -> None: |
103 | 110 | else: |
104 | 111 | libtcodpy.sys_save_screenshot() |
105 | 112 | print("png") |
106 | | - elif event.sym == tcod.event.KeySym.ESCAPE: |
107 | | - raise SystemExit |
108 | 113 | elif event.sym in RENDERER_KEYS: |
109 | 114 | # Swap the active context for one with a different renderer. |
110 | 115 | init_context(RENDERER_KEYS[event.sym]) |
111 | 116 |
|
112 | | - def ev_quit(self, event: tcod.event.Quit) -> None: |
113 | | - raise SystemExit |
114 | | - |
115 | 117 |
|
116 | 118 | class TrueColorSample(Sample): |
117 | 119 | def __init__(self) -> None: |
@@ -1364,6 +1366,8 @@ def main() -> None: |
1364 | 1366 | sample_console.blit(root_console, SAMPLE_SCREEN_X, SAMPLE_SCREEN_Y) |
1365 | 1367 | draw_stats() |
1366 | 1368 | if context.sdl_renderer: |
| 1369 | + context.sdl_renderer.draw_color = (0, 0, 0, 255) |
| 1370 | + context.sdl_renderer.clear() |
1367 | 1371 | # SDL renderer support, upload the sample console background to a minimap texture. |
1368 | 1372 | sample_minimap.update(sample_console.rgb.T["bg"]) |
1369 | 1373 | # Render the root_console normally, this is the drawing step of context.present without presenting. |
@@ -1419,6 +1423,8 @@ def handle_events() -> None: |
1419 | 1423 | SAMPLES[cur_sample].dispatch(event) |
1420 | 1424 | if isinstance(event, tcod.event.Quit): |
1421 | 1425 | raise SystemExit |
| 1426 | + if isinstance(event, tcod.event.KeyDown) and event.sym == tcod.event.KeySym.ESCAPE: |
| 1427 | + raise SystemExit |
1422 | 1428 |
|
1423 | 1429 |
|
1424 | 1430 | def draw_samples_menu() -> None: |
|
0 commit comments