changeset 105:2241b0d5379e

use strings as grouping in generic renderer, easier for the clients...
author spq@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 24 Jul 2008 13:20:39 +0000
parents 2c7101e4d81d
children 1fa74d3229d5
files engine/core/view/renderers/genericrenderer.cpp engine/core/view/renderers/genericrenderer.h engine/core/view/renderers/genericrenderer.i
diffstat 3 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/view/renderers/genericrenderer.cpp	Thu Jul 24 10:18:44 2008 +0000
+++ b/engine/core/view/renderers/genericrenderer.cpp	Thu Jul 24 13:20:39 2008 +0000
@@ -305,31 +305,31 @@
 
 	GenericRenderer::~GenericRenderer() {
 	}
-	void GenericRenderer::addLine(int group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b) {
+	void GenericRenderer::addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b) {
 		GenericRendererElementInfo* info = new GenericRendererLineInfo(n1, n2, r, g, b);
 		m_groups[group].push_back(info);
 	}
-	void GenericRenderer::addPoint(int group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b) {
+	void GenericRenderer::addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b) {
 		GenericRendererElementInfo* info = new GenericRendererPointInfo(n, r, g, b);
 		m_groups[group].push_back(info);
 	}
-	void GenericRenderer::addQuad(int group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b) {
+	void GenericRenderer::addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b) {
 		GenericRendererElementInfo* info = new GenericRendererQuadInfo(n1, n2, n3, n4, r, g, b);
 		m_groups[group].push_back(info);
 	}
-	void GenericRenderer::addText(int group, GenericRendererNode n, AbstractFont* font, std::string text) {
+	void GenericRenderer::addText(const std::string &group, GenericRendererNode n, AbstractFont* font, const std::string &text) {
 		GenericRendererElementInfo* info = new GenericRendererTextInfo(n, font, text);
 		m_groups[group].push_back(info);
 	}
-	void GenericRenderer::addImage(int group, GenericRendererNode n, int image) {
+	void GenericRenderer::addImage(const std::string &group, GenericRendererNode n, int image) {
 		GenericRendererElementInfo* info = new GenericRendererImageInfo(n, image);
 		m_groups[group].push_back(info);
 	}
-	void GenericRenderer::addAnimation(int group, GenericRendererNode n, int animation) {
+	void GenericRenderer::addAnimation(const std::string &group, GenericRendererNode n, int animation) {
 		GenericRendererElementInfo* info = new GenericRendererAnimationInfo(n, animation);
 		m_groups[group].push_back(info);
 	}
-	void GenericRenderer::removeAll(int group) {
+	void GenericRenderer::removeAll(const std::string &group) {
 		std::vector<GenericRendererElementInfo*>::const_iterator info_it = m_groups[group].begin();
 		for (;info_it != m_groups[group].end(); ++info_it) {
 			delete *info_it;
@@ -339,7 +339,7 @@
 	}
 
 	void GenericRenderer::render(Camera* cam, Layer* layer, std::vector<Instance*>& instances) {
-		std::map<int, std::vector<GenericRendererElementInfo*> >::iterator group_it = m_groups.begin();
+		std::map<std::string, std::vector<GenericRendererElementInfo*> >::iterator group_it = m_groups.begin();
 		for(; group_it != m_groups.end(); ++group_it) {
 			std::vector<GenericRendererElementInfo*>::const_iterator info_it = group_it->second.begin();
 			for (;info_it != group_it->second.end(); ++info_it) {
--- a/engine/core/view/renderers/genericrenderer.h	Thu Jul 24 10:18:44 2008 +0000
+++ b/engine/core/view/renderers/genericrenderer.h	Thu Jul 24 13:20:39 2008 +0000
@@ -170,18 +170,18 @@
 		 */
 		static GenericRenderer* getInstance(IRendererContainer* cnt);
 
-		void addLine(int group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b);
-		void addPoint(int group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b);
-		void addQuad(int group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b);
-		void addText(int group, GenericRendererNode n, AbstractFont* font, std::string text);
-		void addImage(int group, GenericRendererNode n, int image);
-		void addAnimation(int group, GenericRendererNode n, int animation);
-		void removeAll(int group);
+		void addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b);
+		void addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b);
+		void addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b);
+		void addText(const std::string &group, GenericRendererNode n, AbstractFont* font, const std::string &text);
+		void addImage(const std::string &group, GenericRendererNode n, int image);
+		void addAnimation(const std::string &group, GenericRendererNode n, int animation);
+		void removeAll(const std::string &group);
 
 	private:
 		ImagePool* m_imagepool;
 		AnimationPool* m_animationpool;
-		std::map<int, std::vector<GenericRendererElementInfo*> > m_groups;
+		std::map<std::string, std::vector<GenericRendererElementInfo*> > m_groups;
 	};
 
 }
--- a/engine/core/view/renderers/genericrenderer.i	Thu Jul 24 10:18:44 2008 +0000
+++ b/engine/core/view/renderers/genericrenderer.i	Thu Jul 24 13:20:39 2008 +0000
@@ -141,12 +141,12 @@
 		~GeometricRenderer();
 		std::string getName();
 		static GenericRenderer* getInstance(IRendererContainer* cnt);
-		void addLine(int group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b);
-		void addPoint(int group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b);
-		void addQuad(int group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b);
-		void addText(int group, GenericRendererNode n, AbstractFont* font, std::string text);
-		void addImage(int group, GenericRendererNode n, int image);
-		void addAnimation(int group, GenericRendererNode n, int animation);
-		void removeAll(int group);
+		void addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b);
+		void addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b);
+		void addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b);
+		void addText(const std::string &group, GenericRendererNode n, AbstractFont* font, const std::string &text);
+		void addImage(const std::string &group, GenericRendererNode n, int image);
+		void addAnimation(const std::string &group, GenericRendererNode n, int animation);
+		void removeAll(const std::string &group);
 	};
 }