comparison 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
comparison
equal deleted inserted replaced
630:010da1d1ee1c 631:f3457443c95f
216 glVertex2f(p2.x, p2.y); 216 glVertex2f(p2.x, p2.y);
217 glVertex2f(p3.x, p3.y); 217 glVertex2f(p3.x, p3.y);
218 glEnd(); 218 glEnd();
219 } 219 }
220 220
221 void RenderBackendOpenGL::drawRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
222 glColor4ub(r, g, b, a);
223
224 glBegin(GL_LINE_LOOP);
225 glVertex2f(p.x, p.y);
226 glVertex2f(p.x+w, p.y);
227 glVertex2f(p.x+w, p.y+h);
228 glVertex2f(p.x, p.y+h);
229 glEnd();
230 }
231
232 void RenderBackendOpenGL::fillRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
233 glColor4ub(r, g, b, a);
234
235 glBegin(GL_QUADS);
236 glVertex2f(p.x, p.y);
237 glVertex2f(p.x+w, p.y);
238 glVertex2f(p.x+w, p.y+h);
239 glVertex2f(p.x, p.y+h);
240 glEnd();
241 }
242
221 void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b, int a) { 243 void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b, int a) {
222 glColor4ub(r, g, b, a); 244 glColor4ub(r, g, b, a);
223 245
224 glBegin(GL_QUADS); 246 glBegin(GL_QUADS);
225 glVertex2f(p1.x, p1.y); 247 glVertex2f(p1.x, p1.y);