示例#1
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()));
 }
示例#2
0
 private void makeflavor() {
   @SuppressWarnings("unchecked")
   Collection<Gob>[] fo = (Collection<Gob>[]) new Collection[cutn.x * cutn.y];
   for (int i = 0; i < fo.length; i++) fo[i] = new LinkedList<Gob>();
   Coord c = new Coord(0, 0);
   Coord tc = gc.mul(cmaps);
   int i = 0;
   Random rnd = new Random(id);
   for (c.y = 0; c.y < cmaps.x; c.y++) {
     for (c.x = 0; c.x < cmaps.y; c.x++, i++) {
       Tileset set = tileset(tiles[i]);
       if (set.flavobjs.size() > 0) {
         if (rnd.nextInt(set.flavprob) == 0) {
           Resource r = set.flavobjs.pick(rnd);
           double a = rnd.nextDouble() * 2 * Math.PI;
           Gob g = new Flavobj(c.add(tc).mul(tilesz).add(tilesz.div(2)), a);
           g.setattr(new ResDrawable(g, r));
           Coord cc = c.div(cutsz);
           fo[cc.x + (cc.y * cutn.x)].add(g);
         }
       }
     }
   }
   this.fo = fo;
 }
示例#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
 public void resize(Coord sz) {
   IBox box;
   int th;
   if (cap == null) {
     box = wbox;
     th = 0;
   } else {
     box = topless;
     th = Window.th;
   }
   sz = sz.add(box.bisz()).add(0, th).add(mrgn.mul(2));
   this.sz = sz;
   ctl = box.btloff().add(0, th);
   csz = sz.sub(box.bisz()).sub(0, th);
   atl = ctl.add(mrgn);
   asz = csz.sub(mrgn.mul(2));
   ac = new Coord();
   // ac = tlo.add(wbox.btloff()).add(mrgn);
   placetwdgs();
   for (Widget ch = child; ch != null; ch = ch.next) ch.presize();
 }
示例#5
0
 public MenuGrid() {
   super(bgsz.mul(gsz).add(1, 1));
 }
示例#6
0
 private Avaview(Coord c, Widget parent, Coord asz) {
   super(c, asz.add(Window.wbox.bisz()).add(unborder.mul(2).inv()), parent);
   this.asz = asz;
 }
示例#7
0
 public Grid(Coord gc) {
   this.gc = gc;
   this.ul = gc.mul(cmaps);
   cuts = new Cut[cutn.x * cutn.y];
   for (int i = 0; i < cuts.length; i++) cuts[i] = new Cut();
 }