Examples of GroupLayer


Examples of playn.core.GroupLayer

    /**
     * Creates a new group with the given children.
     */
    public static GroupLayer group (Layer... children) {
        GroupLayer gl = PlayN.graphics().createGroupLayer();
        for (Layer l : children) gl.add(l);
        return gl;
    }
View Full Code Here

Examples of playn.core.GroupLayer

        concatTransform(canvas, layer.transform());
        canvas.translate(-layer.originX(), -layer.originY());

        float nalpha = alpha * layer.alpha();
        if (layer instanceof GroupLayer) {
            GroupLayer gl = (GroupLayer)layer;
            for (int ii = 0, ll = gl.size(); ii < ll; ii++) {
                capture(gl.get(ii), canvas, nalpha);
            }

        } else if (layer instanceof ImageLayer) {
            ImageLayer il = (ImageLayer)layer;
            canvas.setAlpha(nalpha);
View Full Code Here

Examples of playn.core.GroupLayer

                bounds.add(Layer.Util.layerToParent(l, root, scratch.set(w, h), scratch));
            }
        }

        if (l instanceof GroupLayer) {
            GroupLayer group = (GroupLayer) l;
            for (int ii = 0, ll = group.size(); ii < ll; ++ii) {
                addBounds(root, group.get(ii), bounds, scratch);
            }
        }
    }
View Full Code Here

Examples of playn.core.GroupLayer

        return this;
    }

    @Override protected Instance instantiate (final IDimension size) {
        // we use one layer, and add the constituents to that
        GroupLayer layer = PlayN.graphics().createGroupLayer();
        final Instance[] instances = new Instance[_constituents.length];

        Insets current = Insets.ZERO;
        for (int ii = 0, ll = _constituents.length; ii < ll; ii++) {
            Background bg = _constituents[ii];

            // create and save off the instance so we can destroy it later
            instances[ii] = instantiate(bg, current.subtractFrom(new Dimension(size)));

            // add to our composite layer and translate the layers added
            instances[ii].addTo(layer, current.left(), current.top(), 0);

            // adjust the bounds
            current = current.mutable().add(bg.insets);
        }

        if (_reverseDepth) {
            // simple reversal, if optimization is needed it would be better to simply
            // instantiate the backgrounds in reverse order above
            Layer[] temp = new Layer[layer.size()];
            for (int ii = 0, nn = layer.size(); ii < nn; ii++) {
                temp[ii] = layer.get(ii);
            }
            float depth = 0;
            for (Layer l : temp) {
                l.setDepth(depth);
                depth -= 1;
View Full Code Here

Examples of playn.core.GroupLayer

        }

        protected void setCurrent (Instance current) {
            if (_current != current) {
                _current = current;
                GroupLayer group = (GroupLayer)content;
                group.removeAll();
                group.add(current.layer());
            }
        }
View Full Code Here

Examples of playn.core.GroupLayer

     * Starts a flipbook animation that displays the supplied {@code book} at the specified
     * position in the supplied parent. The intermediate layers created to display the flipbook
     * animation will be destroyed on completion.
     */
    public Animation flipbookAt (GroupLayer parent, float x, float y, Flipbook book) {
        GroupLayer box = graphics().createGroupLayer();
        box.setTranslation(x, y);
        return add(parent, box).then().flipbook(box, book).then().destroy(box);
    }
View Full Code Here

Examples of playn.core.GroupLayer

            this.tx = tx;
            this.ty = ty;
        }

        @Override public Layer render () {
            GroupLayer layer = PlayN.graphics().createGroupLayer();
            layer.addAt(super.render(), tx, ty);
            return layer;
        }
View Full Code Here

Examples of playn.core.GroupLayer

    return min + (int) (Math.random() * ((max - min) + 1));
  }

  public void drawTransparentImageLayers() {
      // THIS WORKS
    GroupLayer groupLayer = graphics().createGroupLayer();
    groupLayer.add(bgLayer);
    groupLayer.add(redCircle.asImageLayer());
    groupLayer.add(whiteCircle.asImageLayer());
    groupLayer.add(blueCircle.asImageLayer());
    rootLayer.add(groupLayer);
  }
View Full Code Here

Examples of playn.core.GroupLayer

      PlayN.log().info(message);
      logMessages.addFirst(message);
  }
 
  public static void displayLog() {
      GroupLayer logLayer = graphics().createGroupLayer();
     
      // generate log message images
      int logSize = (logMessages.size() >= logDisplayLength) ? logDisplayLength : logMessages.size();
      logCount = 0;
     
      for (int n=0; n<logSize; n++) {
          logCount++;
          String message = logMessages.get(n);
          ImageLayer messageImage = generateLogMessageImageLayer(message);
          Number screenY = logScreenPos.y + (n * (logFontSize + 4));
          messageImage.transform().translate(logScreenPos.x, screenY.floatValue());
          logLayer.add(messageImage);
      }
     
      graphics().rootLayer().add(logLayer);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.