예제 #1
0
 @Override
 public void draw(GOut g) {
   Coord dc = new Coord();
   for (dc.y = 0; dc.y < sz.y; dc.y += texpap.sz().y) {
     for (dc.x = 0; dc.x < sz.x; dc.x += texpap.sz().x) {
       g.image(texpap, dc);
     }
   }
   g.chcolor();
   int y = -cury;
   synchronized (lines) {
     for (Text line : lines) {
       int dy1 = sz.y + y;
       int dy2 = dy1 + line.sz().y;
       if ((dy2 > 0) && (dy1 < sz.y)) {
         g.image(line.tex(), new Coord(margin, dy1));
       }
       y += line.sz().y;
     }
   }
   if (maxy > sz.y) {
     int fx = sz.x - sflarp.sz().x;
     int cx = fx + (sflarp.sz().x / 2) - (schain.sz().x / 2);
     for (y = 0; y < sz.y; y += schain.sz().y - 1) {
       g.image(schain, new Coord(cx, y));
     }
     double a = (double) (cury - sz.y) / (double) (maxy - sz.y);
     int fy = (int) ((sz.y - sflarp.sz().y) * a);
     g.image(sflarp, new Coord(fx, fy));
   }
 }
예제 #2
0
 public void draw(GOut g) {
   g.chcolor(0, 0, 0, 160);
   if (ctl == null || csz == null) {
     return;
   }
   g.frect(ctl, csz);
   g.chcolor();
   cdraw(g.reclip(xlate(Coord.z, true), asz));
   if (cap != null) {
     topless.draw(g, new Coord(0, th), sz.sub(0, th));
     g.image(tleft, Coord.z);
     Coord tmul = new Coord(tleft.sz().x, tdh);
     Coord tmbr = new Coord(sz.x - tright.sz().x, th);
     for (int x = tmul.x; x < tmbr.x; x += tmain.sz().x) {
       g.image(tmain, new Coord(x, tdh), tmul, tmbr);
     }
     g.image(tright, new Coord(sz.x - tright.sz().x, tdh));
     g.image(cap.tex(), capc.sub(0, cap.sz().y));
   } else {
     wbox.draw(g, Coord.z, sz);
   }
   /*
   if(cap != null) {
       GOut cg = og.reclip(new Coord(0, -7), sz.add(0, 7));
       int w = cap.tex().sz().x;
       cg.image(cl, new Coord((sz.x / 2) - (w / 2) - cl.sz().x, 0));
       cg.image(cm, new Coord((sz.x / 2) - (w / 2), 0), new Coord(w, cm.sz().y));
       cg.image(cr, new Coord((sz.x / 2) + (w / 2), 0));
       cg.image(cap.tex(), new Coord((sz.x / 2) - (w / 2), 0));
   }
   */
   super.draw(g);
 }
예제 #3
0
파일: GOut.java 프로젝트: krvd/hnh_union
 public void atext(String text, Coord c, double ax, double ay) {
   Text t = Text.render(text);
   Tex T = t.tex();
   Coord sz = t.sz();
   image(T, c.add((int) ((double) sz.x * -ax), (int) ((double) sz.y * -ay)));
   T.dispose();
   checkerr();
 }
예제 #4
0
 public void tick(double dt) {
   if (updt) {
     nw = 0;
     int aw = 0;
     for (TypeMod m : mods) {
       if (m.rn == null) {
         try {
           BufferedImage img = m.t.get().layer(Resource.imgc).img;
           String nm = m.t.get().layer(Resource.tooltip).t;
           Text rt = tnf.render(nm);
           int h = Inventory.sqsz.y;
           BufferedImage buf = TexI.mkbuf(new Coord(img.getWidth() + 10 + rt.sz().x, h));
           Graphics g = buf.getGraphics();
           g.drawImage(img, 0, (h - img.getHeight()) / 2, null);
           g.drawImage(rt.img, img.getWidth() + 10, (h - rt.sz().y) / 2, null);
           g.dispose();
           m.rn = new TexI(rasterimg(blurmask2(buf.getRaster(), 2, 1, new Color(32, 0, 0))));
           m.rh = new TexI(rasterimg(blurmask2(buf.getRaster(), 2, 1, new Color(192, 128, 0))));
         } catch (Loading l) {
         }
       }
       if (m.ra == null) {
         Text rt =
             tnf.render(
                 (int) Math.round(m.a * 100) + "%",
                 new Color(255, (int) (255 * m.a), (int) (255 * m.a)));
         m.ra = new TexI(rasterimg(blurmask2(rt.img.getRaster(), 2, 1, new Color(0, 0, 0))));
       }
       nw = Math.max(nw, m.rn.sz().x);
       aw = Math.max(aw, m.ra.sz().x);
     }
     int h = (Inventory.sqsz.y + 5) * mods.size();
     h += levels.sz().y + 20;
     resize(new Coord(Math.max(nw + 20 + aw, boxsz.x), h));
     this.c = Gobble.this.parentpos(parent).add(boxc).add(0, boxsz.y + 5);
     updt = false;
   }
 }
예제 #5
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;
 }
예제 #6
0
 public void draw(GOut g) {
   g.chcolor(new Color(255, 255, 255, (int) (255 * a)));
   g.image(pbg, new Coord(3, 3), new Coord(3, 3), sz.add(new Coord(-6, -6)));
   pbox.draw(g, Coord.z, sz);
   g.image(text.tex(), sz.div(2).sub(text.sz().div(2)));
 }
예제 #7
0
 public Petal(String name) {
   super(Coord.z);
   this.name = name;
   text = ptf.render(name, ptc);
   resize(text.sz().x + 25, ph);
 }
예제 #8
0
 public Coord sz() {
   if (r == null) return (text().sz());
   else return (r.sz());
 }
예제 #9
0
 public Coord sz() {
   return (t.sz());
 }