// 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(); } } }
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) { 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())); } }); } }
public void fellipse(Coord c, Coord r) { fellipse(c, r, 0, 360); }