diff engine/core/video/opengl/renderbackendopengl.cpp @ 631:f3457443c95f

* Added drawRectangle() and fillRectangle() functions to the renderers * Modified FIFE::FloatingTextRenderer to use the new functions * Updated some data types in FIFE::FloatingTextRenderer to use integer types defined in fife_stdint.h
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 05 Oct 2010 15:44:16 +0000
parents 853d25234671
children 46b95d06c8c2
line wrap: on
line diff
--- a/engine/core/video/opengl/renderbackendopengl.cpp	Mon Oct 04 21:29:12 2010 +0000
+++ b/engine/core/video/opengl/renderbackendopengl.cpp	Tue Oct 05 15:44:16 2010 +0000
@@ -218,6 +218,28 @@
 		glEnd();
 	}
 
+	void RenderBackendOpenGL::drawRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
+		glColor4ub(r, g, b, a);
+
+		glBegin(GL_LINE_LOOP);
+		glVertex2f(p.x, p.y);
+		glVertex2f(p.x+w, p.y);
+		glVertex2f(p.x+w, p.y+h);
+		glVertex2f(p.x, p.y+h);
+		glEnd();
+	}
+
+	void RenderBackendOpenGL::fillRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
+		glColor4ub(r, g, b, a);
+
+		glBegin(GL_QUADS);
+		glVertex2f(p.x, p.y);
+		glVertex2f(p.x+w, p.y);
+		glVertex2f(p.x+w, p.y+h);
+		glVertex2f(p.x, p.y+h);
+		glEnd();
+	}
+
 	void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4,  int r, int g, int b, int a) {
 		glColor4ub(r, g, b, a);