2022-01-06 11:09:43 -05:00
|
|
|
#!/usr/bin/env python3
|
2022-01-07 15:52:53 -05:00
|
|
|
import copy
|
|
|
|
|
2022-01-06 11:09:43 -05:00
|
|
|
import tcod
|
|
|
|
|
2022-01-11 16:08:57 -05:00
|
|
|
import color
|
2022-01-06 11:28:03 -05:00
|
|
|
from engine import Engine
|
2022-01-07 15:52:53 -05:00
|
|
|
import entity_factories
|
2022-01-06 13:27:15 -05:00
|
|
|
from procgen import generate_dungeon
|
2022-01-06 11:09:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
def main() -> None:
|
|
|
|
screen_width = 80
|
|
|
|
screen_height = 50
|
|
|
|
|
2022-01-06 11:56:08 -05:00
|
|
|
map_width = 80
|
2022-01-11 16:08:57 -05:00
|
|
|
map_height = 43
|
2022-01-06 15:37:22 -05:00
|
|
|
|
|
|
|
room_max_size = 10
|
|
|
|
room_min_size = 6
|
|
|
|
max_rooms = 30
|
2022-01-06 11:56:08 -05:00
|
|
|
|
2022-01-07 15:52:53 -05:00
|
|
|
max_monsters_per_room = 2
|
|
|
|
|
2022-01-06 11:09:43 -05:00
|
|
|
tileset = tcod.tileset.load_tilesheet(
|
|
|
|
"dejavu10x10_gs_tc.png",
|
|
|
|
32,
|
|
|
|
8,
|
|
|
|
tcod.tileset.CHARMAP_TCOD
|
|
|
|
)
|
|
|
|
|
2022-01-07 15:52:53 -05:00
|
|
|
player = copy.deepcopy(entity_factories.player)
|
2022-01-06 11:19:56 -05:00
|
|
|
|
2022-01-07 16:25:07 -05:00
|
|
|
engine = Engine(player)
|
|
|
|
|
|
|
|
engine.game_map = generate_dungeon(
|
2022-01-06 15:37:22 -05:00
|
|
|
max_rooms,
|
|
|
|
room_min_size,
|
|
|
|
room_max_size,
|
|
|
|
map_width,
|
|
|
|
map_height,
|
2022-01-07 15:52:53 -05:00
|
|
|
max_monsters_per_room,
|
2022-01-07 16:25:07 -05:00
|
|
|
engine,
|
2022-01-06 15:37:22 -05:00
|
|
|
)
|
2022-01-07 16:25:07 -05:00
|
|
|
engine.update_fov()
|
2022-01-06 11:28:03 -05:00
|
|
|
|
2022-01-11 16:08:57 -05:00
|
|
|
engine.message_log.add_message(
|
|
|
|
"Hello and welcome, adventurer, to yet another dungeon!",
|
|
|
|
color.welcome_text
|
|
|
|
)
|
|
|
|
|
2022-01-06 11:09:43 -05:00
|
|
|
with tcod.context.new_terminal(
|
2022-01-06 13:27:15 -05:00
|
|
|
screen_width,
|
|
|
|
screen_height,
|
|
|
|
tileset=tileset,
|
|
|
|
title="Yet Another Roguelike Tutorial",
|
|
|
|
vsync=True,
|
2022-01-06 11:09:43 -05:00
|
|
|
) as context:
|
|
|
|
root_console = tcod.Console(screen_width, screen_height, order="F")
|
|
|
|
while True:
|
2022-01-06 11:28:03 -05:00
|
|
|
engine.render(root_console, context)
|
2022-01-06 11:09:43 -05:00
|
|
|
|
2022-01-07 16:25:07 -05:00
|
|
|
engine.event_handler.handle_events()
|
2022-01-06 11:09:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|