Mercurial > touhou
comparison scripts/anmviewer @ 546:94dd9862c470
Rename the eosd script into pytouhou, and remove the obsolete pcb one.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 21 May 2014 20:52:42 +0200 |
parents | anmviewer@77c0e9a53795 |
children | e15672733c93 |
comparison
equal
deleted
inserted
replaced
545:bcff39c920ab | 546:94dd9862c470 |
---|---|
1 #!/usr/bin/env python2 | |
2 # -*- encoding: utf-8 -*- | |
3 ## | |
4 ## Copyright (C) 2011 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | |
5 ## | |
6 ## This program is free software; you can redistribute it and/or modify | |
7 ## it under the terms of the GNU General Public License as published | |
8 ## by the Free Software Foundation; version 3 only. | |
9 ## | |
10 ## This program is distributed in the hope that it will be useful, | |
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ## GNU General Public License for more details. | |
14 ## | |
15 | |
16 import argparse | |
17 import os | |
18 | |
19 from pytouhou.ui.window import Window | |
20 from pytouhou.resource.loader import Loader | |
21 from pytouhou.ui.anmrenderer import ANMRenderer | |
22 | |
23 | |
24 def main(path, data, name, script, entry, sprites, fixed_pipeline): | |
25 resource_loader = Loader() | |
26 resource_loader.scan_archives(os.path.join(path, name) for name in data) | |
27 | |
28 window = Window((384, 448), fixed_pipeline=fixed_pipeline, sound=False) | |
29 | |
30 # Get out animation | |
31 anm = resource_loader.get_anm(name) | |
32 renderer = ANMRenderer(window, resource_loader, anm[entry], script, sprites) | |
33 window.set_runner(renderer) | |
34 window.run() | |
35 | |
36 | |
37 parser = argparse.ArgumentParser(description='Viewer of ANM files, archives containing animations used in Touhou games.') | |
38 | |
39 parser.add_argument('data', metavar='DAT', default=('CM.DAT', 'ST.DAT'), nargs='*', help='Game’s .DAT data files') | |
40 parser.add_argument('-p', '--path', metavar='DIRECTORY', default='.', help='Game directory path.') | |
41 parser.add_argument('--anm', metavar='ANM', required=True, help='Select an ANM') | |
42 parser.add_argument('--script', metavar='SCRIPT', type=int, default=0, help='First script to play') | |
43 parser.add_argument('--entry', metavar='ENTRY', type=int, default=0, help='Entry to display, in multi-entries ANMs.') | |
44 parser.add_argument('--sprites', action='store_true', default=False, help='Display sprites instead of scripts.') | |
45 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') | |
46 | |
47 args = parser.parse_args() | |
48 | |
49 main(args.path, tuple(args.data), args.anm, args.script, args.entry, args.sprites, | |
50 args.fixed_pipeline) |