Package pythagoras.f

Examples of pythagoras.f.Point


        for (int ii = 0; ii < frames.length; ii++) {
            Json.Object frame = jframes.getObject(ii);
            Json.TypedArray<Float> off = frame.getArray("off", Float.class);
            Json.TypedArray<Float> src = frame.getArray("src", Float.class);
            frames[frame.getInt("idx")] = new Frame(
                new Point(off.get(0), off.get(1)),
                new Rectangle(src.get(0), src.get(1), src.get(2), src.get(3)));
        }
        return frames;
    }
View Full Code Here


     * Parses custom float[][] array generated the {@code FramePacker} tool.
     */
    protected static Frame[] parseFrames (float[][] meta) {
        Frame[] frames = new Frame[(meta.length-1)/2];
        for (int ii = 0, mm = 1; ii < frames.length; ii++) {
            frames[ii] = new Frame(new Point(meta[mm][0], meta[mm++][1]),
                                   new Rectangle(meta[mm][0], meta[mm][1],
                                                 meta[mm][2], meta[mm++][3]));
        }
        return frames;
    }
View Full Code Here

            return _layer.parent() == null;
        }
        @Override public boolean hitTest (IPoint p) {
            // convert the screen coordinates into layer-relative coordinates and check that the
            // point falls within the (layer-transform-relative) bounds
            return _bounds.contains(Layer.Util.screenToLayer(_layer, p, new Point()));
        }
View Full Code Here

        @Override public boolean hasExpired () {
            return _layer.parent() == null;
        }
        @Override public boolean hitTest (IPoint p) {
            // convert the screen coordinates into layer-relative coordinates
            Point lp = Layer.Util.screenToLayer(_layer, p, new Point());
            float x = lp.x, y = lp.y;
            return (x > 0 && y > 0 && x < _layer.scaledWidth() && y < _layer.scaledHeight());
        }
View Full Code Here

    protected abstract static class Reactor<L> {
        public L hitTest (Events.Position event) {
            // take a snapshot of the regions list to avoid concurrent modification if reactions
            // are added or removed during processing
            List<Reaction<L>> snapshot = new ArrayList<Reaction<L>>(_reactions);
            Point p = new Point(event.x(), event.y());
            for (int ii = snapshot.size() - 1; ii >= 0; ii--) {
                Reaction<L> r = snapshot.get(ii);
                if (r.region.hasExpired()) {
                    _reactions.remove(r);
                } else if (r.region.canTrigger() && r.region.hitTest(p)) {
View Full Code Here

            public float maxDistanceSq;

            /** Creates a new tracking state with the given starting press event. */
            public State (Pointer.Event event) {
                pressTime = event.time();
                toPoint(event, press = new Point());
                drag = new Point(press);
            }
View Full Code Here

    }

    protected static Point getPoint (Json.Object json, String field, float defX, float defY)
    {
        Json.TypedArray<Float> array = json.getArray(field, Float.class);
        return (array != null) ? new Point(array.get(0), array.get(1)) : new Point(defX, defY);
    }
View Full Code Here

            return json;
        }

        public TextureData (DataInputStream istream) throws IOException {
            symbol = istream.readUTF();
            origin = new Point(istream.readFloat(), istream.readFloat());
            rect = new float[] { istream.readFloat(), istream.readFloat(), istream.readFloat(),
                istream.readFloat() };
        }
View Full Code Here

TOP

Related Classes of pythagoras.f.Point

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.