Esempio n. 1
0
void CON_Draw(void)
{
    int     line;
    float   y = 0;
    float   x = 0;
    float   inputlen;

    if(oldiwad && !console_enabled)
    {
        Draw_ConsoleText(8, 16, RED, CONFONT_SCALE, "IWAD is out of date. Please use Wadgen to generate a new one");
    }
    
    if(!console_linebuffer)
        return;

    if(!console_enabled)
        return;
    
    GL_SetOrtho(1);
    GL_SetState(GLSTATE_BLEND, 1);

    dglDisable(GL_TEXTURE_2D);
    dglColor4ub(0, 0, 0, 128);
    dglRectf(SCREENWIDTH, CONSOLE_Y + CONFONT_YPAD, 0, 0);

    GL_SetState(GLSTATE_BLEND, 0);
    
    dglColor4f(0, 1, 0, 1);
    dglBegin(GL_LINES);
    dglVertex2f(0, CONSOLE_Y - 1);
    dglVertex2f(SCREENWIDTH, CONSOLE_Y - 1);
    dglVertex2f(0, CONSOLE_Y + CONFONT_YPAD);
    dglVertex2f(SCREENWIDTH, CONSOLE_Y + CONFONT_YPAD);
    dglEnd();
    dglEnable(GL_TEXTURE_2D);
    
    line = console_head;
    
    y = CONSOLE_Y - 2;

    if(line < MAX_CONSOLE_LINES)
    {
        while(console_buffer[line] && y > 0)
        {
            Draw_ConsoleText(0, y, console_buffer[line]->color, CONFONT_SCALE, "%s", console_buffer[line]->line);
            line = (line + 1) & CONSOLETEXT_MASK;
            y -= CONFONT_YPAD;
        }
    }

    Draw_ConsoleText(SCREENWIDTH - (64 * CONFONT_SCALE), CONSOLE_Y - 2,
        RED, CONFONT_SCALE, "rev. %s", PACKAGE_VERSION);
    
    y = CONSOLE_Y + CONFONT_YPAD;

    inputlen = Draw_ConsoleText(x, y, WHITE, CONFONT_SCALE, "%s", console_inputbuffer);
    Draw_ConsoleText(x + inputlen, y, WHITE, CONFONT_SCALE, "_");
}
Esempio n. 2
0
void ST_FlashingScreen(byte r, byte g, byte b, byte a)
{
	rcolor c = D_RGBA(r, g, b, a);

	GL_SetState(GLSTATE_BLEND, 1);
	GL_SetOrtho(1);

	dglDisable(GL_TEXTURE_2D);
	dglColor4ubv((byte *) & c);
	dglRecti(SCREENWIDTH + ViewBorderX*2, SCREENHEIGHT, 0, 0);
	dglEnable(GL_TEXTURE_2D);

	GL_SetState(GLSTATE_BLEND, 0);
}
Esempio n. 3
0
static void ST_DrawDamageMarkers(void)
{
	damagemarker_t *dmgmarker;

	for (dmgmarker = dmgmarkers.next; dmgmarker != &dmgmarkers;
	     dmgmarker = dmgmarker->next) {
		static vtx_t v[3];
		player_t *p;
		float angle;
		byte alpha;

		GL_SetState(GLSTATE_BLEND, 1);
		GL_SetOrtho(0);

		alpha = (dmgmarker->tics << 3);

		if (alpha < 0)
			alpha = 0;

		v[0].x = -8;
		v[0].a = alpha;
		v[1].x = 8;
		v[1].a = alpha;
		v[2].y = 4;
		v[2].r = 255;
		v[2].a = alpha;

		p = &players[consoleplayer];

		angle = (float)TRUEANGLES(p->mo->angle -
					  R_PointToAngle2(dmgmarker->source->x,
							  dmgmarker->source->y,
							  p->mo->x, p->mo->y));

		dglPushMatrix();
		dglTranslatef(160, 120, 0);
		dglRotatef(angle, 0.0f, 0.0f, 1.0f);
		dglTranslatef(0, 16, 0);
		dglDisable(GL_TEXTURE_2D);
		dglSetVertex(v);
		dglTriangle(0, 1, 2);
		dglDrawGeometry(3, v);
		dglEnable(GL_TEXTURE_2D);
		dglPopMatrix();

		GL_ResetViewport();
		GL_SetState(GLSTATE_BLEND, 0);
	}
}
Esempio n. 4
0
void CON_Draw(void) {
    int     line;
    float   y = 0;
    float   x = 0;
    float   inputlen;

    if(!console_linebuffer) {
        return;
    }

    if(!console_enabled) {
        return;
    }

    GL_SetOrtho(1);
    GL_SetState(GLSTATE_BLEND, 1);

    dglDisable(GL_TEXTURE_2D);
    dglColor4ub(0, 0, 0, 128);
    dglRectf(SCREENWIDTH, CONSOLE_Y + CONFONT_YPAD, 0, 0);

    GL_SetState(GLSTATE_BLEND, 0);

    dglColor4f(0, 1, 0, 1);
    dglBegin(GL_LINES);
    dglVertex2f(0, CONSOLE_Y - 1);
    dglVertex2f(SCREENWIDTH, CONSOLE_Y - 1);
    dglVertex2f(0, CONSOLE_Y + CONFONT_YPAD);
    dglVertex2f(SCREENWIDTH, CONSOLE_Y + CONFONT_YPAD);
    dglEnd();
    dglEnable(GL_TEXTURE_2D);

    line = console_head;

    y = CONSOLE_Y - 2;

    if(line < MAX_CONSOLE_LINES) {
        while(console_buffer[line] && y > 0) {
            Draw_ConsoleText(0, y, console_buffer[line]->color, CONFONT_SCALE, "%s", console_buffer[line]->line);
            line = (line + 1) & CONSOLETEXT_MASK;
            y -= CONFONT_YPAD;
        }
    }

    y = CONSOLE_Y + CONFONT_YPAD;

    inputlen = Draw_ConsoleText(x, y, WHITE, CONFONT_SCALE, "%s", console_inputbuffer);
    Draw_ConsoleText(x + inputlen, y, WHITE, CONFONT_SCALE, "_");
}
Esempio n. 5
0
int Draw_Text(int x, int y, rcolor color, float scale,
              dboolean wrap, const char* string, ...) {
    int c;
    int i;
    int vi = 0;
    int    col;
    const float size = 0.03125f;
    float fcol, frow;
    int start = 0;
    dboolean fill = false;
    char msg[MAX_MESSAGE_SIZE];
    va_list    va;
    const int ix = x;

    va_start(va, string);
    vsprintf(msg, string, va);
    va_end(va);

    GL_SetState(GLSTATE_BLEND, 1);

    if(!r_fillmode.value) {
        dglEnable(GL_TEXTURE_2D);
        dglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
        r_fillmode.value = 1.0f;
        fill = true;
    }

    GL_BindGfxTexture("SFONT", true);

    dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, DGL_CLAMP);
    dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, DGL_CLAMP);

    GL_SetOrthoScale(scale);
    GL_SetOrtho(0);

    dglSetVertex(vtxstring);

    for(i = 0, vi = 0; i < dstrlen(msg); i++, vi += 4) {
        c = toupper(msg[i]);
        if(c == '\t') {
            while(x % 64) {
                x++;
            }
            continue;
        }
        if(c == '\n') {
            y += ST_FONTWHSIZE;
            x = ix;
            continue;
        }
        if(c == 0x20) {
            if(wrap) {
                if(x > 192) {
                    y += ST_FONTWHSIZE;
                    x = ix;
                    continue;
                }
            }
        }
        else {
            start = (c - ST_FONTSTART);
            col = start & (ST_FONTNUMSET - 1);

            fcol = (col * size);
            frow = (start >= ST_FONTNUMSET) ? 0.5f : 0.0f;

            vtxstring[vi + 0].x     = (float)x;
            vtxstring[vi + 0].y     = (float)y;
            vtxstring[vi + 0].tu    = fcol + 0.0015f;
            vtxstring[vi + 0].tv    = frow + size;
            vtxstring[vi + 1].x     = (float)x + ST_FONTWHSIZE;
            vtxstring[vi + 1].y     = (float)y;
            vtxstring[vi + 1].tu    = (fcol + size) - 0.0015f;
            vtxstring[vi + 1].tv    = frow + size;
            vtxstring[vi + 2].x     = (float)x + ST_FONTWHSIZE;
            vtxstring[vi + 2].y     = (float)y + ST_FONTWHSIZE;
            vtxstring[vi + 2].tu    = (fcol + size) - 0.0015f;
            vtxstring[vi + 2].tv    = frow + 0.5f;
            vtxstring[vi + 3].x     = (float)x;
            vtxstring[vi + 3].y     = (float)y + ST_FONTWHSIZE;
            vtxstring[vi + 3].tu    = fcol + 0.0015f;
            vtxstring[vi + 3].tv    = frow + 0.5f;

            dglSetVertexColor(vtxstring + vi, color, 4);

            dglTriangle(vi + 0, vi + 1, vi + 2);
            dglTriangle(vi + 0, vi + 2, vi + 3);

            if(devparm) {
                vertCount += 4;
            }


        }
        x += ST_FONTWHSIZE;
    }

    if(vi) {
        dglDrawGeometry(vi, vtxstring);
    }

    GL_ResetViewport();

    if(fill) {
        dglDisable(GL_TEXTURE_2D);
        dglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        r_fillmode.value = 0.0f;
    }

    GL_SetState(GLSTATE_BLEND, 0);
    GL_SetOrthoScale(1.0f);

    return x;
}