Class Stage

  • All Implemented Interfaces:
    Drawable

    public class Stage
    extends DisplayObjectContainer
    Root of the display tree. Display objects added to stage can only be rendered, every Myna instance has one Stage connected to it which can be replaced by another stage on demand.
    • Constructor Detail

      • Stage

        public Stage​(Myna myna,
                     Color color)
        Default Constructor. Create a new stage with given color as it's background color.
    • Method Detail

      • getRequiresRedraw

        public boolean getRequiresRedraw()
        A method that indicates if the hierarchy has changed or not so the frame should be redrawn.
      • setRequiresRedraw

        public void setRequiresRedraw​(boolean requiresRedraw)
        Forces a redraw if true is set.
      • resizeAll

        public void resizeAll()
        Resizes every object in the hierarchy to fit the new stage size.
      • addAll

        public void addAll()
        Traverse the tree for every drawable to create render tree.
      • drawAll

        public void drawAll()
        Called by renderer to draw all the drawables in this stage.
      • getColor

        public Color getColor()
        Gets current background color.
        Returns:
        Current Background Color
      • setColor

        public void setColor​(Color color)
        Sets Background Color
        Parameters:
        color - color to set
      • setWidth

        public void setWidth​(int newWidth)
        Sets width of stage.
      • setHeight

        public void setHeight​(int newHeight)
        Sets height of stage.
      • setSize

        public void setSize​(int newWidth,
                            int newHeight)
        Sets size of stage
        Parameters:
        newWidth - width
        newHeight - height
      • getView

        public View getView()
        Gets current view of the stage.
        Returns:
        View current view
      • setView

        public void setView​(View view)
        Sets a new View for this stage.
        Parameters:
        view - new view
      • recalculateMatrix

        protected void recalculateMatrix()
        Description copied from class: DisplayObject
        Recalculates the matrix with it's current transformations.
        Overrides:
        recalculateMatrix in class DisplayObject