package objects
This package contains tools for representing objects that exist in two-dimensional space. In particular, it defines:
- the Anchor type: an anchor is the point where an object connects to its environment; and
- a number of traits (HasPos, HasVelocity, etc.) the classes of an application can mix in to gain access to various convenience methods.
NOTE TO STUDENTS: In this course, you don't need to understand how this package works or can be used.
That being said, some students may wish to experiment with some of its contents. Many of the traits in this
package have aliases in the top-level package o1, so they are accessible to students simply via import o1._
.
- Alphabetic
- By Inheritance
- objects
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait Anchor extends AnyRef
An
Anchor
is a point where a two-dimensional object, such as a Pic, attaches to other such objects; you can also think of it as a “pin” that attaches aPic
to a background.An
Anchor
is a point where a two-dimensional object, such as a Pic, attaches to other such objects; you can also think of it as a “pin” that attaches aPic
to a background.For instance, a
Pic
may have itsAnchor
at its center; thePic
may then be attached to a larger image at that image’sTopLeft
(another anchor), so that the center of the firstPic
is located at the top left-hand corner of the secondPic
.The companion object of this class provides several standard
Anchor
s and a classAnchor.Absolute
for creating new ones.Anchor
objects are immutable.This trait has an alias in the top-level package o1, so it’s accessible to students simply via
import o1._
.- See also
- trait HasAnchor extends HasSize
A supertype for objects that have an anchoring point.
- trait HasContainer extends HasEdges
A supertype for objects that take up a rectangular area and whose position may be constrained by a larger object around them.
- trait HasEdges extends HasPos with HasAnchor
A supertype for objects that take up a rectangular area and have an anchoring point.
A supertype for objects that take up a rectangular area and have an anchoring point. The object’s
pos
indicates the position of the anchoring point; the locations of its edges are determined relative to the anchor. - trait HasPos extends AnyRef
A supertype for objects that have a location in two-dimensional space.
- trait HasSize extends AnyRef
A supertype for objects that have a size: a width and a height.
- trait HasVelocity extends HasPos
A supertype for objects that have a position and a velocity in two-dimensional space.
Value Members
- object Anchor
This companion object of class
Anchor
contains a number of standard anchors (TopLeft
,Center
, etc.) and a class for creating anchors in a custom location.This companion object of class
Anchor
contains a number of standard anchors (TopLeft
,Center
, etc.) and a class for creating anchors in a custom location.The object has an alias in the top-level package o1, so it’s accessible to students simply via
import o1._
.- See also
- object mutable
This subpackage defines a few additional traits that extend the ones in of o1.world.objects.
This subpackage defines a few additional traits that extend the ones in of o1.world.objects. These traits provide additional convenience methods for working with mutable objects in two-dimensional space.
NOTE TO STUDENTS: In this course, you don't need to understand how this package works or can be used. That being said, some students may wish to experiment with some of its contents. Many of the traits in this package have aliases in the top-level package o1, so they are accessible to students simply via
import o1._
.