Point

Methods
6
Fields
2

Getting one

Point.new(…)
Perspective.localToCanvas(…)
Perspective.getCanvasTextLocation(…)

Methods

MethodReturnsDescription
getX()numberThe x coordinate.
getY()numberThe y coordinate.
distanceTo(Point)numberThe Euclidean distance to other, truncated to an int; the differences wrap as 32-bit integers.
distance(Point)number(Point, Point) -> number: The Euclidean distance to pt, as a double (not truncated, unlike distanceTo).
distance(number, number)number
equals(any)booleanWhether obj is a Point with the same x and y; anything else is false. == is identity: the same object.
new(number, number)Point(number, number) -> Point: The point x, y.
new(Point)Point
new()Point

Fields

FieldTypeDescription
xnumberThe x coordinate.
ynumberThe y coordinate.

Returned by

MethodReturnsDescription
Actor.getCanvasImageLocationPoint?The canvas point that centres image over the actor, zOffset up: its top-left corner, or nil when the point does not project.
Actor.getCanvasSpriteLocationPoint?The canvas point that centres sprite over the actor, zOffset up: its top-left corner, or nil when the point does not project.
Actor.getCanvasTextLocationPoint?The canvas point to draw text at, centred over the actor zOffset up: the anchor's x less half the text's width in the graphics' current…
Actor.getCanvasTextLocationForWidthPoint?The point getCanvasTextLocation(graphics, text, zOffset) gives, for text textWidth pixels wide, without a graphics (outside a render, o…
Actor.getMinimapLocationPoint?Where the actor is on the minimap, or nil when it is outside the minimap's radius or the minimap is hidden.
AwtMouseEvent.getPointPointThe position on the canvas, as a Point.
Client.getMouseCanvasPositionPointThe cursor, canvas pixels.
Component.getLocationPointThe position in the parent, as a new Point.
Container.getMousePositionPoint?Where the pointer is, in this container's coordinates, while the container is showing under it, else nil. With allowChildren false, onl…
GameObject.getSceneMaxLocationPointThe scene tile of its north-east corner.
GameObject.getSceneMinLocationPointThe scene tile of its south-west corner.
JList.indexToLocationPoint?The origin of row index's cell, or nil outside the model.
JShadowedLabel.getShadowSizePointThe shadow's offset from the text, as a new Point (1, 1 unless set).
JViewport.getViewPositionPointWhere the view's top-left shows, in view coordinates.
Overlay.getPreferredLocationPoint?The preferred location, or nil: the very Point given to setPreferredLocation, until the user drags or resets the overlay; then the one…
PerspectiveClass.getCanvasImageLocationPoint?The top-left corner that centres image over the point, zOffset up.
PerspectiveClass.getCanvasSpriteLocationPoint?The top-left corner that centres sprite over the point, zOffset up.
PerspectiveClass.getCanvasTextLocationPoint?Where to draw text (its baseline's left end) so it is centred over the point, zOffset up, measured in graphics' font; nil for a `ni…
PerspectiveClass.getCanvasTextMiniMapLocationPoint?Where to draw text (its baseline's left end) so it is centred on the point's minimap position, measured in graphics' font; nil off th…
PerspectiveClass.getMiniMapImageLocationPoint?The top-left corner that centres image on the point's minimap position.
PerspectiveClass.localToCanvasPoint?(Client, LocalPoint, number) -> Point?: The canvas point of a ground point on plane, or nil behind the camera or outside the scene.
PerspectiveClass.localToMinimapPoint?(Client, LocalPoint) -> Point?: The canvas point of a local point on the minimap, or nil past the cut-off (20 tiles at the default zoom…
PointClass.newPoint(number, number) -> Point: The point x, y.
Rectangle.getLocationPointThe corner, as a new Point.
Tile.getSceneLocationPointIts scene coordinates.
TileObject.getCanvasLocationPoint?(TileObject) -> Point?: Where its local centre projects onto the canvas, at its plane's ground height (`Perspective.localToCanvas(client,…
TileObject.getCanvasTextLocationPoint?The canvas point to draw text at, centred on the object's local location zOffset up (Perspective.getCanvasTextLocation: the anchor on…
TileObject.getCanvasTextLocationForWidthPoint?The point getCanvasTextLocation(graphics, text, zOffset) gives, for text textWidth pixels wide, without a graphics (outside a render, o…
TileObject.getMinimapLocationPoint?Where the object's local centre is on the minimap (Perspective.localToMinimap(client, getLocalLocation())), or nil past the minimap's r…
Widget.getCanvasLocationPointWhere the widget was last drawn on the canvas, as the client's draw loop records it ((-1, -1) before its first draw; a hidden widget keep…
WidgetItem.getCanvasLocationPointThe top-left corner of getCanvasBounds().
WorldMap.getWorldMapPositionPoint?The world tile at the centre of the map, or nil before the world map has been opened this session (the client has no world map yet).
WorldMap.worldPointToGraphicsPointPoint?The canvas point at the centre of worldPoint's tile on the open world map, or nil when the map is closed or its surface does not hold t…
WorldMapPoint.getImagePointPoint?The pixel of the image drawn on the tile (nil: the image's centre).

Method details

distanceTo

distanceTo: (Point, Point) -> number

The Euclidean distance to other, truncated to an int; the differences wrap as 32-bit integers.

distance

distance: ((Point, Point) -> number) & ((Point, number, number) -> number)

(Point, Point) -> number: The Euclidean distance to pt, as a double (not truncated, unlike distanceTo).

(Point, number, number) -> number: The Euclidean distance to (px, py), as a double.

equals

equals: (Point, any) -> boolean

Whether obj is a Point with the same x and y; anything else is false. == is identity: the same object.

new

new: ((number, number) -> Point) & ((Point) -> Point) & (() -> Point)

(number, number) -> Point: The point x, y.

(Point) -> Point: A copy of p.

() -> Point: The origin, (0, 0).