Пример #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) {
   Tex at = null;
   if (none) {
   } else if (myown != null) {
     at = myown;
   } else {
     Gob gob = ui.sess.glob.oc.getgob(avagob);
     Avatar ava = null;
     if (gob != null) ava = gob.getattr(Avatar.class);
     if (ava != null) at = ava.rend;
   }
   GOut g2 = g.reclip(Window.wbox.tloff().add(unborder.inv()), asz);
   int yo;
   if (at == null) {
     at = missing;
     yo = 0;
   } else {
     g2.image(Equipory.bg, new Coord(Equipory.bg.sz().x / 2 - asz.x / 2, 20).inv());
     yo = (20 * asz.y) / dasz.y;
   }
   Coord tsz = new Coord((at.sz().x * asz.x) / dasz.x, (at.sz().y * asz.y) / dasz.y);
   g2.image(at, new Coord(tsz.x / 2 - asz.x / 2, yo).inv(), tsz);
   g.chcolor(color);
   Window.wbox.draw(g, Coord.z, asz.add(Window.wbox.bisz()).add(unborder.mul(2).inv()));
 }
 /*     */ public void draw(GOut g) {
   /*  80 */ g.chcolor(new Color(255, 255, 255, (int) (255.0D * this.a)));
   /*  81 */ g.image(
       FlowerMenu.pbg, new Coord(3, 3), new Coord(3, 3), this.sz.add(new Coord(-6, -6)));
   /*  82 */ FlowerMenu.pbox.draw(g, Coord.z, this.sz);
   /*  83 */ g.image(this.text.tex(), this.sz.div(2).add(this.text.sz().div(2).inv()));
   /*     */ }
Пример #4
0
 private void drawsel(GOut g, Message msg, int y) {
   RichText rt = (RichText) msg.text();
   boolean sel = msg != selstart.msg;
   for (RichText.Part part = rt.parts; part != null; part = part.next) {
     if (!(part instanceof RichText.TextPart)) continue;
     RichText.TextPart tp = (RichText.TextPart) part;
     if (tp.start == tp.end) continue;
     TextHitInfo a, b;
     if (sel) {
       a = TextHitInfo.leading(0);
     } else if (tp == selstart.part) {
       a = selstart.ch;
       sel = true;
     } else {
       continue;
     }
     if (tp == selend.part) {
       sel = false;
       b = selend.ch;
     } else {
       b = TextHitInfo.trailing(tp.end - tp.start - 1);
     }
     Coord ul = new Coord(tp.x + (int) tp.advance(0, a.getInsertionIndex()), tp.y + y);
     Coord sz =
         new Coord((int) tp.advance(a.getInsertionIndex(), b.getInsertionIndex()), tp.height());
     g.chcolor(0, 0, 255, 255);
     g.frect(ul, sz);
     g.chcolor();
     if (!sel) break;
   }
 }
Пример #5
0
 public GOut reclipl(Coord ul, Coord sz) {
   GOut g = new GOut(this);
   g.tx = this.tx.add(ul);
   g.ul = new Coord(g.tx);
   g.sz = sz;
   return (g);
 }
Пример #6
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);
  }
Пример #7
0
 public void draw(GOut g) {
   try {
     Resource res = item.res.get();
     Tex tex = res.layer(Resource.imgc).tex();
     drawmain(g, tex);
     if (item.num >= 0) {
       g.atext(Integer.toString(item.num), tex.sz(), 1, 1);
     } else if (itemnum.get() != null) {
       g.aimage(itemnum.get(), tex.sz(), 1, 1);
     }
     if (item.meter > 0) {
       double a = ((double) item.meter) / 100.0;
       g.chcolor(255, 255, 255, 64);
       Coord half = Inventory.isqsz.div(2);
       g.prect(half, half.inv(), half, a * Math.PI * 2);
       g.chcolor();
     }
     if (olcol.get() != null) {
       if (cmask != res) {
         mask = null;
         if (tex instanceof TexI) mask = ((TexI) tex).mkmask();
         cmask = res;
       }
       if (mask != null) {
         g.chcolor(olcol.get());
         g.image(mask, Coord.z);
         g.chcolor();
       }
     }
   } catch (Loading e) {
     missing.loadwait();
     g.image(missing.layer(Resource.imgc).tex(), Coord.z, sz);
   }
 }
Пример #8
0
 @Override
 public void draw(GOut g) {
   g.state(smat);
   g.apply();
   this.posa.bind(g, false);
   this.nrma.bind(g, false);
   this.sidx.rewind();
   g.gl.glDrawElements(4, this.sidx.capacity(), 5123, this.sidx);
   this.posa.unbind(g);
   this.nrma.unbind(g);
 }
Пример #9
0
 public GOut reclip(Coord ul, Coord sz) {
   GOut g = new GOut(this);
   g.tx = this.tx.add(ul);
   g.ul = new Coord(g.tx);
   Coord gbr = g.ul.add(sz), tbr = this.ul.add(this.sz);
   if (g.ul.x < this.ul.x) g.ul.x = this.ul.x;
   if (g.ul.y < this.ul.y) g.ul.y = this.ul.y;
   if (gbr.x > tbr.x) gbr.x = tbr.x;
   if (gbr.y > tbr.y) gbr.y = tbr.y;
   g.sz = gbr.sub(g.ul);
   return (g);
 }
Пример #10
0
 @Override
 public void draw(GOut g) {
   Equipory e = ui.gui.getEquipory();
   if (e != null) {
     g.rimage(Window.bg, Coord.z, sz);
     g.image(sq, Coord.z);
     WItem w = e.slots[index];
     if (w != null) {
       w.draw(g.reclipl(sq.sz().sub(w.sz).div(2), g.sz));
     }
   }
 }
Пример #11
0
 public void draw(GOut g) {
   super.draw(g);
   if (lvlmask != null) {
     long now = System.currentTimeMillis();
     if (now - lvltime > 1000) {
       lvlmask.dispose();
       lvlmask = null;
     } else {
       g.chcolor(255, 255, 255, 255 - (int) ((255 * (now - lvltime)) / 1000));
       g.image(lvlmask, Coord.z);
     }
   }
 }
Пример #12
0
 // draw profits at minimap
 public static void drawProfitMinimap(GOut g, Coord tc, Coord hsz) {
   if (UI.instance.minimap == null) return;
   synchronized (UI.instance.minimap.profits) {
     for (Pair<Coord, Color> arg : UI.instance.minimap.profits) {
       Coord ptc = arg.fst.div(tileSize).add(tc.inv()).add(hsz.div(2));
       g.chcolor(Color.BLACK);
       g.fellipse(ptc, new Coord(5, 5));
       g.chcolor(arg.snd);
       g.fellipse(ptc, new Coord(3, 3));
       g.chcolor();
     }
   }
 }
Пример #13
0
  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);
    }
  }
Пример #14
0
 // draw vision square
 public static void drawVisSquare(GOut g, Coord tc, Coord hsz) {
   if (JSBotUtils.playerID == -1) return;
   if (UI.instance.minimap == null) return;
   Coord current;
   if (JSBotUtils.getPlayerSelf() == null) current = new Coord(0, 0);
   else {
     if (JSBotUtils.getPlayerSelf() == null) current = new Coord(0, 0);
     else current = JSBotUtils.getPlayerSelf().position();
   }
   Coord ptc = current.div(tileSize).add(tc.inv()).add(hsz.div(2));
   g.chcolor(255, 255, 255, 64);
   g.frect(ptc.sub(42, 42), new Coord(85, 85));
   g.chcolor();
 }
Пример #15
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);
 }
Пример #16
0
  void redraw(GL2 gl) {
    if (uncaught != null)
      throw (new RuntimeException(
          "Exception occurred during init but was somehow discarded", uncaught));
    if ((state == null) || (state.cgl.gl != gl))
      state = new GLState.Applier(new CurrentGL(gl, glconf));

    Frame f;
    synchronized (curdraw) {
      f = curdraw[0];
      curdraw[0] = null;
    }
    if ((f != null) && (f.on.gl == gl)) {
      GPUProfile.Frame curgf = null;
      if (Config.profilegpu) curgf = gprof.new Frame((GL3) gl);
      if (f.pf != null) f.pf.tick("awt");
      f.buf.run(gl);
      GOut.checkerr(gl);
      if (f.pf != null) f.pf.tick("gl");
      if (curgf != null) {
        curgf.tick("draw");
        curgf.fin();
      }

      if (glconf.pref.dirty) {
        glconf.pref.save();
        glconf.pref.dirty = false;
      }
      f.doneat = System.currentTimeMillis();
    }
  }
Пример #17
0
  public void draw(GOut g) {
    Coord2d mc = MapView.pllastcc;
    if (mc == null) return;

    Gob gob = (Gob) owner;
    Coord3f pc = gob.getc();
    double lcx = mc.x;
    double lcy = mc.y;
    double x = lcx - pc.x;
    double y = -lcy + pc.y;
    double z = Math.sqrt(x * x + y * y) >= 44 * 11 ? 0 : gob.glob.map.getcz(lcx, lcy) - pc.z;

    g.apply();
    BGL gl = g.gl;
    gl.glLineWidth(2.0F);
    gl.glEnable(GL2.GL_BLEND);
    gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
    gl.glEnable(GL2.GL_LINE_SMOOTH);
    gl.glHint(GL2.GL_LINE_SMOOTH_HINT, GL2.GL_NICEST);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0, 0, 0);
    gl.glVertex3f((float) x, (float) y, (float) z);
    gl.glEnd();
    gl.glDisable(GL2.GL_LINE_SMOOTH);
  }
Пример #18
0
 public void drawmain(GOut g, Tex tex) {
   g.image(tex, Coord.z);
   if (tex != ltex) {
     resize(upsize(tex.sz()));
     ltex = tex;
   }
 }
Пример #19
0
 public void draw(GOut g) {
   try {
     if (spr == null) spr = GSprite.create(this, res.get(), sdt.clone());
     spr.draw(g);
   } catch (Loading e) {
   }
   if (num != null) g.aimage(num, Inventory.sqsz, 1.0, 1.0);
 }
Пример #20
0
 public void draw(GOut g) {
   int tn = 0;
   int y = 0;
   int h = Inventory.sqsz.y;
   boolean[] hl = new boolean[mods.size()];
   if (lfood != null) {
     for (int t : lfood.types) hl[t] = true;
   }
   g.aimage(levels, new Coord(sz.x / 2, y), 0.5, 0);
   y += levels.sz().y + 20;
   for (TypeMod m : mods) {
     if (m.rn != null) g.image(hl[tn] ? m.rh : m.rn, new Coord(0, y));
     if (m.ra != null) g.image(m.ra, new Coord(nw + 20, y + ((h - m.ra.sz().y) / 2)));
     tn++;
     y += h + 5;
   }
 }
Пример #21
0
 @Override
 public void draw(GOut g) {
   Equipory e = ui.gui.getEquipory();
   if (e != null) {
     g.rimage(Window.bg, Coord.z, sz);
     g.image(sq, Coord.z);
     if (ui.gui.handSave.size() > 0) {
       for (GameUI.DraggedItem di : ui.gui.handSave) {
         GSprite spr = di.item.spr();
         if (spr != null) {
           int w = Math.min(spr.sz().x, sq.sz().x - 5);
           int h = Math.min(spr.sz().y, sq.sz().y - 5);
           spr.draw(g.reclipl(sq.sz().sub(w, h).div(2), g.sz.sub(5, 5)));
         }
         break;
       }
     }
   }
 }
Пример #22
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);
 }
Пример #23
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()));
           }
         });
   }
 }
Пример #24
0
  public void drawsmall(GOut g, Coord br, int h) {
    Coord c;
    if (qline != null) {
      if ((rqline == null) || !rqline.text.equals(qline.line)) {
        String pre = String.format("%s> ", qline.chan.name());
        rqline = qfnd.render(pre + qline.line);
        rqpre = pre.length();
      }
      c = br.sub(0, 20);
      g.chcolor(24, 24, 16, 200);
      g.frect(c, rqline.tex().sz());
      g.chcolor();
      g.image(rqline.tex(), c);
      int lx = rqline.advance(qline.point + rqpre);
      g.line(new Coord(br.x + lx + 1, br.y - 18), new Coord(br.x + lx + 1, br.y - 6), 1);
    } else {
      c = br.sub(0, 5);
    }
    long now = System.currentTimeMillis();
    synchronized (notifs) {
      for (Iterator<Notification> i = notifs.iterator(); i.hasNext(); ) {
        Notification n = i.next();
        if (now - n.time > 5000) {
          i.remove();
          continue;
        }
        if ((c.y -= n.msg.sz().y) < br.y - h) break;

        g.chcolor(24, 24, 16, 200);
        g.frect(c, n.chnm.tex().sz().add(n.msg.tex().sz().x + selw, 0));
        g.chcolor();
        g.image(n.chnm.tex(), c, br.sub(0, h), br.add(selw - 10, 0));
        g.image(n.msg.tex(), c.add(selw, 0));
      }
    }
  }
Пример #25
0
 public void drawicons(GOut g) {
   OCache oc = ui.sess.glob.oc;
   synchronized (oc) {
     for (Gob gob : oc) {
       try {
         GobIcon icon = gob.getattr(GobIcon.class);
         if (icon != null) {
           Coord gc = p2c(gob.rc);
           Tex tex = icon.tex();
           g.image(tex, gc.sub(tex.sz().div(2)));
         }
       } catch (Loading l) {
       }
     }
   }
 }
Пример #26
0
 public void draw(GOut g) {
   g.chcolor(64, 64, 64, 192);
   g.frect(Coord.z, sz);
   int i = s;
   int y = 0;
   synchronized (chls) {
     while (i < chls.size()) {
       DarkChannel ch = chls.get(i);
       if (ch.chan == sel) {
         g.chcolor(128, 128, 192, 255);
         g.frect(new Coord(0, y), new Coord(sz.x, 19));
       }
       g.chcolor(255, 255, 255, 255);
       if ((ch.rname == null) || !ch.rname.text.equals(ch.chan.name()))
         ch.rname = nf.render(ch.chan.name());
       g.aimage(ch.rname.tex(), new Coord(sz.x / 2, y + 10), 0.5, 0.5);
       g.line(new Coord(5, y + 19), new Coord(sz.x - 5, y + 19), 1);
       y += 20;
       if (y >= sz.y) break;
       i++;
     }
   }
   g.chcolor();
 }
Пример #27
0
  void redraw(GL2 gl) {
    if ((state == null) || (state.cgl.gl != gl))
      state = new GLState.Applier(new CurrentGL(gl, glconf));

    Frame f = curdraw;
    if ((f != null) && (f.on.gl == gl)) {
      GPUProfile.Frame curgf = null;
      if (Config.profilegpu) curgf = gprof.new Frame((GL3) gl);
      if (f.pf != null) f.pf.tick("awt");
      f.buf.run(gl);
      GOut.checkerr(gl);
      if (f.pf != null) f.pf.tick("gl");
      if (curgf != null) {
        curgf.tick("draw");
        curgf.fin();
      }

      if (glconf.pref.dirty) {
        glconf.pref.save();
        glconf.pref.dirty = false;
      }
      f.doneat = System.currentTimeMillis();
    }
  }
Пример #28
0
 public GOut reclip(Coord ul, Coord sz) {
   GOut g = new GOut(this);
   g.ul = this.ul.add(ul);
   g.sz = sz;
   return (g);
 }
Пример #29
0
 @Override
 public void draw(GOut g, Coord c) {
   g.aimage(getText().tex(), c, 0, 0);
 }
Пример #30
0
 @Override
 protected void drawitem(GOut g, QualityList.SingleType item, int i) {
   g.image(item.tex(), Q_TYPE_PADDING);
 }