-
Notifications
You must be signed in to change notification settings - Fork 5
/
launchmenu.py
69 lines (50 loc) · 1.59 KB
/
launchmenu.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import argparse
import pygame
from pmmenu import pmmenu
from pmmenu.pmconfig import *
from pmmenu.scenemanager import *
from pmmenu.mainscene import *
from pmmenu.romlistscene import *
parser = argparse.ArgumentParser(description='PiPlay')
parser.add_argument("--quicklaunch", metavar="value", help="Which platform to skip to", type=str)
args = parser.parse_args()
def main():
cfg = PMCfg()
controls = PMControls()
pygame.display.set_caption('PiMAME')
#TODO: need to set_icon
timer = pygame.time.Clock()
running = True
input_test = [pygame.KEYDOWN, pygame.JOYAXISMOTION, pygame.JOYBUTTONDOWN, pygame.MOUSEMOTION, pygame.MOUSEBUTTONUP]
refresh = 0
total_refresh = cfg.options.max_fps * 5
if args.quicklaunch:
manager = SceneManager(cfg, MainScene(), False)
print "Relaunch", args.quicklaunch
for sprite in manager.scene.menu_style:
if sprite.id == int(args.quicklaunch):
manager.go_to(RomListScene(sprite.get_rom_list(), sprite.id))
else:
manager = SceneManager(cfg, MainScene())
while running:
timer.tick(cfg.options.max_fps)
action = None
#if pygame.event.peek(input_test):
action = controls.get_action()
if action == 'QUIT':
pygame.quit()
sys.exit()
update_display = []
if action: update_display = manager.scene.handle_events(action)
#manager.scene.update()
#manager.scene.render(cfg.screen)
if update_display:
pygame.display.update(update_display)
manager.scene.update_display = []
refresh += 1
if refresh == total_refresh:
refresh = 0
pygame.display.flip()
pygame.event.clear()
if __name__ == "__main__":
main()