public void onEmit (Keyboard.Event event) { if (event instanceof Keyboard.KeyEvent) { Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event; if (kevent.key == pivotKey && kevent.down) { pivot = new Point(x, y); } } } });
public void onEmit (Keyboard.Event event) { if (event instanceof Keyboard.KeyEvent) { Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event; if (kevent.key == pivotKey && kevent.down) { pivot = new Point(x, y); } } } });
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() }; }
/** * Converts the supplied point from coordinates relative to the specified * layer to screen coordinates. */ public static Point layerToScreen(Layer layer, float x, float y) { Point into = new Point(x, y); return layerToScreen(layer, into, into); }
/** * Converts the supplied point from coordinates relative to the specified * child layer to coordinates relative to the specified parent layer. */ public static Point layerToParent(Layer layer, Layer parent, float x, float y) { Point into = new Point(x, y); return layerToParent(layer, parent, into, into); }
/** * Converts the supplied point from screen coordinates to coordinates * relative to the specified layer. */ public static Point screenToLayer(Layer layer, float x, float y) { Point into = new Point(x, y); return screenToLayer(layer, into, into); }
/** * Converts the supplied point from screen coordinates to coordinates * relative to the specified layer. */ public static Point screenToLayer(Layer layer, float x, float y) { Point into = new Point(x, y); return screenToLayer(layer, into, into); }
/** * Computes and returns the point inside the bounds of the rectangle that's closest to the * given point. */ public static Point closestInteriorPoint (IRectangle r, IPoint p) { return closestInteriorPoint(r, p, new Point()); }
/** * Positions {@code elem} at the specified position, in its preferred size. */ public static <T extends Element<?>> T at (T elem, float x, float y) { return at(elem, new Point(x, y)); }
/** * Converts the supplied point from coordinates relative to the specified * layer to screen coordinates. */ public static Point layerToScreen(Layer layer, float x, float y) { Point into = new Point(x, y); return layerToScreen(layer, into, into); }
/** * Converts the supplied point from coordinates relative to the specified * child layer to coordinates relative to the specified parent layer. */ public static Point layerToParent(Layer layer, Layer parent, float x, float y) { Point into = new Point(x, y); return layerToParent(layer, parent, into, into); }
/** * 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; }
@Override // from IRectangularShape public Point min () { return new Point(minX(), minY()); }
@Override // from IRectangularShape public Point max () { return new Point(maxX(), maxY()); }
/** * Constrains {@code elem} to the specified position and size. */ public static <T extends Element<?>> T at (T elem, float x, float y, float width, float height) { return at(elem, new Point(x, y), new Dimension(width, height)); }
@Override // from IRectangularShape public Point min () { return new Point(minX(), minY()); }
@Override // from IRectangularShape public Point center () { return new Point(centerX(), centerY()); }
@Override // from IRectangularShape public Point center () { return new Point(centerX(), centerY()); }
/** * Computes the total bounds of the layer hierarchy rooted at {@code root}. * The returned Rectangle will be in {@code root}'s coordinate system. */ public static Rectangle totalBounds (Layer root) { // account for root's origin Rectangle r = new Rectangle(root.originX(), root.originY(), 0, 0); addBounds(root, root, r, new Point()); return r; }
@Override public void handleEvent (Event event) { if (event.widget == _platform.graphics().canvas() && (_kfc == null || _kfc.unfocusForLocation(new Point(event.x, event.y)))) { clearFocus(); } } });