Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__
.vscode
21 changes: 21 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[source]]

url = "https://github.com/trprado/roguelike_tutorial_revised_tdl"
verify_ssl = true
name = "roguelike tutorial revised with tdl"


[dev-packages]

pylint = "*"


[packages]

tdl = "*"



[requires]

python_version = "3.6"
15 changes: 9 additions & 6 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def main():
con = tdl.Console(screen_width, screen_height)

while not tdl.event.is_window_closed():
user_input = None

con.draw_char(player_x, player_y, '@', bg=None, fg=(255, 255, 255))
root_console.blit(con, 0, 0, screen_width, screen_height, 0, 0)
tdl.flush()
Expand All @@ -26,8 +28,8 @@ def main():
if event.type == 'KEYDOWN':
user_input = event
break
else:
user_input = None
else:
user_input = None

if not user_input:
continue
Expand All @@ -42,11 +44,12 @@ def main():
dx, dy = move
player_x += dx
player_y += dy
elif exit:
if tdl.get_fullscreen():
tdl.set_fullscreen(False)
break

if exit:
return True

if fullscreen:
elif fullscreen:
tdl.set_fullscreen(not tdl.get_fullscreen())


Expand Down
2 changes: 1 addition & 1 deletion input_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def handle_keys(user_input):
elif user_input.key == 'RIGHT':
return {'move': (1, 0)}

if user_input.key == 'ENTER' and user_input.alt:
if user_input.key == 'ENTER' and user_input.control:
# Alt+Enter: toggle full screen
return {'fullscreen': True}
elif user_input.key == 'ESCAPE':
Expand Down