Class Object

java.lang.Object
io.github.espressoengine.object.Object
Direct Known Subclasses:
Label, Mesh2D, Sprite2D

public class Object extends Object

Base class for all drawable objects.

Version:
$Id: $Id
Author:
pastthepixels
  • Field Details

    • position

      public Vector2 position
    • _enginePosition

      public Vector2 _enginePosition
    • rotation

      public double rotation
    • dbg

      public boolean dbg
    • visible

      public boolean visible
    • zIndex

      public int zIndex
    • boundingBox

      public Rectangle2D boundingBox
  • Constructor Details

    • Object

      public Object()
  • Method Details

    • getZIndex

      public int getZIndex()
      Getter for the field zIndex. Note: Just for Comparator.comparing. We don't need this because zIndex is public.
      Returns:
      a int
    • updateBoundingBox

      public void updateBoundingBox(AffineTransform transform)
      Recreates a bounding box from an java.awt.geom.AffineTransform. This function called every time a scene is drawn and is yet another empty function designed to be overridden.
      Parameters:
      transform - a AffineTransform object
    • getBoundingBoxPosition

      public Vector2 getBoundingBoxPosition()
      Returns the position of an object's bounding box.
      Returns:
      a Vector2 object
    • lookAt

      public void lookAt(Vector2 lookpos)

      Rotates an object to point at a Vector2

      Parameters:
      lookpos - a Vector2 object
    • onBeforeDraw

      public void onBeforeDraw()

      Executed in the draw loop, before the actual drawing begins. Designed to be overridden.