summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Hoyle <starfoxprime@gmail.com>2012-08-15 03:18:39 (GMT)
committer Bryan Hoyle <starfoxprime@gmail.com>2012-08-15 03:18:39 (GMT)
commit42d707f8a432afa001d58611fc960d6ce6021676 (patch)
tree63654e26cb9dfddc6b82250cb3703e1f86f98ec9 /src
parentc8080cb0251890b3a9513756e2438ca0f03ffbd6 (diff)
downloadpowder-42d707f8a432afa001d58611fc960d6ce6021676.zip
powder-42d707f8a432afa001d58611fc960d6ce6021676.tar.gz
Very very basic wall rendering for opengl
Diffstat (limited to 'src')
-rw-r--r--src/graphics/Graphics.h2
-rw-r--r--src/graphics/OpenGLDrawMethods.inl8
-rw-r--r--src/graphics/Renderer.cpp12
-rw-r--r--src/graphics/Renderer.h2
4 files changed, 18 insertions, 6 deletions
diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h
index 46d28b4..01318c8 100644
--- a/src/graphics/Graphics.h
+++ b/src/graphics/Graphics.h
@@ -160,7 +160,7 @@ public:
void xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h);
void draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a);
- void drawrect(int x, int y, int width, int height, int r, int g, int b, int a);
+ void drawrect(int x, int y, int width, int height, int r, int g, int b, int a,bool hollow=true);
void fillrect(int x, int y, int width, int height, int r, int g, int b, int a);
void clearrect(int x, int y, int width, int height);
void gradientrect(int x, int y, int width, int height, int r, int g, int b, int a, int r2, int g2, int b2, int a2);
diff --git a/src/graphics/OpenGLDrawMethods.inl b/src/graphics/OpenGLDrawMethods.inl
index ac99165..cbf3113 100644
--- a/src/graphics/OpenGLDrawMethods.inl
+++ b/src/graphics/OpenGLDrawMethods.inl
@@ -1,6 +1,7 @@
#include "../data/font.h"
int PIXELMETHODS_CLASS::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
{
+ bool invert = false;
if(!strlen(s))
return 0;
int oR = r, oG = g, oB = b;
@@ -281,7 +282,7 @@ void PIXELMETHODS_CLASS::draw_line(int x, int y, int x2, int y2, int r, int g, i
glEnd();
}
-void PIXELMETHODS_CLASS::drawrect(int x, int y, int width, int height, int r, int g, int b, int a)
+void PIXELMETHODS_CLASS::drawrect(int x, int y, int width, int height, int r, int g, int b, int a,bool hollow)
{
float fx = float(x)+0.5f;
float fy = float(y)+0.5f;
@@ -292,7 +293,10 @@ void PIXELMETHODS_CLASS::drawrect(int x, int y, int width, int height, int r, in
//height-=2;
//width-=2;
glColor4ub(r, g, b, a);
- glBegin(GL_LINE_STRIP);
+ if(hollow)
+ glBegin(GL_LINE_STRIP);
+ else
+ glBegin(GL_QUADS);
glVertex2f(fx, fy);
glVertex2f(fx+fwidth, fy);
glVertex2f(fx+fwidth, fy+fheight);
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index 0d739ed..f39e476 100644
--- a/src/graphics/Renderer.cpp
+++ b/src/graphics/Renderer.cpp
@@ -576,7 +576,6 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
void Renderer::DrawWalls()
{
-#ifndef OGLR
int x, y, i, j, cr, cg, cb;
unsigned char wt;
pixel pc;
@@ -593,6 +592,13 @@ void Renderer::DrawWalls()
continue;
pc = wtypes[wt].colour;
gc = wtypes[wt].eglow;
+#ifdef OGLR
+ int r = (pc&0x00FF0000)>>8;
+ int g = (pc&0x0000FF00)>>4;
+ int b = (pc&0x000000FF)>>0;
+ int a = 255;
+#endif
+#ifndef OGLR
// standard wall patterns
if (wtypes[wt].drawstyle==1)
@@ -708,8 +714,10 @@ void Renderer::DrawWalls()
fire_b[y][x] = cb;
}
- }
+#else
+ this->drawrect(x*CELL,y*CELL,CELL,CELL,r,g,b,a,false);
#endif
+ }
}
void Renderer::DrawSigns()
diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h
index 6e814cc..b4f730f 100644
--- a/src/graphics/Renderer.h
+++ b/src/graphics/Renderer.h
@@ -105,7 +105,7 @@ public:
void xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h);
void draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a);
- void drawrect(int x, int y, int width, int height, int r, int g, int b, int a);
+ void drawrect(int x, int y, int width, int height, int r, int g, int b, int a,bool hollow = true);
void fillrect(int x, int y, int width, int height, int r, int g, int b, int a);
void clearrect(int x, int y, int width, int height);
void gradientrect(int x, int y, int width, int height, int r, int g, int b, int a, int r2, int g2, int b2, int a2);