Пример #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
 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;
   }
 }
Пример #3
0
  public void draw(GOut g) {
    updatepos();
    double now = System.currentTimeMillis() / 1000.0;

    for (Buff buff : fv.buffs.children(Buff.class))
      buff.draw(
          g.reclip(
              pcc.add(-buff.c.x - Buff.cframe.sz().x - 20, buff.c.y + pho - Buff.cframe.sz().y),
              buff.sz));
    if (fv.current != null) {
      for (Buff buff : fv.current.buffs.children(Buff.class))
        buff.draw(g.reclip(pcc.add(buff.c.x + 20, buff.c.y + pho - Buff.cframe.sz().y), buff.sz));

      g.aimage(ip.get().tex(), pcc.add(-75, 0), 1, 0.5);
      g.aimage(oip.get().tex(), pcc.add(75, 0), 0, 0.5);
    }

    if (now < fv.atkct) {
      int w = (int) ((fv.atkct - now) * 20);
      g.chcolor(255, 0, 128, 255);
      g.frect(pcc.add(-w, 20), new Coord(w * 2, 15));
      g.chcolor();
    }
    Coord ca = pcc.add(-(actions.length * actpitch) / 2, 45);
    for (int i = 0; i < actions.length; i++) {
      Indir<Resource> act = actions[i];
      try {
        if (act != null) {
          Tex img = act.get().layer(Resource.imgc).tex();
          g.image(img, ca);
          g.image(dyn[i] ? lframe : Buff.frame, ca.sub(Buff.imgoff));
          if (i == use) {
            g.chcolor(255, 0, 128, 255);
            Coord cc = ca.add(img.sz().x / 2, img.sz().y + 5);
            g.frect(cc.sub(2, 2), new Coord(5, 5));
            g.chcolor();
          }
        }
      } catch (Loading l) {
      }
      ca.x += actpitch;
    }
  }
Пример #4
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()));
           }
         });
   }
 }
Пример #5
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();
 }
Пример #6
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));
      }
    }
  }
Пример #7
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();
 }
Пример #8
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()));
           }
         });
   }
 }
Пример #9
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);
 }
Пример #10
0
  void rootdraw(GLState.Applier state, UI ui, BGL gl) {
    GLState.Buffer ibuf = new GLState.Buffer(state.cfg);
    gstate.prep(ibuf);
    ostate.prep(ibuf);
    GOut g = new GOut(gl, state.cgl, state.cfg, state, ibuf, new Coord(w, h));
    state.set(ibuf);

    g.state(ostate);
    g.apply();
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    synchronized (ui) {
      ui.draw(g);
    }

    if (Config.dbtext) {
      int y = h - 150;
      FastText.aprintf(
          g,
          new Coord(10, y -= 15),
          0,
          1,
          "FPS: %d (%d%%, %d%% idle)",
          fps,
          (int) (uidle * 100.0),
          (int) (ridle * 100.0));
      Runtime rt = Runtime.getRuntime();
      long free = rt.freeMemory(), total = rt.totalMemory();
      FastText.aprintf(
          g,
          new Coord(10, y -= 15),
          0,
          1,
          "Mem: %,011d/%,011d/%,011d/%,011d",
          free,
          total - free,
          total,
          rt.maxMemory());
      FastText.aprintf(g, new Coord(10, y -= 15), 0, 1, "Tex-current: %d", TexGL.num());
      FastText.aprintf(g, new Coord(10, y -= 15), 0, 1, "GL progs: %d", g.st.numprogs());
      GameUI gi = ui.root.findchild(GameUI.class);
      if ((gi != null) && (gi.map != null)) {
        try {
          FastText.aprintf(
              g, new Coord(10, y -= 15), 0, 1, "MV pos: %s (%s)", gi.map.getcc(), gi.map.camera);
        } catch (Loading e) {
        }
        if (gi.map.rls != null)
          FastText.aprintf(
              g,
              new Coord(10, y -= 15),
              0,
              1,
              "Rendered: %,d+%,d(%,d)",
              gi.map.rls.drawn,
              gi.map.rls.instanced,
              gi.map.rls.instancified);
      }
      if (Resource.remote().qdepth() > 0)
        FastText.aprintf(
            g,
            new Coord(10, y -= 15),
            0,
            1,
            "RQ depth: %d (%d)",
            Resource.remote().qdepth(),
            Resource.remote().numloaded());
    }
    Object tooltip;
    try {
      synchronized (ui) {
        tooltip = ui.root.tooltip(mousepos, ui.root);
      }
    } catch (Loading e) {
      tooltip = "...";
    }
    Tex tt = null;
    if (tooltip != null) {
      if (tooltip instanceof Text) {
        tt = ((Text) tooltip).tex();
      } else if (tooltip instanceof Tex) {
        tt = (Tex) tooltip;
      } else if (tooltip instanceof Indir<?>) {
        Indir<?> t = (Indir<?>) tooltip;
        Object o = t.get();
        if (o instanceof Tex) tt = (Tex) o;
      } else if (tooltip instanceof String) {
        if (((String) tooltip).length() > 0) tt = (Text.render((String) tooltip)).tex();
      }
    }
    if (tt != null) {
      Coord sz = tt.sz();
      Coord pos = mousepos.add(sz.inv());
      if (pos.x < 0) pos.x = 0;
      if (pos.y < 0) pos.y = 0;
      g.chcolor(244, 247, 21, 192);
      g.rect(pos.add(-3, -3), sz.add(6, 6));
      g.chcolor(35, 35, 35, 192);
      g.frect(pos.add(-2, -2), sz.add(4, 4));
      g.chcolor();
      g.image(tt, pos);
    }
    ui.lasttip = tooltip;
    Resource curs = ui.root.getcurs(mousepos);
    if (curs != null) {
      if (cursmode == "awt") {
        if (curs != lastcursor) {
          try {
            setCursor(makeawtcurs(curs.layer(Resource.imgc).img, curs.layer(Resource.negc).cc));
            lastcursor = curs;
          } catch (Exception e) {
            cursmode = "tex";
          }
        }
      } else if (cursmode == "tex") {
        Coord dc = mousepos.add(curs.layer(Resource.negc).cc.inv());
        g.image(curs.layer(Resource.imgc), dc);
      }
    }
    state.clean();
    GLObject.disposeall(state.cgl, gl);
  }
  void redraw(GL gl) {
    GOut g = new GOut(gl, getContext(), MainFrame.getInnerSize());
    synchronized (ui) {
      ui.update();
    }
    if (Config.render_enable) {
      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glLoadIdentity();
      gl.glOrtho(0, getWidth(), 0, getHeight(), -1, 1);
      TexRT.renderall(g);
      if (curf != null) curf.tick("texrt");

      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glLoadIdentity();
      gl.glOrtho(0, getWidth(), getHeight(), 0, -1, 1);
      gl.glClearColor(0, 0, 0, 1);
      gl.glClear(GL.GL_COLOR_BUFFER_BIT);
      if (curf != null) curf.tick("cls");
      synchronized (ui) {
        ui.draw(g);
      }
      if (curf != null) curf.tick("draw");

      if (Config.dbtext) {
        g.atext("FPS: " + fps, new Coord(10, 545), 0, 1);
        g.atext("Texhit: " + dth, new Coord(10, 530), 0, 1);
        g.atext("Texmiss: " + dtm, new Coord(10, 515), 0, 1);
        Runtime rt = Runtime.getRuntime();
        long free = rt.freeMemory(), total = rt.totalMemory();
        g.atext(
            String.format(
                "Mem: %,011d/%,011d/%,011d/%,011d", free, total - free, total, rt.maxMemory()),
            new Coord(10, 500),
            0,
            1);
        g.atext(
            String.format("LCache: %d/%d", Layered.cache.size(), Layered.cache.cached()),
            new Coord(10, 485),
            0,
            1);
        g.atext(
            String.format("RT-current: %d", TexRT.current.get(gl).size()),
            new Coord(10, 470),
            0,
            1);
        if (Resource.qdepth() > 0)
          g.atext(
              String.format("RQ depth: %d (%d)", Resource.qdepth(), Resource.numloaded()),
              new Coord(10, 455),
              0,
              1);
      }
      Object tooltip = ui.root.tooltip(mousepos, true);
      Tex tt = null;
      if (tooltip != null) {
        if (tooltip instanceof Text) {
          tt = ((Text) tooltip).tex();
        } else if (tooltip instanceof Tex) {
          tt = (Tex) tooltip;
        } else if (tooltip instanceof String) {
          if (((String) tooltip).length() > 0) tt = (Text.render((String) tooltip)).tex();
        }
      }
      if (tt != null) {
        Coord sz = tt.sz();
        Coord pos = mousepos.add(sz.inv());
        if (pos.x < 0) pos.x = 0;
        if (pos.y < 0) pos.y = 0;
        g.chcolor(244, 247, 21, 192);
        g.rect(pos.add(-3, -3), sz.add(6, 6));
        g.chcolor(35, 35, 35, 192);
        g.frect(pos.add(-2, -2), sz.add(4, 4));
        g.chcolor();
        g.image(tt, pos);
      }
    }
    Resource curs = ui.root.getcurs(mousepos);
    if (!curs.loading) {
      if (cursmode == "awt") {
        if (curs != lastcursor) {
          try {
            setCursor(makeawtcurs(curs.layer(Resource.imgc).img, curs.layer(Resource.negc).cc));
            ark.bot.cursor_name = curs.name;
            ark.bot.cursor_name = ark.bot.cursor_name.replace("gfx/hud/curs/", "");
            lastcursor = curs;
          } catch (Exception e) {
            cursmode = "tex";
          }
        }
      } else if (cursmode == "tex") {
        Coord dc = mousepos.add(curs.layer(Resource.negc).cc.inv());
        g.image(curs.layer(Resource.imgc), dc);
      }
    }
  }