| 34 | void addline(const char *sf) { consolebuffer<cline>::addline(sf, totalmillis); numconlines++; } |
| 35 | |
| 36 | void render() |
| 37 | { |
| 38 | int conwidth = (fullconsole ? VIRTW : int(floor(getradarpos().x)))*2 - 2*CONSPAD - 2*FONTH/3; |
| 39 | int h = VIRTH*2 - 2*CONSPAD - 2*FONTH/3; |
| 40 | int conheight = min(fullconsole ? (h*(fullconsole==1 ? altconsize : fullconsize))/100 : FONTH*consize, h); |
| 41 | |
| 42 | if(fullconsole) blendbox(CONSPAD, CONSPAD, conwidth+CONSPAD+2*FONTH/3, conheight+CONSPAD+2*FONTH/3, true); |
| 43 | |
| 44 | int numl = conlines.length(), offset = min(conskip, numl); |
| 45 | |
| 46 | if(!fullconsole && confade) |
| 47 | { |
| 48 | if(!conskip) |
| 49 | { |
| 50 | numl = 0; |
| 51 | loopvrev(conlines) if(totalmillis-conlines[i].millis < confade*1000) { numl = i+1; break; } |
| 52 | } |
| 53 | else offset--; |
| 54 | } |
| 55 | |
| 56 | int y = 0; |
| 57 | loopi(numl) //determine visible height |
| 58 | { |
| 59 | // shuffle backwards to fill if necessary |
| 60 | int idx = offset+i < numl ? offset+i : --offset; |
| 61 | char *line = conlines[idx].line; |
| 62 | int width, height; |
| 63 | text_bounds(line, width, height, conwidth); |
| 64 | y += height; |
| 65 | if(y > conheight) { numl = i; if(offset == idx) ++offset; break; } |
| 66 | } |
| 67 | y = CONSPAD+FONTH/3; |
| 68 | loopi(numl) |
| 69 | { |
| 70 | int idx = offset + numl-i-1; |
| 71 | char *line = conlines[idx].line; |
| 72 | draw_text(line, CONSPAD+FONTH/3, y, 0xFF, 0xFF, 0xFF, fullconsole ? 0xFF : conalpha, -1, conwidth); |
| 73 | int width, height; |
| 74 | text_bounds(line, width, height, conwidth); |
| 75 | y += height; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | console() : consolebuffer<cline>(200), fullconsole(false) {} |
| 80 | }; |
no test coverage detected