Mercurial > fife-parpg
comparison demos/rpg/scripts/scene.py @ 512:6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
Changed the keys to be more common. Screenshot is now the print screen key. The console is now the backtick key. Screenshots are now date/time stamped as well.
Removed the scripts/common directory as I have removed the dependency on the EventListenerBase class.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 21 May 2010 17:31:08 +0000 |
parents | |
children | edf5c0cf52f3 |
comparison
equal
deleted
inserted
replaced
511:773dc1dbe69d | 512:6ddb1eb9dfa6 |
---|---|
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 from fife import fife | |
30 from fife.extensions.loaders import loadMapFile | |
31 | |
32 class Scene(object): | |
33 def __init__(self, gamecontroller): | |
34 self._gamecontroller = gamecontroller | |
35 | |
36 self._map = None | |
37 self._cameras = {} | |
38 | |
39 def createScene(self, mapfilename): | |
40 if not self._map: | |
41 self._map = loadMapFile(mapfilename, self._gamecontroller.engine) | |
42 else: | |
43 self.destroyScene() | |
44 | |
45 for cam in self._map.getCameras(): | |
46 self._cameras[cam.getId()] = cam | |
47 | |
48 self._cameras[self._gamecontroller.settings.get("RPG", "DefaultCameraName", "camera1")].setZoom(1.0) | |
49 | |
50 def destroyScene(self): | |
51 self._cameras.clear() | |
52 | |
53 if self._map: | |
54 self._gamecontroller.engine.getModel().deleteMap(self._map) | |
55 | |
56 self._map = None | |
57 | |
58 def updateScene(self): | |
59 pass | |
60 |