transparency options for console and votes (resolves #45)
This commit is contained in:
@@ -8,6 +8,7 @@ VARP(altconsize, 0, 0, 100);
|
||||
VARP(fullconsize, 0, 40, 100);
|
||||
VARP(consize, 0, 6, 100);
|
||||
VARP(confade, 0, 20, 60);
|
||||
VARP(conalpha, 0, 255, 255);
|
||||
VAR(conopen, 0, 0, 1);
|
||||
VAR(numconlines, 0, 0, 1);
|
||||
|
||||
@@ -68,7 +69,7 @@ struct console : consolebuffer<cline>
|
||||
{
|
||||
int idx = offset + numl-i-1;
|
||||
char *line = conlines[idx].line;
|
||||
draw_text(line, CONSPAD+FONTH/3, y, 0xFF, 0xFF, 0xFF, 0xFF, -1, conwidth);
|
||||
draw_text(line, CONSPAD+FONTH/3, y, 0xFF, 0xFF, 0xFF, fullconsole ? 0xFF : conalpha, -1, conwidth);
|
||||
int width, height;
|
||||
text_bounds(line, width, height, conwidth);
|
||||
y += height;
|
||||
|
||||
+12
-10
@@ -61,6 +61,7 @@ void drawctficon(float x, float y, float s, int col, int row, float ts, int alph
|
||||
}
|
||||
}
|
||||
|
||||
VARP(votealpha, 0, 255, 255);
|
||||
void drawvoteicon(float x, float y, int col, int row, bool noblend)
|
||||
{
|
||||
static Texture *tex = NULL;
|
||||
@@ -68,7 +69,7 @@ void drawvoteicon(float x, float y, int col, int row, bool noblend)
|
||||
if(tex)
|
||||
{
|
||||
if(noblend) glDisable(GL_BLEND);
|
||||
else turn_on_transparency(); // if(transparency && !noblend)
|
||||
else turn_on_transparency(votealpha); // if(transparency && !noblend)
|
||||
drawicon(tex, x, y, 240, col, row, 1/2.0f);
|
||||
if(noblend) glEnable(GL_BLEND);
|
||||
}
|
||||
@@ -994,23 +995,24 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
if(curvote && curvote->millis >= totalmillis && !(hidevote == 1 && curvote->localplayervoted && curvote->result == VOTE_NEUTRAL))
|
||||
{
|
||||
const int left = 20*2, top = VIRTH;
|
||||
draw_textf("%s called a vote:", left, top+240, curvote->owner ? colorname(curvote->owner) : "");
|
||||
draw_textf("%s", left, top+320, curvote->desc);
|
||||
draw_textf("----", left, top+400);
|
||||
draw_textf("%d yes vs. %d no", left, top+480, curvote->stats[VOTE_YES], curvote->stats[VOTE_NO]);
|
||||
defformatstring(str)("%s called a vote:", curvote->owner ? colorname(curvote->owner) : "");
|
||||
draw_text(str, left, top + 240, 255, 255, 255, votealpha);
|
||||
draw_text(curvote->desc, left, top + 320, 255, 255, 255, votealpha);
|
||||
draw_text("----", left, top + 400, 255, 255, 255, votealpha);
|
||||
formatstring(str)("%d yes vs. %d no", curvote->stats[VOTE_YES], curvote->stats[VOTE_NO]);
|
||||
draw_text(str, left, top + 480, 255, 255, 255, votealpha);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glColor4f(1.0f, 1.0f, 1.0f, (sinf(lastmillis/100.0f)+1.0f) / 2.0f);
|
||||
switch(curvote->result)
|
||||
{
|
||||
case VOTE_NEUTRAL:
|
||||
drawvoteicon(left, top, 0, 0, true);
|
||||
drawvoteicon(left, top, 0, 0, false);
|
||||
if(!curvote->localplayervoted)
|
||||
draw_textf("\f3press F1/F2 to vote yes or no", left, top+560);
|
||||
draw_text("\f3press F1/F2 to vote yes or no", left, top+560, 255, 255, 255, votealpha);
|
||||
break;
|
||||
default:
|
||||
drawvoteicon(left, top, (curvote->result-1)&1, 1, false);
|
||||
draw_textf("\f3vote %s", left, top+560, curvote->result == VOTE_YES ? "PASSED" : "FAILED");
|
||||
formatstring(str)("\f3vote %s", curvote->result == VOTE_YES ? "PASSED" : "FAILED");
|
||||
draw_text(str, left, top + 560, 255, 255, 255, votealpha);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user