MCPcopy Create free account
hub / github.com/demoth/jake2 / DrawConsole

Method DrawConsole

client/src/main/java/jake2/client/Console.java:494–598  ·  view source on GitHub ↗

Draws the console with the solid background @param frac - percentage of screen to occupy by console, (from 0 to 1)

(float frac)

Source from the content-addressed store, hash-verified

492 * @param frac - percentage of screen to occupy by console, (from 0 to 1)
493 */
494 static void DrawConsole(float frac) {
495
496 int width = ClientGlobals.viddef.getWidth();
497 int height = ClientGlobals.viddef.getHeight();
498 int lines = (int) (height * frac);
499 if (lines <= 0)
500 return;
501
502 if (lines > height)
503 lines = height;
504
505 // draw the background
506 ClientGlobals.re.DrawStretchPic(0, -height + lines, width, height, "conback");
507 SCR.AddDirtyPoint(0, 0);
508 SCR.AddDirtyPoint(width - 1, lines - 1);
509
510 String version = Com.sprintf("v%4.2f", new Vargs(1).add(VERSION));
511 for (int x = 0; x < 5; x++)
512 ClientGlobals.re
513 .DrawChar(width - 44 + x * 8, lines - 12, 128 + version
514 .charAt(x));
515
516 // draw the text
517 ClientGlobals.con.vislines = lines;
518
519 int rows = (lines - 22) >> 3; // rows of text to draw
520
521 int y = lines - 30;
522
523 // draw from the bottom up
524 if (ClientGlobals.con.display != ClientGlobals.con.current) {
525 // draw arrows to show the buffer is backscrolled
526 for (int x = 0; x < ClientGlobals.con.linewidth; x += 4)
527 ClientGlobals.re.DrawChar((x + 1) << 3, y, '^');
528
529 y -= 8;
530 rows--;
531 }
532
533 int i, j, x, n;
534
535 int row = ClientGlobals.con.display;
536 for (i = 0; i < rows; i++, y -= 8, row--) {
537 if (row < 0)
538 break;
539 if (ClientGlobals.con.current - row >= ClientGlobals.con.totallines)
540 break; // past scrollback wrap point
541
542 int first = (row % ClientGlobals.con.totallines) * ClientGlobals.con.linewidth;
543
544 for (x = 0; x < ClientGlobals.con.linewidth; x++)
545 ClientGlobals.re.DrawChar((x + 1) << 3, y, ClientGlobals.con.text[x + first]);
546 }
547
548 // ZOID
549 // draw the download bar
550 // figure out width
551 if (ClientGlobals.cls.download != null) {

Callers 1

DrawConsoleMethod · 0.95

Calls 8

AddDirtyPointMethod · 0.95
sprintfMethod · 0.95
DrawInputMethod · 0.95
getWidthMethod · 0.80
getHeightMethod · 0.80
DrawStretchPicMethod · 0.65
DrawCharMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected