trait MovingObjectInContainer extends ContainedObject with HasVelocity
A supertype for objects that take up a rectangular area and have a velocity as well as a mutable position that may be constrained by a larger object around them.
- Alphabetic
- By Inheritance
- MovingObjectInContainer
- HasVelocity
- ContainedObject
- HasContainer
- HasEdges
- HasAnchor
- HasSize
- MutablePos
- HasPos
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract val container: HasEdges
another object that clampX, clampY, and clamp use for constraining this object’s position
- Definition Classes
- HasContainer
- abstract def height: Double
this object’s height: the distance from its top edge to its bottom edge
this object’s height: the distance from its top edge to its bottom edge
- Definition Classes
- HasSize
- abstract val pos: Pos
the object’s location
the object’s location
- Definition Classes
- MutablePos → HasPos
- abstract def velocity: Velocity
the object's velocity
the object's velocity
- Definition Classes
- HasVelocity
- abstract def width: Double
this object’s width: the distance from its left edge to its right edge
this object’s width: the distance from its left edge to its right edge
- Definition Classes
- HasSize
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def anchor: Anchor
Returns the object’s anchoring point, which is Anchor.Center unless overridden.
Returns the object’s anchoring point, which is Anchor.Center unless overridden.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bottom: Double
Returns the y coordinate of the bottom edge.
Returns the y coordinate of the bottom edge.
- Definition Classes
- HasEdges
- def bottomLeft: Pos
Returns the coordinates of this object’s bottom left-hand corner.
Returns the coordinates of this object’s bottom left-hand corner.
- Definition Classes
- HasEdges
- def bottomRight: Pos
Returns the coordinates of this object’s bottom right-hand corner.
Returns the coordinates of this object’s bottom right-hand corner.
- Definition Classes
- HasEdges
- def bringToContainer(): Unit
Causes this object’s pos to change so that the object is within its container, as per
clamp
.- Definition Classes
- ContainedObject
- def bringXToContainer(): Unit
Causes this object’s pos to change so that its left and right edges don’t extend beyond its container, as per
clampX
.Causes this object’s pos to change so that its left and right edges don’t extend beyond its container, as per
clampX
.- Definition Classes
- ContainedObject
- def bringYToContainer(): Unit
Causes this object’s pos to change so that its top and bottom edges don’t extend beyond its container, as per
clampY
.Causes this object’s pos to change so that its top and bottom edges don’t extend beyond its container, as per
clampY
.- Definition Classes
- ContainedObject
- def center: Pos
Returns the average position between this object’s edges.
Returns the average position between this object’s edges.
- Definition Classes
- HasEdges
- def centerFromTopLeft: Pos
the location of this object’s center: the average point between its edges, expressed in coordinates relative to the object’s top left-hand corner
the location of this object’s center: the average point between its edges, expressed in coordinates relative to the object’s top left-hand corner
- Definition Classes
- HasSize
- def clamp(): Pos
Looks for a position for this object that is as close to possible to the object's current pos but keeps the object's edges within the bounds of the object's container.
Looks for a position for this object that is as close to possible to the object's current pos but keeps the object's edges within the bounds of the object's container. Returns that
Pos
.- Definition Classes
- HasContainer
- def clampWhollyInside(container: HasEdges, desiredPosition: Pos = this.pos): Pos
Looks for a position for this object that is as close to possible to a particular target position but keeps the object's edges within the bounds of the given other object.
Looks for a position for this object that is as close to possible to a particular target position but keeps the object's edges within the bounds of the given other object.
- container
another object that sets the boundaries for the return value
- desiredPosition
the ideal position for this object (defaults to its current pos)
- returns
the location closest to
desiredPosition
where this object’s anchor can be placed without its edges extending beyondcontainer
- Definition Classes
- HasEdges
- def clampX(): Pos
Looks for a position for this object that is as close to possible to the object's current pos but keeps the left and right edges of the object within the bounds of the object's container.
Looks for a position for this object that is as close to possible to the object's current pos but keeps the left and right edges of the object within the bounds of the object's container. Returns that
Pos
.- Definition Classes
- HasContainer
- def clampXWhollyInside(container: HasEdges, desiredPosition: Pos = this.pos): Pos
Looks for a position for this object that is as close to possible to a particular target position but keeps the left and right edges of the object within the bounds of the given other object.
Looks for a position for this object that is as close to possible to a particular target position but keeps the left and right edges of the object within the bounds of the given other object.
- container
another object that sets the boundaries for the return value
- desiredPosition
the ideal position for this object (defaults to its current pos)
- returns
the location closest to
desiredPosition
where this object’s anchor can be placed without its left or right edge extending beyondcontainer
- Definition Classes
- HasEdges
- def clampY(): Pos
Looks for a position for this object that is as close to possible to the object's current pos but keeps the top and bottom edges of the object within the bounds of the object's container.
Looks for a position for this object that is as close to possible to the object's current pos but keeps the top and bottom edges of the object within the bounds of the object's container. Returns that
Pos
.- Definition Classes
- HasContainer
- def clampYWhollyInside(container: HasEdges, desiredPosition: Pos = this.pos): Pos
Looks for a position for this object that is as close to possible to a particular target position but keeps the top and bottom edges of the object within the bounds of the given other object.
Looks for a position for this object that is as close to possible to a particular target position but keeps the top and bottom edges of the object within the bounds of the given other object.
- container
another object that sets the boundaries for the return value
- desiredPosition
the ideal position for this object (defaults to its current pos)
- returns
the location closest to
desiredPosition
where this object’s anchor can be placed without its top or bottom edge extending beyondcontainer
- Definition Classes
- HasEdges
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def closestPosTo(target: Pos): Pos
Returns the position within this object’s edges that is as close as possible to the given position.
Returns the position within this object’s edges that is as close as possible to the given position.
- Definition Classes
- HasEdges
- def containsBetweenEdges(candidate: Pos): Boolean
Determines whether the given
Pos
’s x coordinate is between this object’s left edge (inclusive) and its right edge (exclusive) and if it’s y coordinate is similarly between the top and bottom edges.Determines whether the given
Pos
’s x coordinate is between this object’s left edge (inclusive) and its right edge (exclusive) and if it’s y coordinate is similarly between the top and bottom edges.- Definition Classes
- HasEdges
- def distance(another: HasPos): Double
Determines the distance (“as the crow flies”) between this object’s
pos
and that of the given object.Determines the distance (“as the crow flies”) between this object’s
pos
and that of the given object.- Definition Classes
- HasPos
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def internalAnchorPos: Pos
Returns the Pos of the anchoring point within this object, expressed as coordinates relative to the object’s top left-hand corner.
- def internalAnchorX: Double
Returns the x coordinate of the anchoring point within this object, relative to the object’s left edge.
Returns the x coordinate of the anchoring point within this object, relative to the object’s left edge.
- Definition Classes
- HasAnchor
- def internalAnchorY: Double
Returns the y coordinate of the anchoring point within this object, relative to the object’s top edge.
Returns the y coordinate of the anchoring point within this object, relative to the object’s top edge.
- Definition Classes
- HasAnchor
- def isBoundFor(direction: Direction): Boolean
Determines whether this objectis bound for roughly the given direction, as per Direction.sharesQuadrant.
Determines whether this objectis bound for roughly the given direction, as per Direction.sharesQuadrant.
- Definition Classes
- HasVelocity
- def isDownbound: Boolean
Determines whether this objecthas a downward velocity, as per Direction.isDownward.
Determines whether this objecthas a downward velocity, as per Direction.isDownward.
- Definition Classes
- HasVelocity
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLeftbound: Boolean
Determines whether this objecthas a leftward velocity, as per Direction.isLeftward.
Determines whether this objecthas a leftward velocity, as per Direction.isLeftward.
- Definition Classes
- HasVelocity
- def isRightbound: Boolean
Determines whether this objecthas a rightward velocity, as per Direction.isRightward.
Determines whether this objecthas a rightward velocity, as per Direction.isRightward.
- Definition Classes
- HasVelocity
- def isUpbound: Boolean
Determines whether this objecthas an upward velocity, as per Direction.isUpward.
Determines whether this objecthas an upward velocity, as per Direction.isUpward.
- Definition Classes
- HasVelocity
- def left: Double
Returns the x coordinate of this object’s left edge.
Returns the x coordinate of this object’s left edge.
- Definition Classes
- HasEdges
- def moveFreely(): Unit
Causes the object’s pos to change: the object moves from its current location at its current velocity for one unit of time.
- def moveWithinContainer(): Unit
Causes the object’s pos to change: the object moves from its current location at its current velocity for one unit of time (as per moveFreely) and is then immediately clamped to the object’s container (as per
bringToContainer
). - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nextPos: Pos
Returns the
Pos
that this object, moving from its current location at its current velocity, reaches in one unit of time.Returns the
Pos
that this object, moving from its current location at its current velocity, reaches in one unit of time. That is, adds thedx
anddy
components of the velocity to the currentPos
and returns the result.- Definition Classes
- HasVelocity
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def right: Double
Returns the x coordinate of the right edge.
Returns the x coordinate of the right edge.
- Definition Classes
- HasEdges
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
- Definition Classes
- AnyRef → Any
- def top: Double
Returns the y coordinate of the top edge.
Returns the y coordinate of the top edge.
- Definition Classes
- HasEdges
- def topLeft: Pos
Returns the coordinates of this object’s top left-hand corner.
Returns the coordinates of this object’s top left-hand corner.
- Definition Classes
- HasEdges
- def topRight: Pos
Returns the coordinates of this object’s top right-hand corner.
Returns the coordinates of this object’s top right-hand corner.
- Definition Classes
- HasEdges
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.