Class AbstractSketch

  • All Implemented Interfaces:
    Sketch

    public abstract class AbstractSketch
    extends Object
    implements Sketch
    This is an abstract implementation of Sketch. This contains protected fields for the graphics and parent PApplet as well some basic implementations of other methods.
    • Field Detail

      • graphics

        protected final processing.core.PGraphics graphics
        the PGraphics instance that this sketch will use to draw objects.
      • parent

        protected final processing.core.PApplet parent
        The parent processing sketch of this sketch. Can be used for PApplet methods.
      • autoGenerated

        protected boolean autoGenerated
    • Constructor Detail

      • AbstractSketch

        public AbstractSketch​(processing.core.PApplet parent,
                              int width,
                              int height)
        Constructor this creates a PGraphics object with the size provided in the parameters and the renderer specified by PConstants.OPENGL.
        Parameters:
        parent - the parent PApplet.
        width - the width of the sketch in pixels.
        height - the height of the sketch in pixels.
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Sketch
        Returns the name of the sketch. This is what will show up in the UI dropdown. Implement this to return custom labels if desired.
        Specified by:
        getName in interface Sketch
        Returns:
        the name of the class of the sketch
      • getPGraphics

        public processing.core.PGraphics getPGraphics()
        Description copied from interface: Sketch
        Return the PGraphics associated with this sketch.
        Specified by:
        getPGraphics in interface Sketch
        Returns:
        the graphics object associated with this sketch.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isAutoGenerated

        public boolean isAutoGenerated()
        Specified by:
        isAutoGenerated in interface Sketch
        Returns:
        true if this sketch was auto-generated by SketchMapper.
      • setAutoGenerated

        public void setAutoGenerated​(boolean autoGenerated)
        Description copied from interface: Sketch
        Set the autoGenerated property.
        Specified by:
        setAutoGenerated in interface Sketch
        Parameters:
        autoGenerated - the autogenerated property