-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·43 lines (35 loc) · 1.18 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python2
import libtcodpy as libtcod
import sys, logging, random
from config import *
from game import new_game, load_game
def main_menu():
return 0
def main():
logging.basicConfig(filename='log.txt',level=logging.DEBUG,filemode='w')
logging.debug('start of main')
#initialize main console
font_file = 'data/fonts/terminal10x10_gs_tc.png'
libtcod.console_set_custom_font(font_file, libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_W,SCREEN_H,'GolemRL')
libtcod.sys_set_fps(LIMIT_FPS)
key = libtcod.Key()
mouse = libtcod.Mouse()
while not libtcod.console_is_window_closed():
libtcod.sys_check_for_event(libtcod.EVENT_ANY,key,mouse)
choice = main_menu()
if choice == 0:
seed = random.randrange(10000)
print 'Seed %i'%seed
logging.info('Starting new game with seed %i' % seed)
game = new_game()#seed)
game.play()
elif choice == 1:
game = load_game()
game.play()
elif choice == 2:
break
logging.debug('end of main')
return 0
if __name__ == ('__main__'):
main()