Very very basic wall rendering for opengl
This commit is contained in:
parent
c8080cb025
commit
42d707f8a4
Binary file not shown.
Binary file not shown.
@ -160,7 +160,7 @@ public:
|
|||||||
void xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h);
|
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 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 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 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);
|
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);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "../data/font.h"
|
#include "../data/font.h"
|
||||||
int PIXELMETHODS_CLASS::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
|
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))
|
if(!strlen(s))
|
||||||
return 0;
|
return 0;
|
||||||
int oR = r, oG = g, oB = b;
|
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();
|
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 fx = float(x)+0.5f;
|
||||||
float fy = float(y)+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;
|
//height-=2;
|
||||||
//width-=2;
|
//width-=2;
|
||||||
glColor4ub(r, g, b, a);
|
glColor4ub(r, g, b, a);
|
||||||
|
if(hollow)
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
|
else
|
||||||
|
glBegin(GL_QUADS);
|
||||||
glVertex2f(fx, fy);
|
glVertex2f(fx, fy);
|
||||||
glVertex2f(fx+fwidth, fy);
|
glVertex2f(fx+fwidth, fy);
|
||||||
glVertex2f(fx+fwidth, fy+fheight);
|
glVertex2f(fx+fwidth, fy+fheight);
|
||||||
|
@ -576,7 +576,6 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
|||||||
|
|
||||||
void Renderer::DrawWalls()
|
void Renderer::DrawWalls()
|
||||||
{
|
{
|
||||||
#ifndef OGLR
|
|
||||||
int x, y, i, j, cr, cg, cb;
|
int x, y, i, j, cr, cg, cb;
|
||||||
unsigned char wt;
|
unsigned char wt;
|
||||||
pixel pc;
|
pixel pc;
|
||||||
@ -593,6 +592,13 @@ void Renderer::DrawWalls()
|
|||||||
continue;
|
continue;
|
||||||
pc = wtypes[wt].colour;
|
pc = wtypes[wt].colour;
|
||||||
gc = wtypes[wt].eglow;
|
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
|
// standard wall patterns
|
||||||
if (wtypes[wt].drawstyle==1)
|
if (wtypes[wt].drawstyle==1)
|
||||||
@ -708,9 +714,11 @@ void Renderer::DrawWalls()
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
|
this->drawrect(x*CELL,y*CELL,CELL,CELL,r,g,b,a,false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::DrawSigns()
|
void Renderer::DrawSigns()
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
void xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h);
|
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 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 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 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);
|
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);
|
||||||
|
Reference in New Issue
Block a user