changeset 140:3fddb45c0304

edited the loaders, images are now loaded only once into memory
author thebastion@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 28 Sep 2008 11:12:36 +0000
parents 2cc01d9433ab
children 5e85737281bc
files doc/AUTHORS engine/extensions/pychan/manager.py engine/extensions/serializers/xmlanimation.py engine/extensions/serializers/xmlobject.py
diffstat 4 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/doc/AUTHORS	Sat Sep 27 23:33:17 2008 +0000
+++ b/doc/AUTHORS	Sun Sep 28 11:12:36 2008 +0000
@@ -39,6 +39,7 @@
 spq >> spq@my-ct.de
 stro >> stroantree@gmail.com
 tesseract >> josh_root@users.sourceforge.net
+thebastion >> s.klytta@gmx.eu
 trapdoor >> ko2fan@gmail.com
 undeadinsanity >> arron@arronbailiss.co.uk
 vja >> vja@inbox.ru
--- a/engine/extensions/pychan/manager.py	Sat Sep 27 23:33:17 2008 +0000
+++ b/engine/extensions/pychan/manager.py	Sun Sep 28 11:12:36 2008 +0000
@@ -125,7 +125,7 @@
 		return style_copy
 
 	def loadImage(self,filename):
-		return fife.GuiImage(self.engine.imagePool.addResourceFromFile(filename),self.engine.imagePool)
+		return fife.GuiImage(self.engine.imagePool.getIndex(filename),self.engine.imagePool)
 
 	def defaultWidgetAction(self,event):
 		if self.debug:
--- a/engine/extensions/serializers/xmlanimation.py	Sat Sep 27 23:33:17 2008 +0000
+++ b/engine/extensions/serializers/xmlanimation.py	Sun Sep 28 11:12:36 2008 +0000
@@ -44,10 +44,11 @@
 			path.pop()
 			path.append(str(source))
 
-			image = self.imagepool.getImage(self.imagepool.addResourceFromFile('/'.join(path)))
+			image = self.imagepool.getImage(self.imagepool.getIndex('/'.join(path)))
 			image.setXShift(frame_x_offset)
 			image.setYShift(frame_y_offset)
 			animation.addFrame(image, frame_delay);
 
 		animation.thisown = 0
 		return animation
+
--- a/engine/extensions/serializers/xmlobject.py	Sat Sep 27 23:33:17 2008 +0000
+++ b/engine/extensions/serializers/xmlobject.py	Sun Sep 28 11:12:36 2008 +0000
@@ -99,7 +99,7 @@
 			path.pop()
 			path.append(str(source))
 
-			id = self.image_pool.addResourceFromFile('/'.join(path))
+			id = self.image_pool.getIndex('/'.join(path))
 			object.get2dGfxVisual().addStaticImage(int( image.get('direction', 0) ), id)
 			img = self.image_pool.getImage(id)
 			img.setXShift(int( image.get('x_offset', 0) ))
@@ -126,7 +126,7 @@
 			path.pop()
 			path.append(str(source))
 
-			anim_id = self.anim_pool.addResourceFromFile('/'.join(path))
+			anim_id = self.anim_pool.getIndex('/'.join(path))
 			animation = self.anim_pool.getAnimation(anim_id)
 			action.get2dGfxVisual().addAnimation(int( anim.get('direction', 0) ), anim_id)
 			action.setDuration(animation.getDuration())