예제 #1
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);
 }
예제 #2
0
  public void draw(GOut g) {
    Coord c = new Coord(xoff, 0);
    for (Spec s : inputs) {
      GOut sg = g.reclip(c, Inventory.invsq.sz());
      sg.image(Inventory.invsq, Coord.z);
      s.draw(sg);
      c = c.add(Inventory.sqsz.x, 0);
    }
    if (qmod != null) {
      g.image(qmodl.tex(), new Coord(0, qmy + 4));
      c = new Coord(xoff, qmy);
      int mx = -1;
      int pw = 0;
      int vl = 1;
      for (Indir<Resource> qm : qmod) {
        try {
          Tex t = qm.get().layer(Resource.imgc).tex();
          g.image(t, c);
          c = c.add(t.sz().x + 1, 0);
          if (c.x > mx) mx = c.x;

          try {
            Glob.CAttr attr = ui.gui.chrwdg.findattr(qm.get().basename());
            if (attr != null) {
              pw++;
              vl *= attr.comp;
              Tex txt = attr.comptex();
              g.image(txt, c);
              c = c.add(txt.sz().x + 8, 0);
            }
          } catch (Exception ignored) {
          }

        } catch (Loading l) {
        }
      }
      if (pw > 0) {
        g.image(
            Text.renderstroked(
                    String.format("Cap: %.0f", Math.floor(Math.pow(vl, 1.0f / pw))),
                    Color.WHITE,
                    Color.BLACK,
                    new Text.Foundry(Text.fraktur, 14).aa(true))
                .tex(),
            new Coord(mx + 30, qmy));
      }
    }
    c = new Coord(xoff, outy);
    for (Spec s : outputs) {
      GOut sg = g.reclip(c, Inventory.invsq.sz());
      sg.image(Inventory.invsq, Coord.z);
      s.draw(sg);
      c = c.add(Inventory.sqsz.x, 0);
    }
    super.draw(g);
  }
예제 #3
0
 public void draw(GOut g) {
   long now = System.currentTimeMillis();
   for (int y = 0; y < gsz.y; y++) {
     for (int x = 0; x < gsz.x; x++) {
       Coord p = bgsz.mul(new Coord(x, y));
       g.image(bg, p);
       Pagina btn = layout[x][y];
       if (btn != null) {
         Tex btex = btn.img.tex();
         g.image(btex, p.add(1, 1));
         if (btn.meter > 0) {
           double m = btn.meter / 1000.0;
           if (btn.dtime > 0) m += (1 - m) * (double) (now - btn.gettime) / (double) btn.dtime;
           m = Utils.clip(m, 0, 1);
           g.chcolor(255, 255, 255, 128);
           g.fellipse(p.add(bgsz.div(2)), bgsz.div(2), 90, (int) (90 + (360 * m)));
           g.chcolor();
         }
         if (btn.newp != 0) {
           if (btn.fstart == 0) {
             btn.fstart = now;
           } else {
             double ph = ((now - btn.fstart) / 1000.0) - (((x + (y * gsz.x)) * 0.15) % 1.0);
             if (ph < 1.25) {
               g.chcolor(255, 255, 255, (int) (255 * ((Math.cos(ph * Math.PI * 2) * -0.5) + 0.5)));
               g.image(glowmask(btn), p.sub(4, 4));
               g.chcolor();
             } else {
               g.chcolor(255, 255, 255, 128);
               g.image(glowmask(btn), p.sub(4, 4));
               g.chcolor();
             }
           }
         }
         if (btn == pressed) {
           g.chcolor(new Color(0, 0, 0, 128));
           g.frect(p.add(1, 1), btex.sz());
           g.chcolor();
         }
       }
     }
   }
   super.draw(g);
   if (dragging != null) {
     final Tex dt = dragging.img.tex();
     ui.drawafter(
         new UI.AfterDraw() {
           public void draw(GOut g) {
             g.image(dt, ui.mc.add(dt.sz().div(2).inv()));
           }
         });
   }
 }
예제 #4
0
파일: Widget.java 프로젝트: lcy03406/amber
  public void draw(GOut g, boolean strict) {
    Widget next;

    for (Widget wdg = child; wdg != null; wdg = next) {
      next = wdg.next;
      if (!wdg.visible) continue;
      Coord cc = xlate(wdg.c, true);
      GOut g2;
      if (strict) g2 = g.reclip(cc, wdg.sz);
      else g2 = g.reclipl(cc, wdg.sz);
      wdg.draw(g2);
    }
  }
예제 #5
0
 public void draw(GOut g) {
   long now = System.currentTimeMillis();
   int t = (int) (now % 1000);
   int b = (int) (255 * ((t < 500) ? (t) : (1000 - t)) / 500.0f);
   Inventory.invsq(g, Coord.z, gsz);
   for (int y = 0; y < gsz.y; y++) {
     for (int x = 0; x < gsz.x; x++) {
       Coord p = Inventory.sqoff(new Coord(x, y));
       Pagina btn = layout[x][y];
       if (btn != null) {
         Tex btex = btn.img.tex();
         if (btn.newp) {
           g.chcolor(b, 255, b, 255);
         }
         g.image(btex, p);
         g.chcolor();
         if (btn.meter > 0) {
           double m = btn.meter / 1000.0;
           if (btn.dtime > 0) m += (1 - m) * (double) (now - btn.gettime) / (double) btn.dtime;
           m = Utils.clip(m, 0, 1);
           g.chcolor(255, 255, 255, 128);
           g.fellipse(
               p.add(Inventory.isqsz.div(2)), Inventory.isqsz.div(2), 90, (int) (90 + (360 * m)));
           g.chcolor();
         }
         if (btn == pressed) {
           g.chcolor(new Color(0, 0, 0, 128));
           g.frect(p, btex.sz());
           g.chcolor();
         }
       }
     }
   }
   super.draw(g);
   if (dragging != null) {
     final Tex dt = dragging.img.tex();
     ui.drawafter(
         new UI.AfterDraw() {
           public void draw(GOut g) {
             g.image(dt, ui.mc.add(dt.sz().div(2).inv()));
           }
         });
   }
 }
예제 #6
0
 public void draw(GOut g) {
   g.chcolor(24, 24, 16, 200);
   g.frect(Coord.z, sz);
   g.chcolor();
   int y = 0;
   boolean sel = false;
   synchronized (msgs) {
     for (Message msg : msgs) {
       if ((selstart != null) && (msg == selstart.msg)) sel = true;
       int y1 = y - sb.val;
       int y2 = y1 + msg.sz().y;
       if ((y2 > 0) && (y1 < ih())) {
         if (sel) drawsel(g, msg, y1);
         g.image(msg.tex(), new Coord(0, y1));
       }
       if ((selend != null) && (msg == selend.msg)) sel = false;
       y += msg.sz().y;
     }
   }
   sb.max = y - ih();
   super.draw(g);
 }
예제 #7
0
 public void draw(GOut g) {
   update();
   super.draw(g);
 }