Package playn.core

Examples of playn.core.Layer


    protected Element () {
        // optimize hit testing by checking our bounds first
        layer.setHitTester(new Layer.HitTester() {
            public Layer hitTest (Layer layer, Point p) {
                Layer hit = null;
                if (isVisible() && contains(p.x, p.y)) {
                    if (isSet(Flag.HIT_DESCEND)) hit = layer.hitTestDefault(p);
                    if (hit == null && isSet(Flag.HIT_ABSORB)) hit = layer;
                }
                return hit;
View Full Code Here


    public TiledImageBackground (Image image) {
        _image = image;
    }

    @Override protected Instance instantiate (final IDimension size) {
        Layer layer = graphics().createImmediateLayer(new ImmediateLayer.Renderer() {
            public void render (Surface surf) {
                // avoid rendering an unready image (which will have zero width/height) which will
                // cause the infinite loopage
                if (!_image.isReady()) return;
                if (alpha != null) surf.setAlpha(alpha);
View Full Code Here

        /** Creates a new activation. */
        public Activation (Pop pop) {
            this.pop = pop;

            // handle pointer events from the relay
            Layer target = pop._relayTarget;
            if (target != null) pointerRelay = relayEvents(target, pop.menu);
        }
View Full Code Here

    public static Initializer layer (final Layer layer) {
        return new Initializer() {
            @Override public void willInit (int count) {
                // concatenate the transform of all layers above our target layer
                xform.setTransform(1, 0, 0, 1, 0, 0);
                Layer xlayer = layer;
                while (xlayer != null) {
                    xform.preConcatenate((InternalTransform)xlayer.transform());
                    xlayer = xlayer.parent();
                }
                // finally pre-concatenate the root transform as we're bypassing normal rendering
                xform.preConcatenate(graphics().ctx().rootTransform());
                xform.get(_matrix);
            }
View Full Code Here

        super(layout);

        // use a hit tester "eater" to pretend our layer covers all its siblings
        layer.setHitTester(new Layer.HitTester() {
            @Override public Layer hitTest (Layer layer, Point p) {
                Layer descendant = layer.hitTestDefault(p);
                return descendant == null ? absorbHits() ? layer : null : descendant;
            }
        });

        // deactivate the menu on any pointer events (children will still get theirs)
View Full Code Here

    }

    /** Gets the item underneath the given event. */
    protected MenuItem getHover (Events.Position e) {
        // manual hit detection
        Layer hit = layer.hitTest(Layer.Util.screenToLayer(layer, e.x(), e.y()));

        for (MenuItem item : _items) {
            if (item.isVisible() && item.layer == hit) {
                return item;
            }
View Full Code Here

TOP

Related Classes of playn.core.Layer

Copyright © 2018 www.massapicom. 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.