Files
RPG_curses/main.py
2025-05-18 11:48:19 +08:00

31 lines
822 B
Python

# main.py
import curses
from menus import main_menu, start_game_menu, settings_menu, credits_menu
from world import game_loop, init_objects
from config import init_colors, player, camera
def main(stdscr):
curses.curs_set(0)
init_colors()
h,w=stdscr.getmaxyx()
height, width = h-1, w
player["x"],player["y"]=0,0
camera["x"],camera["y"] = player["x"]-width//2, player["y"]-height//2
init_objects(width, height)
while True:
choice=main_menu(stdscr)
if choice==-1: break
elif choice==0:
mode=start_game_menu(stdscr)
if mode in (0,1): game_loop(stdscr, width, height)
elif choice==1: settings_menu(stdscr)
elif choice==2: credits_menu(stdscr)
elif choice==3: break
if __name__=="__main__":
curses.wrapper(main)