Packages

  • package root
    Definition Classes
    root
  • package o1

    O1Library is a toolkit designed for the course Programming 1 (a.k.a. O1) at Aalto University.

    O1Library is a toolkit designed for the course Programming 1 (a.k.a. O1) at Aalto University. It contains an assortment of tools; most prominently, it provides a framework for simple graphical programming and utilities for playing sound.

    This is the front page of O1Library’s documentation. However, this is probably not the best place to start learning about O1Library as a student. That’s because the relevant content of this library is introduced bit by bit in the chapters of O1’s custom ebook alongside the associated programming concepts and assignments.

    You may still find this documentation useful as a reference. You can also find some optional content here that you may wish to try.

    This front page lists the content available in the top-level package called simply o1. These tools are available with the simple command import o1._ in your Scala programs. Some of them you’ll use a lot; some of them you won’t necessarily need at all.

    The tools listed here are actually implemented in a number of subpackages (o1.gui, o1.sound, etc.); what you see here are just “shortcut aliases” to those actual implementations. The aliases are here to make that convenient import command work and to provide you with this list of links to some of the more commonly used tools in O1Library. The subpackages also contain additional content not listed here.

    O1Library has been developed by Aleksi Lukkarinen and Juha Sorva. Several of the key components in o1.gui and o1.world are built upon Aleksi’s Scala Media Computation Library. Some parts of O1Library draw inspiration from the “teachpacks” of the Racket programming language.

    We are grateful to Riku Autio, Joonatan Honkamaa, Juhani Numminen, Leo Varis, Veera Kahva, and anonymous students for bug reports and fixes. We thank Otto Seppälä for helpful discussions.

    Definition Classes
    root
  • package world

    This package contains tools for locations and movement in two-dimensional space.

    This package contains tools for locations and movement in two-dimensional space.

    The tools in this package have aliases in the top-level package o1, so they are accessible to students simply via import o1._.

    The subpackage o1.world.objects contains additional tools for representing entities that reside within two-dimensional spaces.

    Definition Classes
    o1
  • package objects

    This package contains tools for representing objects that exist in two-dimensional space.

    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._.

    Definition Classes
    world
  • Bounds
  • Direction
  • Pos
  • Velocity

object Direction extends Serializable

This companion object of class Direction provides some constants of type Direction and methods for creating new Direction instances.

The object has an alias in the top-level package o1, so it’s accessible to students simply via import o1._.

Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Direction
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val Down: Direction

    the “straight downwards” direction with a dx of zero, and a dy of +1

  5. val Left: Direction

    the “straight leftwards” direction with a dx of -1, and a dy of zero

  6. val NoDirection: Direction { val toString: String }

    a “non-direction” whose dx and dy are both zero

  7. val Right: Direction

    the “straight rightwards” direction with a dx of +1, and a dy of zero

  8. val Up: Direction

    the “straight upwards” direction with a dx of zero, and a dy of -1

  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def fromArrowKey(key: Key): Option[Direction]

    Returns the Direction that corresponds to the given arrow key.

    Returns the Direction that corresponds to the given arrow key. For example, the right arrow corresponds to Right.

    key

    any key on the keyboard

    returns

    one of Up, Down, Left, Right; None if the given key was not one of the four arrow keys

    See also

    fromWASD, fromKey

  14. def fromDegrees(angle: Double): Direction

    Takes in an angle as degrees and returns the corresponding Direction.

    Takes in an angle as degrees and returns the corresponding Direction. Zero degrees points rightwards; positive angles are counterclockwise from there, negative ones clockwise.

  15. def fromDeltas(dx: Double, dy: Double): Direction

    Takes in a difference between x coordinates and a difference between y coordinates and constructs a Direction from them.

    Takes in a difference between x coordinates and a difference between y coordinates and constructs a Direction from them.

    dx

    a difference between two x coordinates; it is not necessary that this is normalized between -1.0 and +1.0 like the dx and dy of the resulting Direction object

    dy

    a difference between two x coordinates; it is not necessary that this is normalized between -1.0 and +1.0 like the dx and dy of the resulting Direction object

    returns

    the Direction that corresponds to the given deltas. If both are exactly equal to zero, returns NoDirection.

  16. def fromKey(key: Key): Option[Direction]

    Returns the Direction that corresponds to the given arrow key.

    Returns the Direction that corresponds to the given arrow key. For example, the right arrow or the D key corresponds to East.

    key

    any key on the keyboard

    returns

    one of Up, Down, Left, Right; None if the given key was not one of the four arrow keys or one of the four WASD keys

    See also

    fromArrowKey, fromWASD

  17. def fromRadians(angle: Double): Direction

    Takes in an angle as radians and returns the corresponding Direction.

    Takes in an angle as radians and returns the corresponding Direction. Zero radians points rightwards; positive angles are counterclockwise from there, negative ones clockwise.

  18. def fromWASD(key: Key): Option[Direction]

    Returns the Direction that corresponds to the given WASD key.

    Returns the Direction that corresponds to the given WASD key. For example, the D key corresponds to East.

    key

    any key on the keyboard

    returns

    one of Up, Down, Left, Right; None if the given key was not one of the four WASD keys

    See also

    fromArrowKey, fromKey

  19. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. def random(): Direction

    Returns a randomly chosen direction (evenly distributed over 360 degrees).

  26. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  27. def toString: String
    Definition Classes
    AnyRef → Any
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. 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.

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped