Skip to content

Commit 9eaf8e2

Browse files
committed
Update context examples.
1 parent c937f0f commit 9eaf8e2

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

docs/tcod/getting-started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Example::
3737
# Create the main console.
3838
console = tcod.Console(WIDTH, HEIGHT)
3939
# Create a window based on this console and tileset.
40-
with tcod.context.new_terminal(
41-
console.width, console.height, tileset=tileset,
40+
with tcod.context.new( # New window for a console of size columns×rows.
41+
columns=console.width, rows=console.height, tileset=tileset,
4242
) as context:
4343
while True: # Main loop, runs until SystemExit is raised.
4444
console.clear()
@@ -88,8 +88,8 @@ Example::
8888

8989
def main() -> None:
9090
"""Script entry point."""
91-
with tcod.context.new_window(
92-
WIDTH, HEIGHT, sdl_window_flags=FLAGS
91+
with tcod.context.new( # New window with pixel resolution of width×height.
92+
width=WIDTH, height=HEIGHT, sdl_window_flags=FLAGS
9393
) as context:
9494
# Create the console based on the context.
9595
console = tcod.Console(*context.recommended_console_size())

examples/eventget.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def main() -> None:
2020
event_log: List[str] = []
2121
motion_desc = ""
2222

23-
with tcod.context.new_window(
24-
WIDTH, HEIGHT, sdl_window_flags=FLAGS
23+
with tcod.context.new(
24+
width=WIDTH, height=HEIGHT, sdl_window_flags=FLAGS
2525
) as context:
2626
console = tcod.Console(*context.recommended_console_size())
2727
while True:
@@ -42,9 +42,7 @@ def main() -> None:
4242
if event.type == "QUIT":
4343
raise SystemExit()
4444
if event.type == "WINDOWRESIZED":
45-
console = tcod.Console(
46-
*context.recommended_console_size()
47-
)
45+
console = tcod.Console(*context.recommended_console_size())
4846
if event.type == "MOUSEMOTION":
4947
motion_desc = str(event)
5048
else:

0 commit comments

Comments
 (0)