Stepwise/source/main.py

50 lines
1.2 KiB
Python
Executable File

#!venv/bin/python
import tcod
from engine import Engine
from procgen import generate_floor_map
from message_log import Message
import colors
def main() -> None:
#screen dimensions depend partially on the tileset
tileset = tcod.tileset.load_truetype_font("assets/16 Bit Dreams Mono.ttf", 16, 16)
#how big is the map's dimensions
map_width = 80
map_height = 40
#how big is the UI panel
ui_height = 5
#tcod stuff
context = tcod.context.new(
columns = map_width,
rows = map_height,
tileset = tileset,
title = "Stepwise Roguelike",
vsync = True
)
console = context.new_console(map_width, map_height + ui_height, order="F")
engine = Engine(
#is created externally, because
floor_map = generate_floor_map(map_width, map_height, room_width_max=12, room_height_max=12, room_items_max=4),
ui_height = ui_height,
initial_log= [
Message(" Move/Attack/Scroll: Numpad Pickup: Comma", colors.terminal_dark),
Message(" Open Log: Backtick", colors.terminal_dark),
Message(" Quit: Esc", colors.terminal_dark),
Message(" ~ ~ ~", colors.terminal_dark),
Message("Welcome to the Cave of Gobbos!", colors.cyan),
]
)
#game loop that never returns
engine.run_loop(context, console)
# this seems odd to me
if __name__ == "__main__":
main()