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); }
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); } }
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; } }
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) { 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())); } }); } }
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; } }
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); } } }
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); }
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)); } } }
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(); }
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())); } }); } }
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); }
public void draw(GOut g) { if (cc == null) return; map: { final Grid plg; try { plg = ui.sess.glob.map.getgrid(cc.div(cmaps)); } catch (Loading l) { break map; } final int seq = plg.seq; if ((cur == null) || (plg != cur.grid) || (seq != cur.seq)) { Defer.Future<MapTile> f; synchronized (cache) { f = cache.get(new Pair<Grid, Integer>(plg, seq)); if (f == null) { f = Defer.later( new Defer.Callable<MapTile>() { public MapTile call() { Coord ul = plg.ul.sub(cmaps).add(1, 1); return (new MapTile( new TexI(drawmap(ul, cmaps.mul(3).sub(2, 2))), ul, plg, seq)); } }); cache.put(new Pair<Grid, Integer>(plg, seq), f); } } if (f.done()) { cur = f.get(); if (save != null) save.update(ui.sess.glob.map, cur.grid.gc); } } } if (cur != null) { g.image(MiniMap.bg, Coord.z); g.image(cur.img, cur.ul.sub(cc).add(sz.div(2))); try { synchronized (ui.sess.glob.party.memb) { for (Party.Member m : ui.sess.glob.party.memb.values()) { Coord ptc; try { ptc = m.getc(); } catch (MCache.LoadingMap e) { ptc = null; } if (ptc == null) continue; ptc = p2c(ptc); g.chcolor(m.col.getRed(), m.col.getGreen(), m.col.getBlue(), 128); g.image( MiniMap.plx.layer(Resource.imgc).tex(), ptc.add(MiniMap.plx.layer(Resource.negc).cc.inv())); g.chcolor(); } } } catch (Loading l) { } } else { g.image(MiniMap.nomap, Coord.z); } drawicons(g); }