Mercurial > fife-parpg
comparison demos/rpg/run.py @ 509:3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 20 May 2010 19:55:19 +0000 |
parents | |
children | 69d50e751c9a |
comparison
equal
deleted
inserted
replaced
508:c8820cc201db | 509:3951042a701e |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 # -*- coding: utf-8 -*- | |
4 | |
5 # #################################################################### | |
6 # Copyright (C) 2005-2010 by the FIFE team | |
7 # http://www.fifengine.net | |
8 # This file is part of FIFE. | |
9 # | |
10 # FIFE is free software; you can redistribute it and/or | |
11 # modify it under the terms of the GNU Lesser General Public | |
12 # License as published by the Free Software Foundation; either | |
13 # version 2.1 of the License, or (at your option) any later version. | |
14 # | |
15 # This library is distributed in the hope that it will be useful, | |
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 # Lesser General Public License for more details. | |
19 # | |
20 # You should have received a copy of the GNU Lesser General Public | |
21 # License along with this library; if not, write to the | |
22 # Free Software Foundation, Inc., | |
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
24 # #################################################################### | |
25 # This is the rio de hola client for FIFE. | |
26 | |
27 import sys, os, re, math, random, shutil | |
28 | |
29 fife_path = os.path.join('..','..','engine','python') | |
30 if os.path.isdir(fife_path) and fife_path not in sys.path: | |
31 sys.path.insert(0,fife_path) | |
32 | |
33 from fife import fife | |
34 print "Using the FIFE python module found here: ", os.path.dirname(fife.__file__) | |
35 | |
36 from fife.extensions.fife_settings import Setting | |
37 from scripts.rpg import RPGApplication | |
38 | |
39 | |
40 TDS = Setting(app_name="rpg", | |
41 settings_file="./settings.xml", | |
42 settings_gui_xml="") | |
43 | |
44 def main(): | |
45 app = RPGApplication(TDS) | |
46 app.run() | |
47 | |
48 if __name__ == '__main__': | |
49 if TDS.get("FIFE", "ProfilingOn"): | |
50 import hotshot, hotshot.stats | |
51 print "Starting profiler" | |
52 prof = hotshot.Profile("fife.prof") | |
53 prof.runcall(main) | |
54 prof.close() | |
55 print "analysing profiling results" | |
56 stats = hotshot.stats.load("fife.prof") | |
57 stats.strip_dirs() | |
58 stats.sort_stats('time', 'calls') | |
59 stats.print_stats(20) | |
60 else: | |
61 if TDS.get("FIFE", "UsePsyco"): | |
62 # Import Psyco if available | |
63 try: | |
64 import psyco | |
65 psyco.full() | |
66 print "Psyco acceleration in use" | |
67 except ImportError: | |
68 print "Psyco acceleration not used" | |
69 else: | |
70 print "Psyco acceleration not used" | |
71 main() |