changeset 19:485f4c6dd9fc

added possibility to load subimages: * allow loading via addResourceFromLocation in pool's * added ImageLocation type to swig files * one questions remains: why do we have to give the image filename even if we dont want to use it?
author spq@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 07 Jul 2008 09:44:07 +0000
parents 40a7c9618ade
children 47fff0eee32e
files engine/core/util/resource/resource.i engine/core/video/video.i
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/util/resource/resource.i	Mon Jul 07 01:40:57 2008 +0000
+++ b/engine/core/util/resource/resource.i	Mon Jul 07 09:44:07 2008 +0000
@@ -83,6 +83,7 @@
 		static const int INVALID_ID = -1;
 		virtual ~Pool();
 		virtual int addResourceFromFile(const std::string& filename);
+		virtual int addResourceFromLocation(const ResourceLocation& loc);
 		virtual int getResourceCount(int status);
 		virtual void addResourceLoader(ResourceLoader* loader);
 	private:
--- a/engine/core/video/video.i	Mon Jul 07 01:40:57 2008 +0000
+++ b/engine/core/video/video.i	Mon Jul 07 09:44:07 2008 +0000
@@ -27,6 +27,7 @@
 #include "video/imagepool.h"
 #include "video/animationpool.h"
 #include "video/renderbackend.h"
+#include "video/image_location.h"
 #include "util/base/exception.h"
 %}
 
@@ -36,6 +37,7 @@
 namespace FIFE {
 	class Pool;
 	class Point;
+	class ResourceLocation;
 
 	class AbstractImage {
 	public:
@@ -103,6 +105,22 @@
 		unsigned int getRefCount();
 	};
 
+	class ImageLocation: public ResourceLocation {
+	public:
+		ImageLocation(const std::string& filename);
+		virtual ~ResourceLocation() {};
+		virtual void setXShift(int xshift) { m_xshift = xshift; }
+		virtual int getXShift() const { return m_xshift; }
+		virtual void setYShift(int yshift) { m_yshift = yshift; }
+		virtual int getYShift() const { return m_yshift; }
+		virtual void setWidth(unsigned int width) { m_width = width; }
+		virtual unsigned int getWidth() const { return m_width; }
+		virtual void setHeight(unsigned int height) { m_height = height; }
+		virtual unsigned int getHeight() const { return m_height; }
+		virtual void setParentSource(Image* image) { m_parent_image = image; }
+		virtual Image* getParentSource() const { return m_parent_image; }
+	};
+
 	class ImagePool: public Pool {
 	public:
 		virtual ~ImagePool();