Exemplo n.º 1
0
 public Text renderwrap(String text, Color c, int width) {
   if (wfnd == null) wfnd = new RichText.Foundry(font, defcol);
   wfnd.aa = aa;
   text = RichText.Parser.quote(text);
   if (c != null)
     text =
         String.format(
             "$col[%d,%d,%d,%d]{%s}", c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha(), text);
   return (wfnd.render(text, width));
 }
Exemplo n.º 2
0
 public Text text() {
   BuddyWnd.Buddy b = getparent(GameUI.class).buddies.find(from);
   String nm = (b == null) ? "???" : (b.name);
   if ((r == null) || !nm.equals(cn)) {
     String msg = RichText.Parser.quote(String.format("%s: %s", nm, text));
     if (Config.timestamp) {
       msg = Utils.timestamp(msg);
     }
     r = fnd.render(msg, w, TextAttribute.FOREGROUND, col);
     cn = nm;
   }
   return (r);
 }
Exemplo n.º 3
0
 public void append(String line, Color col) {
   Text rl;
   if (quote) {
     line = RichText.Parser.quote(line);
   }
   if (col == null) {
     rl = foundry.render(line, sz.x - (margin * 2) - sflarp.sz().x);
   } else {
     rl = foundry.render(line, sz.x - (margin * 2) - sflarp.sz().x, TextAttribute.FOREGROUND, col);
   }
   synchronized (lines) {
     lines.add(rl);
     if ((maxLines > 0) && (lines.size() > maxLines)) {
       Text tl = lines.remove(0);
       int dy = tl.sz().y;
       maxy -= dy;
       cury -= dy;
     }
   }
   if (cury == maxy) {
     cury += rl.sz().y;
   }
   maxy += rl.sz().y;
 }
Exemplo n.º 4
0
 public SimpleMessage(String text, Color col, int w) {
   if (Config.timestamp) text = Utils.timestamp(text);
   if (col == null) this.t = fnd.render(RichText.Parser.quote(text), w);
   else this.t = fnd.render(RichText.Parser.quote(text), w, TextAttribute.FOREGROUND, col);
 }