4 # trying to import 'psyco' which precompiles
5 # the program in order to make it faster
6 # [http://psyco.sourceforge.net/]
12 import pygame
, os
, time
, sys
, configobj
13 from pygame
.locals import *
14 sys
.path
.append(os
.path
.join(sys
.path
[0], "data"))
18 cf
= configobj
.ConfigObj(os
.path
.join(sys
.path
[0], 'couchpytato.cfg'))
19 if cf
['sound'] == 'pysonic':
25 resx
= int(cfg
.th
['resolution'][0])
26 resy
= int(cfg
.th
['resolution'][1])
27 pygame
.display
.set_caption('couchpytato')
28 pygame
.display
.set_icon(pygame
.image
.load(os
.path
.join(sys
.path
[0], 'icon.png')))
29 if cfg
.cf
['fullscreen'] == '1':
30 screen
= pygame
.display
.set_mode((resx
, resy
),pygame
.FULLSCREEN
)
32 screen
= pygame
.display
.set_mode((resx
, resy
))
33 pygame
.mouse
.set_visible(False)
34 pygame
.event
.set_blocked(MOUSEMOTION
)
35 pygame
.key
.set_repeat(200, 80)
36 clock
= pygame
.time
.Clock()
39 if pygame
.joystick
.get_init():
40 if pygame
.joystick
.get_count() > 0:
41 joystick
= pygame
.joystick
.Joystick(0)
44 mod
= __import__('mod_mainmenu')
45 pytato
= mod
.Module(screen
)
46 playlist
.PLAYLIST
.load()
50 clock
.tick(int(cfg
.cf
['fps']))
51 for event
in pygame
.event
.get((KEYDOWN
, KEYUP
, QUIT
)):
52 if event
.type == QUIT
:
56 mod
= __import__(pytato
.loadmodule
)
58 mod
= __import__(cfg
.cf
['modules'][pytato
.loadmodule
]['modfilename'])
59 pytato
= mod
.Module(screen
)
60 pytato
.loadmodule
= None
61 pytato
.keyhandler(event
)
62 pytato
.generalkeyhandler(event
)
63 if joystick
: pytato
.joyhandler(joystick
)
67 playlist
.PLAYLIST
.save()